-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add support for GeoInterface CRS metadata #25
Conversation
Does the ProjJSON type work with a Dict? I'm pretty sure it would have to be a String...at least to be passed to GDAL. |
Yes, ProjJSON type supports |
And julia> using GeoParquet, Parquet2, DataFrames, JSON3, GeoFormatTypes
julia> df = GeoParquet.read("example.parquet")
5×6 DataFrame
Row │ pop_est continent name iso_a3 gdp_md_est geometry
│ Float64? String? String? String? Int64? WellKnow…
─────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 889953.0 Oceania Fiji FJI 5496 WellKnownBinary{Geom, Vector{UIn…
⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮
4 rows omitted
julia> crs = metadata(df, "GEOINTERFACE:crs");
julia> jsonstr = JSON3.write(GeoFormatTypes.val(crs));
julia> newcrs = ProjJSON(jsonstr);
julia> GeoParquet.write("test.parquet", df, (:geometry,), newcrs)
"test.parquet"
julia> GeoParquet.read("test.parquet")
ERROR: ArgumentError: Not a ProjJSON: ... julia> ds = Parquet2.Dataset("test.parquet");
julia> meta = JSON3.read(Parquet2.metadata(ds)["geo"]);
julia> meta.columns.geometry.crs
JSON3.Object{Base.CodeUnits{UInt8, String}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}} with 1318 entries:
Symbol("1") => "{"
Symbol("2") => "\""
Symbol("3") => "\$"
Symbol("4") => "s"
Symbol("5") => "c"
⋮ => ⋮ |
Looks like a bug |
That's also type piracy! |
Yes, my PR doesn't solve these issues, but for now, I think it's enough. These issues can be solved in other PRs. |
Looks good to me for now, would be nice to add a test though. Maybe the code you have in the README would suffice for that? Long term we need better geometry support, since WKB geoms won't have attached CRS for example. But that can wait for later. |
@asinghvi17, tests added. |
Thanks @eliascarv, sorry for the delay in merging. I will do some light maintenance here and make a release soon. |
Waiting for JuliaGeo/GeoInterface.jl#161
Closes #24
Test code: