Opened 11 years ago

Closed 11 years ago

#2228 closed enhancement (fixed)


Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 2.1.0
Component: topology Version: master
Keywords: history 2.1.0 Cc: mbostock@…


Function to output TopoJSON from TopoGeometry.

Change History (8)

comment:1 by strk, 11 years ago

Example outputs:

{"type": "LineString", "arcs": [42, 43]}
{"type": "Polygon", "arcs": [[42, 43], [44]]}

The numbers in square brackets (array elements) are "arc identifiers", pretty much like our edge identifiers except they are (0-based) indices into an array, which we'll need to build somehow.

Also, backward arcs/edges are expressed with -(INDEX+1)

comment:3 by strk, 11 years ago

Keywords: history 2.1.0 added
Resolution: fixed
Status: newclosed

r11183 implements this

comment:4 by strk, 11 years ago

r11187 reduces the time it takes to output a polygonal TopoJSON to 6% of previous time, and fixes some bugs. Lineal geometries are still output in an expensive way.

comment:5 by strk, 11 years ago

Resolution: fixed
Status: closedreopened

Reopening because according to the specs a MultiPolygon must be represented as an array of Polygons. The current code is instead using a single array of _rings_ whereas ring orientation tells if a ring is an hole or a shell but nothing tells which hole belongs to which shell.

I've been thinking a way to figure out what's an hole and what's a shell: while walking a ring, the code can keep track of which faces are being bound; at the end of ring any still-not-visited edge having one of the visited faces on any side will surely be an hole belonging to the previous shell.

Holes within an embedded face will need to be tested, like this:

 TopoGeometry formed by (F1,F2)
 |    F1    |
 | +------+ |
 | |  F2  | |
 | | +--+ | |
 | | |F3| | |
 | | +--+ | |
 | +------+ |

comment:6 by strk, 11 years ago

Note that in order for the above test to work the code will need to be extended to also walk around the shell of F2, which is currently skipped.

comment:7 by strk, 11 years ago

r11193 fixes the grouping of polygon rings, including the test above. It's still fast :)

As part of the change all polygons are reported as MultiPolygon, for consistency (this is the same we do for TopoGeometry→Geometry.

Before closing this the same thing needs to be done for linear TopoGeometries.

comment:8 by strk, 11 years ago

Resolution: fixed
Status: reopenedclosed

r11196 fixes it for linear topogeometries.

Note: See TracTickets for help on using tickets.