Bug 5077: TopoJson to TopoJson- Conversion succeeded, output in QGIS- Empty, output mygeodata - Invalid data

also you can open input and output in nodepad++ and compare

Hi Alexander,

Please see:

Input
image.png (6.0 KB)

{“type”:“Topology”,“bbox”:[0.0,0.0,30.0,20.0],“arcs”:[[[20.0,20.0,10.0],[30.0,20.0,20.0]],[[0.0,0.0,0.0,2.0],[10.0,10.0,0.0,8.0]],[[20.0,20.0,10.0,50.0],[30.0,20.0,20.0,30.0]]],“objects”:{“unnamed”:{“type”:“GeometryCollection”,“geometries”:[{“properties”:{},“type”:“LineString”,“arcs”:[1]},{“properties”:{},“type”:“LineString”,“arcs”:[2]},{“properties”:{},“type”:“LineString”,“arcs”:[0]},{“properties”:{},“type”:“LineString”,“arcs”:[]}]}}}

Output:
image.png (3.7 KB)

In this screenshot you see two columns: id and name - name content not found in input why?
Please explains what you do in this sample when you
use new option ‘TrimTo2DGeometry’.

Thanks

On you video output file was got not from input.
Also i didn’t see how you make conversion.
Please check data one more time.

Yes ,you right.

I used fixed file as input.
Please see now:

Input:
{“type”:“Topology”,“bbox”:[0.0,0.0,30.0,20.0],“arcs”:[[[20.0,20.0,10.0],[30.0,20.0,20.0]],[[0.0,0.0,0.0,2.0],[10.0,10.0,0.0,8.0]],[[20.0,20.0,10.0,50.0],[30.0,20.0,20.0,30.0]]],“objects”:{“unnamed”:{“type”:“GeometryCollection”,“geometries”:[{“properties”:{},“type”:“LineString”,“arcs”:[1]},{“properties”:{},“type”:“LineString”,“arcs”:[2]},{“properties”:{},“type”:“LineString”,“arcs”:[0]},{“properties”:{},“type”:“LineString”,“arcs”:[]}]}}}

Output:
{“type”:“Topology”,“bbox”:[0.0,0.0,30.0,20.0],“arcs”:[[[0.0,0.0],[10.0,10.0]],[[20.0,20.0],[30.0,20.0]]],“objects”:{“unnamed”:{“type”:“GeometryCollection”,“geometries”:[{“properties”:{},“type”:“LineString”,“arcs”:[0]},{“properties”:{},“type”:“LineString”,“arcs”:[1]},{“properties”:{},“type”:“LineString”,“arcs”:[1]},{“properties”:{},“type”:“LineString”,“arcs”:[]}]}}}

Can you please explain the TrimTo2DGeometry feature in this sample ?

Test data(input/output/QGIS)
5077-TopoJson -TopoJson.zip (9.4 KB)

Thanks,

This option determines should we stay as it is 3D geometry or trim it to 2D geometry during writting new layer.

I used TrimTo2DGeometry .
Can you explains how you trim from 3D to 2D with this sample, please ?
Input:
{“type”:“Topology”,“bbox”:[0.0,0.0,30.0,20.0],“arcs”:[[[20.0,20.0,10.0],[30.0,20.0,20.0]],[[0.0,0.0,0.0,2.0],[10.0,10.0,0.0,8.0]],[[20.0,20.0,10.0,50.0],[30.0,20.0,20.0,30.0]]],“objects”:{“unnamed”:{“type”:“GeometryCollection”,“geometries”:[{“properties”:{},“type”:“LineString”,“arcs”:[1]},{“properties”:{},“type”:“LineString”,“arcs”:[2]},{“properties”:{},“type”:“LineString”,“arcs”:[0]},{“properties”:{},“type”:“LineString”,“arcs”:[]}]}}}

Output:
{“type”:“Topology”,“bbox”:[0.0,0.0,30.0,20.0],“arcs”:[[[0.0,0.0],[10.0,10.0]],[[20.0,20.0],[30.0,20.0]]],“objects”:{“unnamed”:{“type”:“GeometryCollection”,“geometries”:[{“properties”:{},“type”:“LineString”,“arcs”:[0]},{“properties”:{},“type”:“LineString”,“arcs”:[1]},{“properties”:{},“type”:“LineString”,“arcs”:[1]},{“properties”:{},“type”:“LineString”,“arcs”:[]}]}}}

First of all, please, explore TopoJson format!

It’s plain to see.
TrimTo2DGeometry option just ignore other coordinate except x and y from ‘arcs’.
Also as you can see on your sample, during conversion were reorder ‘arcs’.
Input have 3 ‘arcs’ but because of trim output have 2 ‘arcs’ (cos 2 arcs became the same)
So, your input and output above correct

By the way,
during conversion were reorder ‘arcs’.
Input have 3 ‘arcs’ but because of trim output have 2 ‘arcs’
Your reorder because of software limitations?
Why not in same order ?

I don’t know why, Just writing algorithm works this way. But for topoJson order of arcs doesn’t matter.

1 Like

If you change order of arcs then you need to change links also.
That was happend in you sample above

1 Like

Please close it-:slight_smile:

Thank you.
I close this topic.

1 Like