[postgis] Inserting MultiPolygons
Dave Blasby
dblasby at refractions.net
Mon Feb 25 09:37:45 PST 2002
> INSERT INTO
> GEOM_SITE_BOUNDARY (Boundary_id, External_Boundary,
> Site_Centroid)
> VALUES (3456000011,GeometryFromText('MULTIPOLYGON((414699.55
> 130160.43, 414701.83 130149.90,
> 414729.20 130155.70, 414729.20 130155.70, 414733.25 130149.80,
> 414735.10 130140.90, 414743.75 130142.70, 414740.60 130158.15,
> 414742.15 130158.50, 414739.65 130169.25, 414728.05 130166.65,
> 414727.77 130167.93, 414724.52 130167.19, 414717.65 130165.63,
> 414717.85 130164.45, 414699.55
> 130160.43))',128),GeometryFromText('POINT(414722.00 130160.00)',64));
Your MULTIPOLYGON(...) is still incorrect. Its defined as:
MULTIPOLYGON( (P1), (P2), (P3) )
Where the polygons P1,P2,P3 look like
(R1),(R2),(R3)
The rings (R1,R2,R3) are just a list of points.
So, the resulting multipolygon looks like:
MULTIPOLYGON(((0 0 0,4 0 0,4 4 0,0 4 0,0 0 0),(1 1 0,2 1 0,2 2 0,1 2 0,1
1 0)),((-1 -1 0,-1 -2 0,-2 -2 0,-2 -1 0,-1 -1 0)))
Which is made up of 2 polygons:
POLYGON((0 0 0,4 0 0,4 4 0,0 4 0,0 0 0),(1 1 0,2 1 0,2 2 0,1 2 0,1 1 0))
and
POLYGON((-1 -1 0,-1 -2 0,-2 -2 0,-2 -1 0,-1 -1 0))
See http://postgis.refractions.net/docs/c180.html#REFOBJECT
and http://www.opengis.org/techno/specs/99-049.pdf
In short, you're defining a POLYGON, not a MULTIPOLYGON. Add another
set of "()" around it - a "(" immediately after the MULTIPOLYGON, and a
")" at the very end.
Like this:
'MULTIPOLYGON(((414699.55
130160.43, 414701.83 130149.90,
414729.20 130155.70, 414729.20 130155.70, 414733.25 130149.80,
414735.10 130140.90, 414743.75 130142.70, 414740.60 130158.15,
414742.15 130158.50, 414739.65 130169.25, 414728.05 130166.65,
414727.77 130167.93, 414724.52 130167.19, 414717.65 130165.63,
414717.85 130164.45, 414699.55
130160.43)))'
dave
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Sponsored by VeriSign - The Value of Trust
Secure all your Web servers now - with a proven 5-part
strategy. The FREE Server Security Guide shows you how.
http://us.click.yahoo.com/uCuuSA/VdiDAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the postgis-users
mailing list