MapWinGIS:Shape Serialize Format

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

The Shape object may be saved and loaded to and from a string in a particular format. The format is constructed by appending the following items:

Shape Identifier -- Part Point Indexes -- Points

The shape identifier is followed by a semicolon. Each point index is also followed by a semicolon. Point values will each be followed by a pipe character, |. Points will come in pairs of two, three or four values, according to the following conditions:

 If the shape is a 2D shape (Point, Polyline, or Polygon), then there will be  
 two point values: X (followed by a pipe character) and Y (followed by a pipe character).

If the shape is a 3D shape (MultiPointZ, PolygonZ, or PolylineZ), then there will be three point values: X (followed by a pipe character), Y (followed by a pipe character) and Z (followed by a pipe character).

If the shape is a MultiPointM, PolygonM, or PolylineM shape, there will be four point values: X (followed by a pipe character), Y (followed by a pipe character), Z (followed by a pipe character) and M (followed by a pipe character).

The record will always end with a terminating pipe character.

An example polyline shape:

 3;0;-112.322|41.322|-113.56|40.735|

In this case, the initial 3 represents a polyline shapefile type. The zero represents a part which begins at shape index zero. Two points are specified: (-112.322, 41.322) and (-113.56, 40.735).

An example PolylineM shape:

 23;0;-112.322|41.322|10|233|-113.56|40.735|15|234|

In this case, the initial 23 represents a polyline shapefile type. The zero represents a part which begins at shape index zero. Two points are specified: (-112.322, 41.322, 10) at M value 233, and (-113.56, 40.735, 15) at M value 234.

The following are the values which represent shape types:

 0 = (Uninitialized)
 1 = SHP_POINT
 3 = SHP_POLYLINE
 5 = SHP_POLYGON
 8 = SHP_MULTIPOINT
 11 = SHP_POINTZ
 13 = SHP_POLYLINEZ
 15 = SHP_POLYGONZ
 18 = SHP_MULTIPOINTZ
 21 = SHP_POINTM
 23 = SHP_POLYLINEM
 25 = SHP_POLYGONM
 28 = SHP_MULTIPOINTM
 31 = SHP_MULTIPATCH

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:Shape_Serialize_Format"

This page has been accessed 2,024 times. This page was last modified on 24 June 2009, at 19:40.