[postgis-users] GeometryN

Lars Rößiger lars.roessiger at d33.net
Tue Oct 25 04:48:22 PDT 2005


BTW: NumGeometries() seems to always return 1, even if it's a
MULTIPOLYGON with (in this case) 4 Polygons.

--Lars

Lars Rößiger schrieb:
> Hi all!
> 
> I need to extract specific geometries from a result set. To original
> result set looks like this (I stripped the numbers for readability):
> 
> SELECT AsText(the_geom) FROM nbg_landuse WHERE gid = 69;
> 
> MULTIPOLYGON((
>    (
>     11.0961296 49.4972128,11.0958999 49.4966784,
>     11.095143 49.4960281,11.093623 49.4953756,
>     ..........
>    ),
>    (
>     11.0667155 49.4980046,11.0674851 49.4979275,
>     11.0703643 49.4976697,11.0705108 49.4977082,
>     ..........
>    )))
> (1 row)
> 
> So if I want to extract the first geometry I try this:
> 
> SELECT AsText(GeometryN(the_geom, 1))
> FROM (SELECT the_geom FROM nbg_landuse WHERE gid = 69) AS foo;
> 
> But this doesn't work the way it used to? It returns the exact same data
> as shown above except that it reads 'POLYGON' instead of 'MULTIPOLYGON'.
> 
> When I try to extract the third geometry...
> 
> SELECT AsText(GeometryN(the_geom, 3))
> FROM (SELECT the_geom FROM nbg_landuse WHERE gid = 69) AS foo;
> 
> ... it returns nothing :-(
> 
> What do I do wrong? Is this correct behaviour of GeometryN?
> 
> Thanks,
> Lars
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list