creating template_postgis
http://geospatial.nomad-labs.com/2006/12/24/postgis-template-database/
sliver problems - part 1
This idiom can help filter out slivers based on size.
This query selects the features that intersect,
it also creates an intersection of those features,
and returns the resultset.
...
Code Block |
---|
select zd.zoning_sim as zone, st_area(st_intersection(cl.the_geom, zd.the_geom)) as area from v_citylots cl, planning.zoning_districts zd where cl.blklot = '3514003' and st_intersects(cl.the_geom, zd.the_geom) order by st_area(st_intersection(cl.the_geom, zd.the_geom)) desc |
sliver problems - part 2
If a simple area threshhold fails to allow sliver filtering
we might try a metric from ecology, the area to perimeter ratio.
Here is a query:
...
zone | area | length | a2p | p2a |
---|---|---|---|---|
C-3-G | 1756.165 | 172.792 | 10.163 | 0.098 |
NCT-3 3 | 0.618 | 66.608 | 0.009 | 107.696 |
The first row is a fairly normal city lot.
The second row is the sliver.
As you can see, the difference is an order of magnitude which is what we would want for a threshhold.
convert multi geometry to single geometry
These statements create a single geometry table from a multi geometry table.
The analogous arcmap operation is called explode (I think).
This is useful to help improve the rendering performance in WMS.
...