-
Notifications
You must be signed in to change notification settings - Fork 26
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
Implement new GeoInterface traits #290
Conversation
|
That'd be because of Shapefile.jl ArchGDAL.jl/benchmark/Project.toml Line 6 in e401e00
|
@rafaqz can you take a look here at the Expression: sprint(print, convert(AG.IGeometry, json)) == "Geometry: POINT (100 70)"
MethodError: convert(::Type{ArchGDAL.IGeometry}, ::GeoFormatTypes.GeoJSON{String}) is ambiguous. Candidates:
convert(::Type{T}, source::X) where {T<:ArchGDAL.AbstractGeometry, X<:GeoFormatTypes.GeoJSON} in ArchGDAL at /Users/evetion/code/ArchGDAL.jl/src/convert.jl:48
convert(::Type{T}, geom::X) where {T<:ArchGDAL.IGeometry, X} in ArchGDAL at /Users/evetion/code/ArchGDAL.jl/src/geointerface.jl:262
Possible fix, define
convert(::Type{T}, ::X) where {T<:ArchGDAL.IGeometry, X<:GeoFormatTypes.GeoJSON} |
We need to dispatch both on |
Well that's what I did first, but it segfaults preparedgeometry tests(!). Something to investigate, but otherwise, I'm leaning towards the idea that only IGeometries should be created from conversion, while all geometries can function as a source. But maybe better as an issue than to keep changing more and more in this PR. |
Both can be on |
Yeah I think this might be a viable approach (or at least it was how I was mentally thinking about things without properly having articulated them anywhere) |
Benchmark should be able to run when JuliaGeo/Shapefile.jl#72 is merged and released. |
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.
Overall LGTM, thank you so much!
Might be good to update the top level comment of this PR with the changes.
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.
Few minor comments, otherwise LGTM
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.
LGTM, thank you so much for seeing this through!
GeoInterface 1.0 makes use of Traits, this is a PR to update our pre-1.0 GeoInterface implementation.
Note that I had to add some methods to align with GeoInterface:
getm
method, previously not wrappedgetgeom
for LineStrings. Technically OGR doesn't expose this (and wants us to use getpoint), but ourngeom
does have a switch for Lines.is3d
andismeasured
to be used when getting the the third or fourth coordinatekeys
andvalues
to a FeatureI've also added dependencies on
GeoInterfaceRecipes
, a plot package based onGeoInterface
, which previously was integrated intoGeoInterface
and onExtents
, a package defining bounding boxes asNamedTuples
.I also note that much in ArchGDAL doesn't support Z en M coordinates properly, for which I will create a separate issue. In short, many of our creation methods don't result in the correct type (just a Point instead of Point25D etc.). This makes it hard to correctly implement
getcoord
for them
dimension, as it could be both the third or fourth dimension, depending on the type.