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

Add flag for reading ids from geojson source #4228

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

montzkie18
Copy link

@montzkie18 montzkie18 commented May 14, 2021

GeoJSON: Expose use_id_from_source datasource parameter to load features with their original ids from the source. Should address #4227

Things to note here:

  • Added a separate Spirit X3 rule for features that have an ID. This means by default parsing without any flags set will continue to ignore Feature.id. But once the flag is set, it will throw an error for invalid ids (e.g. string, null, etc...)
  • Used feature.use_id_from_source() to check which grammar to use. I figured it can also be used by other plugins if they want to make it as an option.
  • All instances where this flag is required is set to false by default. It should not change behavior for downstream packages.
  • Since this is opt-in, I don't think it breaks the original design decision to ensure Feature.ids as unique internally.

Depends on this PR: mapnik/test-data#23

@montzkie18 montzkie18 changed the title Add flag for reading ids from geojson source (#4227) Add flag for reading ids from geojson source May 14, 2021
@montzkie18
Copy link
Author

hi @artemp - any chance I can get a review for this one?

@artemp
Copy link
Member

artemp commented May 18, 2021

hi @artemp - any chance I can get a review for this one?

@montzkie18 - Yes, I'll find time asap. Thanks for your contribution!

@artemp artemp self-requested a review May 18, 2021 12:39
@artemp artemp self-assigned this May 18, 2021
@artemp artemp added this to the v4.0.0 milestone May 18, 2021
@artemp
Copy link
Member

artemp commented May 25, 2021

@montzkie18 - Could you check test data is updated, I'm getting

could not get file mapping for ./test/data/json//feature-with-id.json

thanks.

@montzkie18
Copy link
Author

montzkie18 commented May 25, 2021

Hi @artemp - thanks for looking into this.

Could you check test data is updated

The updated test data is pushed to this PR: mapnik/test-data#23
I'm not sure how to best handle submodules update here without that PR getting merged first.
Should I point the submodule in this PR temporarily to the forked repo and branch?

EDIT: nvm, I pushed the submodule changes here with the correct git hash

@codecov
Copy link

codecov bot commented May 25, 2021

Codecov Report

Merging #4228 (e7bb0ac) into master (fb2e45c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4228   +/-   ##
=======================================
  Coverage   71.86%   71.86%           
=======================================
  Files         446      446           
  Lines       23271    23272    +1     
=======================================
+ Hits        16723    16724    +1     
  Misses       6548     6548           
Impacted Files Coverage Δ
include/mapnik/feature.hpp 100.00% <ø> (ø)
include/mapnik/feature_factory.hpp 100.00% <100.00%> (ø)
plugins/input/geobuf/geobuf.hpp 84.51% <100.00%> (ø)
plugins/input/geojson/geojson_datasource.cpp 97.11% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb2e45c...e7bb0ac. Read the comment docs.

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.

None yet

2 participants