Skip to content

fix write multilinestring #68

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

Merged
merged 4 commits into from
Jun 16, 2023
Merged

Conversation

ErickChacon
Copy link
Contributor

Adress #67 and JuliaEarth/GeoTables.jl#4. I have no experienve with GeoJSON.jl but it fixes the issue of saving MultiLineString as Polygon.

Copy link
Member

@rafaqz rafaqz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Would be good to have a test for this too

@ErickChacon
Copy link
Contributor Author

Thanks. Would be good to have a test for this too

Great! I will add a test.

@ErickChacon
Copy link
Contributor Author

@rafaqz. I added a test that checks writing when using _lower which will be the case when other packages uses GeoJSON.jl to write to a file.

@rafaqz
Copy link
Member

rafaqz commented Jun 11, 2023

I don't totally understand why we would test _lower and not just write ?

@ErickChacon
Copy link
Contributor Author

I don't totally understand why we would test _lower and not just write ?

Because once we read the objects defined in the test, they are a subtype of GeoJSONT, so the function _lower does not get called and it is a reason why the error was not catched before.

The use case of _lower will happen when trying to save geometries defined from another package (e.g. Geotables.jl, Shapefile.jl, ...). So, in this case I am trying to exemplify what would happen when writing using geomtries from other packages.

That is what I understand from the lines:

GeoJSON.jl/src/io.jl

Lines 45 to 50 in b9825e9

write(io, obj::GeoJSONT) = JSON3.write(io, obj)
write(obj::GeoJSONT) = JSON3.write(obj)
# GeoInterface supported objects
write(io, obj) = JSON3.write(io, _lower(obj))
write(obj) = JSON3.write(_lower(obj))

@rafaqz
Copy link
Member

rafaqz commented Jun 12, 2023

Ok makes sense. Could you instead do GeoInterface.convert(GeoInterface, geom) to use regular write on a different type? Wouldnt that catch it too?

@juliohm
Copy link
Member

juliohm commented Jun 15, 2023

@rafaqz I think the PR is ready for a second review.

@ErickChacon
Copy link
Contributor Author

I modified the tests to use GeoInterface.convert. This method can be used only for non-null geometries, so I defined featuresgeom for features with non-null geometries.

@juliohm
Copy link
Member

juliohm commented Jun 16, 2023

@rafaqz I am merging this as a hot-fix since you gave me permission to take more action in packages of the org. This is blocking some advances downstream. @ErickChacon has updated the tests following your suggestions.

@juliohm juliohm merged commit a27e5d3 into JuliaGeo:main Jun 16, 2023
@rafaqz
Copy link
Member

rafaqz commented Jun 16, 2023

Thanks, looks good.

But do note that expecting one day turn around response for JuliaGeo reviews might be a little ambitious ;)

(Also note that I cant give you total permission to do anything in JuliaGeo, this is a collective social process with a number of people involved, and its good to keep that in mind, along with the fact we all have lives and full time jobs. Patience is often required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants