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: GEOGCS["GCS_North_American_1983", DATUM["North_American_Datum_1983", SPHEROID["GRS_1980",6378137,298.257222101]], PRIMEM["Greenwich",0], UNIT["Degree",0.017453292519943295]] LINEARID: String (22.0) FULLNAME: String (100.0) RTTYP: String (1.0) MTFCC: String (5.0) OGRFeature(tl_2012_45079_roads):6176 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?