[postgis-users] [postgis-devel] CreateTopoGeom -- why can't create polygon topofrom edges
Paragon Corporation
lr at pcorp.us
Tue Sep 13 23:21:38 PDT 2011
Actually if I compensate for the fact the data is imperfect to begin with,
things look much better.
UPDATE boston.nei
SET topo =
topology.CreateTopoGeom('topo_boston'
,3,6
, foo.bedges)
FROM (SELECT n.gid, topology.TopoElementArray_Agg(DISTINCT
ARRAY[f.face_id,3]) As bedges
FROM boston.nei As n
INNER JOIN topo_boston.face As f ON n.geom && f.mbr
WHERE
ST_Covers(n.geom, topology.ST_GetFaceGeometry('topo_boston',
f.face_id))
OR
( ST_Intersects(n.geom, topology.ST_GetFaceGeometry('topo_boston',
f.face_id))
AND ST_Area(ST_Intersection(n.geom,
topology.ST_GetFaceGeometry('topo_boston', f.face_id) ) ) >
ST_Area(topology.ST_GetFaceGeometry('topo_boston',
f.face_id))*0.6)
GROUP BY n.gid) As foo
WHERE foo.gid = boston.nei.gid;
It still would be nice though to have choice to form from polygons from
edges instead of just faces.
Thanks,
Regina
_____
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of Paragon
Corporation
Sent: Wednesday, September 14, 2011 12:18 AM
To: 'PostGIS Development Discussion'
Cc: 'PostGIS Users Discussion'
Subject: [postgis-devel] CreateTopoGeom -- why can't create polygon topofrom
edges
strk and Andrea,
Perhaps this is just illegal by specs, but I'm wondering why I couldn't
logically create a multi/poly topogeometry from edges that form the boundary
of a polygon? or do the specs just not
allow that. I see the CreateTopoGeom just throws an error if I dear try to
create a polygon from edges.
I was trying to take my neighborhoods table and convert my geometries to
topo geoms. So I used this update statement. That's a lot of faces though.
I think it would be
much faster if I could have built from the edges of the boundaries.
UPDATE boston.nei
SET topo =
topology.CreateTopoGeom('topo_boston'
,3,6
, foo.bedges)
FROM (SELECT n.gid, topology.TopoElementArray_Agg(DISTINCT
ARRAY[f.face_id,3]) As bedges
FROM boston.nei As n
INNER JOIN topo_boston.face As f ON n.geom && f.mbr
WHERE ST_Covers(n.geom, topology.ST_GetFaceGeometry('topo_boston',
f.face_id))
GROUP BY n.gid) As foo
WHERE foo.gid = boston.nei.gid;
It's also not quite what I hoped for but that could be because I'm still
missing faces or tiger doesn't care about Boston neighborhoods which is
quite possible or who ever drew the maps idea of streets are not aligned
with those of tiger. See attached images -- my original geometry and the
topo column
generated from it.
Boston neighborhoods are kind of dumb since no one can agree on the
boundaries and people get into fist fights about it. I think the same case
in Philadelphia.
Thanks,
Regina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110914/d01fddfe/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: original_nei2.png
Type: image/png
Size: 70233 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110914/d01fddfe/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: topo_nei2.png
Type: image/png
Size: 70122 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110914/d01fddfe/attachment-0001.png>
More information about the postgis-users
mailing list