In answering OGR - Weird GeomType -2147483645 on polygon shapefile, posed by @Burton449, I came to realize I don't have a definitive grasp on what distinguishes 2D, 2.5D, and 3D geometries. I certainly realize Z/elevation values are integrated into the data, but I'm unclear if the 2.5D or 3D nature of the data is designated at both the file level (projection, headers, etc?) and the individual feature/geometry level, or just the latter.

It occurred to me that in order to express vertical units, for the GIS to be spatially-aware, the projection might/should specifically mention the vertical datum. However if I use OGRINFO to interrogate a tiger line roads layer (tl_2012_45079_roads.shp), which came down the pipe as a 3D-enabled layer, the layer's SRS is just good ol' NAD83 (EPSG:4269). While ogrinfo can tell the layer is 3D, I'm not seeing any evidence of this in the WKT geometry. Here's a snippet of output showing the summary details and a bit of the first feature geometry:

C:\>ogrinfo C:\xGIS\Tiger\tl_2012_45079_roads.shp -geom=yes -sql " SELECT * from
 tl_2012_45079_roads WHERE FULLNAME = 'US Hwy 1' " | more
INFO: Open of `C:\xGIS\Tiger\tl_2012_45079_roads.shp'
      using driver `ESRI Shapefile' successful.

Layer name: tl_2012_45079_roads
Geometry: 3D Line String
Feature Count: 3
Extent: (-81.341364, 33.753578) - (-80.603160, 34.268694)
Layer SRS WKT:
LINEARID: String (22.0)
FULLNAME: String (100.0)
RTTYP: String (1.0)
MTFCC: String (5.0)
  LINEARID (String) = 1102215607452
  FULLNAME (String) = US Hwy 1
  RTTYP (String) = U
  MTFCC (String) = S1200
  LINESTRING (-81.050945 33.995744,-81.050455 33.995919,-81.049132 33.996364,-81
.049051 33.996392,-81.048981 33.996415,-81.048852 33.996458,-81.04883 33.996466,
-- More  --

Specifically I'd like to know:

  • How are the Z-values/flags integrated in 2.5D and 3D geometries, and what is responsible for "announcing" this when a file is accessed? In other words, how might I know at a glance?
  • Are Z-values of 2.5D and 3D geometries expressed in WKT? I realize OGR can designate the 25D option, but I'm unclear on where the z-value is expressed. Does WKT for a 2.5D or 3D geometry include the z-value?
  • Finally, How might you convert down, from a 2.5D to a 2D geometry?

closed as too broad by PolyGeo Feb 17 '16 at 3:06

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • For the record, I have read this, but several things are still unclear, hence the question. – elrobis Apr 17 '13 at 17:47
  • This is still not clear to me also. Have you found something new on this topic? – Below the Radar Jul 30 '13 at 12:56
  • 1
    @Burton449, unfortunately I moved on to something else before getting further with this. However with respect to the second bullet, encountered a linestring layer a few days ago where the WKT looked like LINESTRING(x1 y1 0, x2 y2 0, ..., xn yn 0). I assumed the layer was initially created as either 25D or 3D, but it wasn't ever populated with z values, thus they were expressed as 0. ..this was the first time I'd seen the z value expressed in WKT. Unfortunately I can't recall the exact file I was reviewing, but I'm sure I was inspecting it using ogrinfo from GDAL 1.9+. – elrobis Sep 26 '13 at 14:50
  • As per the tour there should be only one question per question asked here. – PolyGeo Feb 17 '16 at 3:06