[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
Tue Dec 4 09:14:47 PST 2012
First, thanks for the quick reply, which works like a champ!
I apologize for the RTFM-able question in the first place. I was obviously
confused, as the "mbr" column (which I now understand to be the minimum
bounding rectangle) was the only geometry column for the topology faces. I
also assumed qgis (which I am using) was correct in showing the faces as
quads. Whoops.
So this brings me to my next question - is there some canonical,
best-practices sort of way I can get a geometry column (as I currently have
for for not only the topology nodes and faces, but for other GIS data in
the database) that qgis and I will treat correctly? Should I define some
sort of view on the faces table and use (for both qgis and my own stuff)
that layer instead?
Thanks again!
-jm
On Tue, Dec 4, 2012 at 5:12 AM, Sandro Santilli <strk at keybit.net> wrote:
> If I've understood correctly you're complaining that the faces do not
> get the Z value ? But you're querying the minimum bounding rectangle,
> not the face geometry.
>
> Try this:
>
> =# select st_astext(st_getfacegeometry('ma_topo', face_id))
> from ma_topo.face where face_id > 0;
> st_astext
> ---------------------------------------
> POLYGON Z ((2 2 2,4 2 2,3 1 9,2 2 2))
> (1 row)
>
> --strk;
>
> On Mon, Dec 03, 2012 at 02:39:06PM -0500, John Morrison wrote:
> > 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121204/fa004cbf/attachment.html>
More information about the postgis-users
mailing list