-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: CSV, Excel and JSON writer - reduce to single geometries if dat… #1173
feat: CSV, Excel and JSON writer - reduce to single geometries if dat… #1173
Conversation
2ec4e30
to
e4336a3
Compare
if (!headerRow.contains(propertyTypeName)) { | ||
headerRow.add(propertyTypeName); | ||
} | ||
|
||
if (property instanceof DefaultGeometryProperty<?>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instanceof
check and the cast later should be done with the interface GeometryProperty
and not the implementation class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stempler the property that comes in the line 242 is a GeometryProperty<?>
and not a GeometryCollection
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand. This comment was about using GeometryProperty
instead of DefaultGeometryProperty
, which you also did, so what is the open point here from your view?
|
||
if (geometry instanceof GeometryCollection | ||
&& ((GeometryCollection) geometry).getNumGeometries() == 1) { | ||
property = geometryProperty.getGeometry().getGeometryN(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this the CRS information gets lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stempler what it was done here was just after taking the geometry from the property, so after (GeometryProperty<?>) property
. If you tell me that I need to check if the property is an instanceof GeometryCollection
then that condition it will never be true.
In the InstanceToJson is another story, already in the method comes a parameter which is a GeometryProperty<?>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid I don't understand the context of your comment.
If you tell me that I need to check if the property is an instanceof GeometryCollection then that condition it will never be true
If you refer to my comment here
- this comment was on another place in the code where the JTS geometry is handled, not the geometry property
- I did not tell you anything, I just asked if there was a specific reason for the change to check for some
GeometryCollection
subclasses instead of the base class
...humboldt.hale.io.csv/src/eu/esdihumboldt/hale/io/csv/writer/AbstractTableInstanceWriter.java
Outdated
Show resolved
Hide resolved
e4336a3
to
24363d5
Compare
if (geometry instanceof MultiPoint) { | ||
MultiPoint multiPoint = (MultiPoint) geometry; | ||
if (multiPoint.getNumGeometries() == 1) { | ||
return multiPoint.getGeometryN(0); | ||
} | ||
} | ||
else if (geometry instanceof MultiLineString) { | ||
MultiLineString multiLineString = (MultiLineString) geometry; | ||
if (multiLineString.getNumGeometries() == 1) { | ||
return multiLineString.getGeometryN(0); | ||
} | ||
} | ||
else if (geometry instanceof MultiPolygon) { | ||
MultiPolygon multiPolygon = (MultiPolygon) geometry; | ||
if (multiPolygon.getNumGeometries() == 1) { | ||
return multiPolygon.getGeometryN(0); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic before with the GeometryCollection
was fine, any specific reason to change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't change that. Before I have used DefaultGeometryProperty and now GeometryProperty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you changed it. In the original version you did it the same way as in your changes to InstanceToJson
, just checking for GeometryCollection
and not these three subtypes. That's why I wondered if there is a specific reason to do it like that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the comments above regarding your question.
I have already implemented the solution you proposed but for me it is not valid. Therefore, I won't be committing it. Could you please reconsider your approach? I would greatly appreciate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't really follow you. What proposal do you mean?
I see in the current commit you changed the logic back to checking GeometryCollection
instead of the three subclasses that were checked in the code related to the original comment in this thread. The only thing I did was asking about if there was a specific reason for the change to check the three subclasses instead of only GeometryCollection
as you did in your first implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No specific reason. In my opinion was a good approach but just using getGeometryN(0) it's enough for all the cases so I dropped the method.
...humboldt.hale.io.csv/src/eu/esdihumboldt/hale/io/csv/writer/AbstractTableInstanceWriter.java
Outdated
Show resolved
Hide resolved
71d3459
to
5f2927c
Compare
Is the second commit intended to be a fixup commit? Then it should start with |
5f2927c
to
816c59d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase locally to combine the commits (since the PR is from a fork, the /autosquash
command does not work, also the commit message of the fixup commit seems to not reference the original commit correctly)
...s/eu.esdihumboldt.hale.io.json/src/eu/esdihumboldt/hale/io/json/internal/InstanceToJson.java
Outdated
Show resolved
Hide resolved
c8e554d
to
a544940
Compare
…a does not contain multi geometry CSV, Excel and JSON writer have been reduced to single geometries if data contains single geometry. ING-3570 Closes halestudio#986
a544940
to
a3213ac
Compare
🎉 This PR is included in version 5.2.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
…a does not contain multi geometry
CSV, Excel and JSON writer have been reduced to single geometries if data contains single geometry.
ING-3570
Closes #986