[postgis-devel] Wrong output in AsTopoJson example

Sandro Santilli strk at keybit.net
Thu Aug 22 06:10:15 PDT 2013


On Thu, Aug 22, 2013 at 02:19:13PM +0200, Tom van Tilburg wrote:
> Thank you all for bringing a new version. I'm happy to see all the
> improvements.
> 
> In the smallprint there was some feature I got very excited about
> called "topology.AsTopoJSON".
> But the manual gives a brief example which I feel is not correct.

You're talking about this, right ?
http://postgis.net/docs/manual-dev/AsTopoJSON.html

> Could it be that for topojson so called 'delta' values are needed in
> the coordinates instead of pure coordinates?

The AsTopoJSON function doesn't output the coordinates, but only the
arc indices. You'll see in the manual that the "arcs" part is generated
by the query itself. Indeed it sounds like a bug in the example usage.

Could you file a ticket please ?  http://trac.osgeo.org/postgis/

> Also the order of the arcs in multipolygon seems wrong (why negative
> values?) and komma's are missing after each new arc.

Negative values are to consider the edge in reverse order.

> IMO the example should be something like:
> 
> { "type": "Topology", "transform": { "scale": [1,1], "translate":
> [0,0] }, "objects": {
> "P3P4": { "type": "MultiPolygon", "arcs": [[[0]],[[1,2,3,4,5,6]]]}
> }, "arcs": [
> [[25,30],[6,0],[0,10],[-14,0],[0,-10],[14,0]],
> [[35,14],[0,-8]],
> [[35,6],[12,0]],
> [[47,6],[0,8]],
> [[47,14],[0,8]],
> [[47,22],[-12,0]],
> [[35,22],[0,-8]]
> ]}

--strk;




More information about the postgis-devel mailing list