source: trunk/doc/ZMSgeoms.txt

Last change on this file was 9324, checked in by pramsey, 12 years ago

Try again with line endings, this time using eol-style instead of eol-type (#1605)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mime-type set to text/plain
File size: 5.2 KB
Line 
1-------------------------------------------------------------------------
2
3TITLE: ZM values and SRID for Simple Features
4
5AUTHOR: Name: Sandro Santilli
6 Email: strk@refractions.net
7
8DATE: 27 December 2005
9
10CATEGORY: Simple Features Revision Proposal
11
12-------------------------------------------------------------------------
13
141. Background
15
16OpenGIS document 99-402r2 introduces semantic and well-known
17representations for Z-geometries. This proposal extend the well-known
18representations to optionally also hold a measure (M) and a SRID.
19Misures, as Z values, are attributes of 2D vertexes, but their
20semantic is unspecified in this document, as they could be used
21for any kind 'misurement'. SRID is an attribute of the whole feature.
22
23This document defines how geometry can have Z,M or both values and SRID
24in a way which is compatible to the existing 2D OpenGIS Simple Features
25specification AND to the Z-Geometry documented in OpenGIS 99-402r2.
26
272. Proposal
28
292.1. Definition of ZM-Geometry
30
31a) A geometry can have either 2, 3 or 4 dimensions.
32b) 3rd dimension of a 3d geometry can either represent Z or M (3DZ or 3DM).
33c) 4d geometries contain both Z and M (in this order).
34d) M and Z values are associated with every vertex.
35e) M and Z values are undefined within surface interiors.
36
37Any ZM-Geometry can be converted into a 2D geometry by discarding all its
38Z and M values. The resulting 2D geometry is the "shadow" of the ZM-Geometry.
392D geometries cannot be safely converted into ZM-Geometries, since their Z
40and M values are undefined, and not necessarily zero.
41
422.2. Extensions to Well-Known-Binary format
43
44The 2d OpenGIS Simple Features specification has the following geometry types:
45
46enum wkbGeometryType {
47 wkbPoint = 1,
48 wkbLineString = 2,
49 wkbPolygon = 3,
50 wkbMultiPoint = 4,
51 wkbMultiLineString = 5,
52 wkbMultiPolygon = 6,
53 wkbGeometryCollection = 7
54}
55
56Document 99-402r2 introduces a Z-presence flag (wkbZ) which OR'ed
57to the type specifies the presence of Z coordinate:
58
59 wkbZ = 0x80000000
60
61This proposal suggest the use of an M-presence flag (wkbM) to
62allow for XY, XYM, XYZ and XYZM geometries, and SRID-presence
63flag to allow for embedded SRID:
64
65 wkbM = 0x40000000
66 wkbSRID = 0x20000000
67
68Possible resulting geometry types are:
69
70enum wkbGeometryTypeZ {
71
72 wkbPoint = 1,
73 wkbLineString = 2,
74 wkbPolygon = 3,
75 wkbMultiPoint = 4,
76 wkbMultiLineString = 5,
77 wkbMultiPolygon = 6,
78 wkbGeometryCollection = 7,
79
80 // | 0x80000000
81 wkbPointZ = 0x80000001,
82 wkbLineStringZ = 0x80000002,
83 wkbPolygonZ = 0x80000003,
84 wkbMultiPointZ = 0x80000004,
85 wkbMultiLineStringZ = 0x80000005,
86 wkbMultiPolygonZ = 0x80000006,
87 wkbGeometryCollectionZ = 0x80000007,
88
89 // | 0x40000000
90 wkbPointM = 0x40000001,
91 wkbLineStringM = 0x40000002,
92 wkbPolygonM = 0x40000003,
93 wkbMultiPointM = 0x40000004,
94 wkbMultiLineStringM = 0x40000005,
95 wkbMultiPolygonM = 0x40000006,
96 wkbGeometryCollectionM = 0x40000007,
97
98 // | 0x40000000 | 0x80000000
99 wkbPointZM = 0xC0000001,
100 wkbLineStringZM = 0xC0000002,
101 wkbPolygonZM = 0xC0000003,
102 wkbMultiPointZM = 0xC0000004,
103 wkbMultiLineStringZM = 0xC0000005,
104 wkbMultiPolygonZM = 0xC0000006,
105 wkbGeometryCollectionZM = 0xC0000007,
106
107 // | 0x20000000
108 wkbPointS = 0x20000001,
109 wkbLineStringS = 0x20000002,
110 wkbPolygonS = 0x20000003,
111 wkbMultiPointS = 0x20000004,
112 wkbMultiLineStringS = 0x20000005,
113 wkbMultiPolygonS = 0x20000006,
114 wkbGeometryCollectionS = 0x20000007,
115
116 // | 0x20000000 | 0x80000000
117 wkbPointZS = 0xA0000001,
118 wkbLineStringZS = 0xA0000002,
119 wkbPolygonZS = 0xA0000003,
120 wkbMultiPointZS = 0xA0000004,
121 wkbMultiLineStringZS = 0xA0000005,
122 wkbMultiPolygonZS = 0xA0000006,
123 wkbGeometryCollectionZS = 0xA0000007,
124
125 // | 0x20000000 | 0x40000000
126 wkbPointMS = 0x60000001,
127 wkbLineStringMS = 0x60000002,
128 wkbPolygonMS = 0x60000003,
129 wkbMultiPointMS = 0x60000004,
130 wkbMultiLineStringMS = 0x60000005,
131 wkbMultiPolygonMS = 0x60000006,
132 wkbGeometryCollectionMS = 0x60000007,
133
134 // | 0x20000000 | 0x40000000 | 0x80000000
135 wkbPointZMS = 0xE0000001,
136 wkbLineStringZMS = 0xE0000002,
137 wkbPolygonZMS = 0xE0000003,
138 wkbMultiPointZMS = 0xE0000004,
139 wkbMultiLineStringZMS = 0xE0000005,
140 wkbMultiPolygonZMS = 0xE0000006,
141 wkbGeometryCollectionZMS = 0xE0000007,
142}
143
144
145If the SRID flag is set it's value is encoded as a 4byte integer
146right after the type integer.
147
148If only wkbZ or wkbM flags are set Point coordinates will
149be XYZ or XYM, if both wkbZ and wkbM flags are set Point
150coordinates will be XYZM (Z first).
151
152For example, a ZM-Point geometry at the location (10,20) with Z==30,
153M==40 and SRID=4326 would be:
154
155WKBPoint {
156
157 byte byteOrder; // wkbXDR or wkbNDR
158
159 uint32 wkbType; // (wkbPoint+wkbZ+wkbM+wkbSRID) =
160 // 0xE0000001
161
162 uint32 SRID; // 4326
163
164 Point {
165 Double x; // 10.0
166 Double y; // 20.0
167 Double z; // 30.0
168 Double m; // 40.0
169 }
170}
171
172
1732.3. Extensions to Well-Known-Text format
174
175Geometry SRID presence and value would be represented using a
176"SRID=#;" prefix to the WKT text:
177
178 "SRID=4326;POINT(1 2)"
179
1803DZ geometry will be represented as:
181
182 "POINT(1 2 3)"
183
1844D geometry will be represented as:
185
186 "POINT(1 2 3 4)"
187
1883DM geometry will be represented as:
189
190 "POINTM(1 2 3)"
191 or
192 "GEOMETRYCOLLECTIONM(POINTM(1 2 3), LINESTRINGM(1 2 3, 4 5 6))"
193
194Note that the coordinates structure of a geometry must be consistent,
195you can't mix dimensions in a single geometry.
196
Note: See TracBrowser for help on using the repository browser.