Solution for OGR Virtual polygon data
Mark Adams
markadams at CUESTASYS.COM
Wed Feb 22 12:24:23 PST 2006
Frank et al,
I've had great success with simple polygons, and with single polygons with
holes. Everything seems to follow expectations. However, the data I'm
working with sometimes has multiple polygons, but sometimes doesn't.
According to the OGC simple features spec 05-134, a MULTIPOLYGON statement
following the same format as a simple POLYGON statement should work. So, the
following 2 statements should be equivalent:
'POLYGON( ( 56 34, 62 48, 84 48, 84 42, 56 34) )'
or
'MULTIPOLYGON( ( 56 34, 62 48, 84 48, 84 42, 56 34) )'
In practice, using the latter format failed in mapserver - no geometries
shown. By adding a 3rd set of brackets the problem is solved:
'MULTIPOLYGON( (( 56 34, 62 48, 84 48, 84 42, 56 34)) )'
I am now ensuring that all text geometries are added in the database with
that extra set of brackets, so it is no longer a problem for me, but it
might cause others some pain - seems like a deviation from the spec.
(Or I might be reading it wrong).
Otherwise, publishing text-based polygon data is working out very well, so
thanks again for the support.
------------------------------
Mark Adams
Senior Analyst & Project Manager
Cuesta Systems (DPRA Canada)
5230 South Service Road
Burlington, ON L7L 5K2
Phone: 905-333-4544 x14
Fax: 905-333-0455
Email: mark.adams at dpra.com
-----Original Message-----
From: Frank Warmerdam [mailto:fwarmerdam at gmail.com] On Behalf Of Frank
Warmerdam
Sent: February 20, 2006 11:56 AM
To: Mark Adams
Cc: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Solution for OGR Virtual polygon data
Mark Adams wrote:
> Emil,
>
> Thanks, you are right, that works. I'd had the same response from Frank W.
> I'm not sure where the format for these strings is specified or documented
-
> the only information I was able to find said to do things differently.
>
> For the benefit of anyone else trying to use this functionality, I also
> discovered that you could create a multi-polygon as follows:
>
> POLYGON (( 501453.34 4800585.97, 501576.14 4800590.44, 501569.85 4800522,
> 501471.61 4800521.63, 501453.34 4800585.97 ))
Mark,
The format is OpenGIS Well Known Text geometry format from the Simple
Features for SQL Specification (99-049 I think). It is the same format
reported by ogrinfo, and the textual format of PostGIS or MySQL Spatial.
Technically the above is not a multi-polygon. A multi-polygon (in simple
features) is a collection of polygon objects. A polygon is one or more
rings, with one being the outer ring and the rest being inner rings. So
in the parliance I was used to in the old days, a polygon is an island
potentially with lakes cut out of it. A multipolygon is a much of such
islands.
Multipolygons use the MULTIPOLYGON keyword.
A 'polygon' object in a shapefile may be either a simple features POLYGON
or MULTIPOLYGON depending on whether there are multiple outer rings.
Best regards,
--
---------------------------------------+------------------------------------
--
I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the MapServer-users
mailing list