4

I've been reading a number of related threads about ST_Union, ST_SnapToGrid and ST_Dump but I haven't been able to solve my problem.

The problem is I am trying to merge Tiger/line census tracts that have been simplified but I get gaps where the tracts aren't flush. I simplified the tracts with ST_SimplifyPreserveTopology(geom, .0003) and I'm running ST_Union(ST_SnapToGrid(geom, .00001)) but I still get gaps. I've also tried using ST_SnapToGrid around of the initial simplification but I don't see a difference. I've also tried wrapping ST_Dump around the Union but I don't see a difference there either.

I thought ST_ExteriorRing was promising but my GROUP BY creates three concentric polygons (doughnuts) and ST_ExteriorRing seems to create three overlapping circles. Unless I'm doing something wrong.

I'm outputting my query as geojson and putting that on a leaflet map. Here is what those gaps look like at different zoom levels.

enter image description here enter image description here enter image description here

If anyone has any ideas on making a gapless polygon of census tracts under 80mb I'm all ears.

5

3 Answers 3

2

I found a much easier way to simplify a shapefile while preserving its topology by using the node.js command-line library mapshaper https://github.com/mbloch/mapshaper. You could also use topojson on the command line https://github.com/mbostock/topojson/wiki/Command-Line-Reference, but that will output only in topojson. Mapshaper outputs to a variety of formats.

0

I know this can be done in ArcMap through the Align features tool...

http://resources.arcgis.com/en/help/main/10.1/index.html#//01m800000004000000

Not sure about PostGIS though.

Some other Arc alternatives which might have analogous functions in PostGIS

http://resources.arcgis.com/en/help/main/10.1/index.html#//01m600000012000000

Failing that if you get really desperate and if the final map will look something like the first, or even second picture you posted you might just make each concentric ring one colour, as opposed to two (eg shade of purple for a boundary, and another for the inside).

0

Have you tried converting your polygons to polylines? Select the outer edge and convert that back to a polygon. Presto, no gaps or slivers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.