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

Consistent geojson output in kart diff and kart conflicts #135

Closed
olsen232 opened this issue Jun 23, 2020 · 1 comment · Fixed by #602
Closed

Consistent geojson output in kart diff and kart conflicts #135

olsen232 opened this issue Jun 23, 2020 · 1 comment · Fixed by #602

Comments

@olsen232
Copy link
Collaborator

olsen232 commented Jun 23, 2020

Background:
Geojson output must contain a flat featurecollection.
JSON output that is quite structured from sno diff and sno conflicts must be flattened for geojson output, and they take different approaches.

sno diff -o json organises features into the following JSON structure:
<dataset> / <feature|meta> / <pk> / <+|-> / <feature>

sno diff -o geojson can't do this, so it just puts the features into a flat array:
[<feature>, ...]
but each feature is given an ID which has the following structure:
<+/-><U|I|D>::<pk>
The dataset is not part of the ID. If multiple datasets have diffs, then a directory must be specified for output, and one file is output for each dataset with diffs.

sno conflicts -o json organises conflicts into the following JSON structure:
<dataset> / <feature|meta> / <pk> / <ancestor|ours|theirs> / <feature>

sno conflicts -o geojson can't do this, so it just puts the features into a flat array, but each feature is given an ID which exactly matches its path in the JSON output:
<dataset>:<feature|meta>:<pk>:<ancestor|ours|theirs>

Both sno diff and sno conflicts can limit the output to a single dataset if needed using a filter eg sno diff HEAD datasetA

To do:
The sno conflicts approach seems better in at least one respect: a feature's JSON path is the same as its geojson ID, which is the simplest / least surprising behaviour. sno diff -o geojson should probably be changed so that geojson IDs match with JSON paths.

The other way in which the two commands differ - returning a single array with data from all dataset, or multiple arrays, one per dataset, in separate files - I don't know which is better. I would hope that if the consumer can correctly extract primary key or old/new version from the ID, they could also extract the dataset from the ID, but perhaps the consumer (ie QGIS) cannot actually break the ID into its parts - in which case, geojson diffs loaded into QGIS will be hard enough to understand without having multiple datasets in the same diff, breaking them into several files could help the user considerably.
Perhaps we could support both behaviours - if the user supplies a file or stream as output, we generate a file, but if they supply a directory, we write one file per dataset to that directory. Either way, we should do this consistently for sno diff and sno conflicts.

@olsen232 olsen232 changed the title Consistent geojson output in sno diff and sno conflicts Consistent geojson output in kart diff and kart conflicts Jul 7, 2021
@olsen232
Copy link
Collaborator Author

olsen232 commented Apr 4, 2022

olsen232 added a commit that referenced this issue Apr 4, 2022
Also adds more detail to the CHANGELOG
olsen232 added a commit that referenced this issue Jun 2, 2022
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 a pull request may close this issue.

1 participant