[postgis-users] Topology newbie question - put in a triangle, get out a quad, minus the Z values

John Morrison john.nmi.morrison at gmail.com
Mon Dec 3 11:39:06 PST 2012


Hi;

Sorry if this is a dumb newbie question.  I am trying to build a topology
trimesh (in what to me is the obvious way) from an unreasonably large SRTM
raster.  I can get the nodes and edges into the database, but the
Polygonize function doesn't create the expected triangles (two per raster
pixel), but instead creates a single square.

I tried to produce an SQL file which highlights the behavior (which, for
all I know, is fully expected).  Please find attached two such files.  I
did read the source to the Polygonize function, and when I call
st_polygonize on the edge_data column (as it does), I get back the expected
triangle with Z value...

Here's test01.sql (in case it doesn't survive the MTAs), in which I
simplified away use of 3D coords and SRID:

SELECT CreateTopology('ma_topo'); -- No Z
SELECT AddEdge('ma_topo', ST_GeomFromText('LINESTRING(2 2, 4 2)'));
SELECT AddEdge('ma_topo', ST_GeomFromText('LINESTRING(4 2, 3 1)'));
SELECT AddEdge('ma_topo', ST_GeomFromText('LINESTRING(3 1, 2 2)'));
SELECT Polygonize('ma_topo');
-- Correctly shows a single triangle in the Topology
SELECT St_AsText(foo.geom) FROM (SELECT (st_dump(st_polygonize(geom))).geom
FROM ma_topo.edge_data) as foo;
SELECT ST_AsText(mbr) FROM ma_topo.face;

Here's test00.sql, which exhibits the same quad/tri behavior, but
additionally is missing the Z value...

SELECT CreateTopology('ma_topo', 4326, 0, true); -- Has Z
SELECT AddEdge('ma_topo', ST_GeomFromText('SRID=4326;LINESTRINGZ(2 2 2, 4 2
2)'));
SELECT AddEdge('ma_topo', ST_GeomFromText('SRID=4326;LINESTRINGZ(4 2 2, 3 1
9)'));
SELECT AddEdge('ma_topo', ST_GeomFromText('SRID=4326;LINESTRINGZ(3 1 9, 2 2
2)'));
SELECT Polygonize('ma_topo');
-- Correctly shows a single triangle in the Topology
SELECT St_AsText(foo.geom) FROM (SELECT (st_dump(st_polygonize(geom))).geom
FROM ma_topo.edge_data) as foo;
SELECT ST_AsText(mbr) FROM ma_topo.face;


FYI I am using the latest PostGIS (from source control, rebuilt yesterday
in an attempt to ensure this was not simply a case of outdated software),
running under FC16 x86_64.  Again, sorry if this is a dumb question, but I
am new to SQL, PostGres, and PostGIS - yes, the trifecta.

Thanks for any help you can give me, including any advice as to approach...

-jm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121203/36ed7e00/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test00.sql
Type: application/octet-stream
Size: 538 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121203/36ed7e00/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test01.sql
Type: application/octet-stream
Size: 477 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121203/36ed7e00/attachment-0001.obj>


More information about the postgis-users mailing list