Skip to content

Commit 25fcaf3

Browse files
Pure Julia WKT2 to PROJJSON conversion (#156)
* add testing against json schema * half-complete implementation for processing GEOGCRS * use DeepDiffs.jl for semantic comparison between nested Dicts * add processing for GEOGCRS(Variant 1: ENSEMBLE) * add processing for GEOGCRS(Variant 2: DATUM) * handle UNIT optionally occurring in coordinate_system or each axis * testing utils * testing * add processing for GEODCRS * add processing for DYNAMIC entries is GEOG and GEOD. These end up effecting the "datum" json items * uncommitted changes * add processing for PROJCRS * replace the actual projjsonstring function * remove ArchGDAL dependency * Revert "remove ArchGDAL dependency" This reverts commit 33fac70. turns out ArchGDAL is still needed for other functionality * solid cleanup round * refactor testing utils * side step EPSGs unsupported by the WKT dataset * Fix 8% of cases where axis.direction should not start with uppercase * add support for meridian and prime_meridian optional nodes * support custom units for measurments (Clarke's foot??) * full unit support * ellipsoid cleanup * git revert hot fix * finalize testsuite * testset fix * reorganize wkt2json.jl * rename wktdict2jsondict to wkt2json * simple test to make sure our main callsite is tested * cleanup test/jsonutils.jl * remove test dependency on DeepDiffs as it still had few false-negatives DeepDiffs and PrettyPrinting are still vastly useful when developing * remove import DeepDiffs * reintroduce changes after merging with master * turns out spatialref is still needed for extra/gdal.jl * change file locations * rename vars and helper functions to be more inline with style * adjust and rename itembykey (to finditem) * various improvements to comments * delete commented code * run JuliaFormatter * various comments, error msgs, and code cleanups * one round of cleanups for test/jsonutils.jl * cleanup debug_json (now check_projjson) test/jsonutils.jl * test/jsonutils.jl renames * style renames * refactor wkt2json_datum and change it's encapsulation * mass consistency renames * error msg improvements * remove 80% of remaining underscores to fit project style * Move test/jsonutils.jl to outside testfiles * Rename test/jsonutils.jl to test/testutils.jl * Move all test utilities to test/testutils.jl * Miscellaneous cleanup * More refactoring * Fix typo * Rename src/projjson.jl to src/crsstrings.jl * Refactor src/conversion.jl * Refactor tests * Refactor tests * Minor adjustments * follow style, remove function return type * minor adjustments as per PR review * organize and elaborate on testing edge cases * remove helper debugging functions * Final cleanup * Final code style fixes * Move functions around * Additional cleanup * jsonroundtrip is not needed anymore. Do not leave any SubStrings in the jsondict I found the reason `jsonroundtrip` was needed for `JSONSchema.validate` to work properly. Turns out there is a bug in JSONSchema that makes it faultily deal with the underlying String behind a SubStrings --------- Co-authored-by: Júlio Hoffimann <[email protected]>
1 parent 6fa0eec commit 25fcaf3

File tree

14 files changed

+1763
-70
lines changed

14 files changed

+1763
-70
lines changed

src/GeoIO.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import GeoInterface as GI
5353
import GeoFormatTypes as GFT
5454
import ArchGDAL.GDAL
5555

56-
# ProjJSON CRS
56+
# PROJJSON CRS
5757
import JSON3
5858

5959
# VTK extensions
@@ -112,10 +112,13 @@ function formats(io=stdout; sortby=:extension)
112112
pretty_table(io, sorted, alignment=:c, crop=:none, show_subheader=false)
113113
end
114114

115-
# utilities
115+
# basic utilities
116116
include("utils.jl")
117117

118-
# conversions
118+
# utilities for CRS strings
119+
include("crsstrings.jl")
120+
121+
# utilities for geometry conversion
119122
include("conversion.jl")
120123

121124
# extra code for backends

src/conversion.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Licensed under the MIT License. See LICENSE in the project root.
33
# ------------------------------------------------------------------
44

5+
raw(coords::CRS) = coords.x, coords.y
6+
raw(coords::LatLon) = coords.lon, coords.lat
7+
58
# --------------------------------------
69
# Minimum GeoInterface.jl to perform IO
710
# --------------------------------------
@@ -23,9 +26,6 @@ GI.ncoord(::GI.PointTrait, p::Point) = CoordRefSystems.ncoords(crs(p))
2326
GI.getcoord(::GI.PointTrait, p::Point) = ustrip.(raw(coords(p)))
2427
GI.getcoord(trait::GI.PointTrait, p::Point, i) = GI.getcoord(trait, p)[i]
2528

26-
raw(coords::CRS) = coords.x, coords.y
27-
raw(coords::LatLon) = coords.lon, coords.lat
28-
2929
GI.ncoord(::GI.LineTrait, s::Segment) = CoordRefSystems.ncoords(crs(s))
3030
GI.ngeom(::GI.LineTrait, s::Segment) = nvertices(s)
3131
GI.getgeom(::GI.LineTrait, s::Segment, i) = vertex(s, i)

0 commit comments

Comments
 (0)