You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
olsen232
changed the title
Consistent geojson output in sno diff and sno conflicts
Consistent geojson output in kart diff and kart conflictsJul 7, 2021
Background:
Geojson output must contain a flat featurecollection.
JSON output that is quite structured from
sno diff
andsno 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
andsno conflicts
can limit the output to a single dataset if needed using a filter egsno 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
andsno conflicts
.The text was updated successfully, but these errors were encountered: