Closed evetion closed 2 years ago
v0.5.7
?)Benchmark CI doesn't seem to update to latest GeoInterface (still using v0.5.7?)
That'd be because of Shapefile.jl
@rafaqz can you take a look here at the convert
options? I keep running into ambiguous things, as our suggetion for implementing convert
overrides everything, including existing methods such as those for GeoFormatTypes.
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 ArchGDAL.AbstractGeometry
. That will work. Both first arguments need to be equally specific
We need to dispatch both on ArchGDAL.AbstractGeometry. That will work. Both first arguments need to be equally specific.
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 IGeometry
as well I guess? I cant remember the distinctions honestly.
I'm leaning towards the idea that only IGeometries should be created from conversion, while all geometries can function as a source
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 https://github.com/JuliaGeo/Shapefile.jl/pull/72 is merged and released.
Ok, I can't merge without review approval from someone 👀. I think it's done, coverage has been increased as asked by @yeesian. I've fixed the comments by @rafaqz and @visr. The benchmark suite seems to require a released ArchGDAL version to test against, so it still fails.
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.