OGR/WKT

Steve Lime steve.lime at DNR.STATE.MN.US
Fri Aug 5 14:41:37 EDT 2005


I've added a few more comments as well talking about:

 - support for both reading AND writing
 - the addition of a "toString" method to shapeObj's in MapScript
 - leveraging both OGR and GEOS, with a public WKT API that wraps access to those
 - adding "-wkt" as a option to the [shpxy ...] tag in MapServer query templates

Can we call for a vote at this point?

(Also, where's the resting place for the RFC's. CVS or the website. If CVS, then how
can the website be automatically updated?)

Steve

>>> Frank Warmerdam <fwarmerdam at GMAIL.COM> 07/29/05 11:17 AM >>>
Steve,

I have attached the following notes at the bottom of ms-rfc-2.txt as
working notes on how the somewhat different geometry models of
the shapeObj and WKT (OGC Simple Features) could be handled.


WKT <-> shapeObj Mapping
~~~~~~~~~~~~~~~~~~~~~~~~

Random Notes
------------

 - WKT is geometry only.  The attributes, index, tileindex, classindex,
   and text fields do not exist in WKT and will have to be set "elsewhere". 

 - There is no widely supported, or standardized approach to "measure" 
   values in WKT though Refractions does support it in "EWKT".  For now it
   is assumed that measure values will not be preserved from WKT.

 - There is a well defined way of including Z coordinates and these should
   be carried through if MapServer is built with Z and M support enabled.


Transformations shapeObj to WKT
-------------------------------

 - MS_SHAPE_POINT: If numlines and numpoints are one, then this is converted
   to a POINT object in WKT.  If there are more points, this is converted
   to a MULTIPOINT object.

 - MS_SHAPE_LINE: if numlines is 1 then this will be translated to a LINESTRING
   otherwise it will be translated to a MULTILINESTRING.

 - MS_SHAPE_POLYGON: MapServer does not keep track of interior and exterior
   rings in a shape, since the scanline rasterization mechanism of GD 
   does not require this information.  However, when converting to WKT we
   need to know whether we have a single polygon with holes, or multiple
   polygons (more than one exterior ring).   If numlines is 1, we can directly
   translate to POLYGON(), otherwise the rings will need to be analysed to 
   identify outer rings, and to associate inner rings with their outher ring.
   If more than one outer ring exist, a MULTIPOLYGON will be produced, 
   otherwise a POLYGON will be produced.

 - MS_SHAPE_NULL: This results in an empty WKT string.  


Transformations WKT to shapeObj
-------------------------------

 - POINT: Translates to an MS_SHAPE_POINT object with one point and one line.

 - LINESTRING: Translates to an MS_SHAPE_LINE object with one line. 

 - POLYGON: Translates to an MS_SHAPE_POLYGON object with one line for the
   outer ring and one line for each inner ring.

 - MULTIPOINT: Translates to an MS_SHAPE_POINT object with one line, and one
   point for each line. 

 - MULTILINESTRING: Translates to an MS_SHAPE_LINE object with one line for
   each linestring in the container. 

 - MULTIPOLYGON: Translates into an MS_SHAPE_POLYGON with each ring of each
   polygon being a line in the resulting polygon object. 

 - GEOMETRYCOLLECTION: Treat as MULTIPOINT, MULTILINESTRING or MULTIPOLYGON if
   the contents are all compatible, otherwise throw an exception. 






-- 
---------------------------------------+--------------------------------------
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-dev mailing list