Skip to content
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

Merge geojsontables #42

Merged
merged 58 commits into from
Jul 3, 2022
Merged

Merge geojsontables #42

merged 58 commits into from
Jul 3, 2022

Conversation

rafaqz
Copy link
Member

@rafaqz rafaqz commented Jun 30, 2022

This PR completely replaces GeoJSON.jl with the code form https://github.com/visr/GeoJSONTables.jl/

This gives compatibility with Tables.jl interface and GeoInterface.jl 1.0.

It also means lazing loading of objects with JSON3.jl.

visr and others added 30 commits August 18, 2019 15:27
if we want to treat it differently than the rest, it should not be part of the rest
* Switch to GitHub Actions for CI

* don't test all point releases
to avoid having to define the geointerface over the generic JSON3.Object 
type
The geometry JSON objects generally only contain "type" and 
"coordinates". The type is already known since it is the name of the 
struct. Therefore we can just put the "coordinates" inside, which is a 
JSON3.Array. Doing some benchmarks on the previous geometry structs, 
which all needed to access the coordinates field, I found that simply 
accessing this field was quite slow. Implementing it this way avoids 
that cost. The downside is that "foreign members" that may be contained 
in the geometry object will be lost, however this is not required by the 
spec.
Just like JSON3.Array. This means a lot more methods will accept them.
From the geointerface get* functions. This ensures that the result of 
these functions also comply to the geointerface.
visr and others added 12 commits June 28, 2022 21:47
Requiring this led to quite the refactor. Now the geometry structs don't only store the `JSON3.Array` with their coordinates, but the entire object. This includes the optional bbox, and any GeoJSON object may have other members according to the spec. The object is not restricted to a `JSON3.Object`, since these are the products of reading JSON strings. If we want to create another sub-geometry using `GeoInterface.getgeom` we need to be able to create them as well, For this we use a NamedTuple in the geometry, similar to the `_lower` approach for writing.
The type parameter T is taken from peeking at the first feature if it exists. This is needed to make iterating over the features ini a featurecollection type stable.

The features field was added after I noticed that the change above hardly helped iteration performance. On every `iterate` call the features had to be taken out of the JSON3.Object, which cannot be inferred. So it is better to keep them in the object, since they are a view on the same tape anyway.
- test GeoInterface.isclosed
- add Aqua tests
Perhaps later on we can split tests into files such that this isn't all indented. But reading which tests fail is a pain without a root testset.
Copy link
Member

@visr visr left a comment

Choose a reason for hiding this comment

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

So if we merge this with a merge commit then the commits from both projects are retained in the history, right? Something like JuliaGraphs/Graphs.jl@9a25019

If so I'm fine with merging this. Several follow up commits are needed after that is done, ones I can think of now:

  • rename GeoJSONTables to GeoJSON
  • set the package UUID back to the GeoJSON one
  • set the version number to be the next breaking release from v0.5 (perhaps let's jump to v1, so we can use semver fully?)

Since @yeesian started this package, I'd like his approval as well. For context see discussion in #36, and a list of known improvements in visr/GeoJSONTables.jl#15 (comment).

@visr visr requested a review from yeesian June 30, 2022 11:31
@rafaqz
Copy link
Member Author

rafaqz commented Jun 30, 2022

Haha I forgot to do the seach and replace on GeoJSONTables and fix the UUID. Will do now.

Copy link
Member

@yeesian yeesian left a comment

Choose a reason for hiding this comment

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

Thank you!

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.

4 participants