For you, what is the difference between geographic coordinates and projected coordinates ?
From ESRI GeoNet: Projected Coordinate System vs. Geographic Coordinate System:
- A Geographic Coordinate Systems is defined by a 3-D surface and is measured in latitude and longitude.
- A Projected Coordinate systems refers to data that is defined by a flat 2-D surface and can be measured in units of meters and feet.
- When displaying data that's using a geographic coordinate system, ArcMap uses a 'pseudo-Plate Carree' projection. Basically, it just treat the coordinate values as if they're linear and just display the data.
Therefore if your coordinates are lat & lon variables, you use a Geographic Coordinate System (sensu ESRI)
1) With osgeo.ogr and a shapefile with WGS84 projection (Geographic Coordinate System), the crs is found by:
from osgeo import ogr
infile = ogr.Open("aWGS84.shp")
layer = infile.GetLayer()
# crs
spatialRef = layer.GetSpatialRef()
spatialRef.ExportToWkt()
'GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]'
You can also use spatialRef.ExportToPrettyWkt()
,spatialRef.ExportToProj4()
,spatialRef.ExportToUSGS()
and many other formats.
First feature of the shapefile
feature = layer.GetFeature(0)
feature.ExportToJson()
'{"geometry": {"type": "Polygon", "coordinates": [[[5.826429692987699, 50.63093772365397], [5.830982302422351, 50.62928355089628], [5.826407932565759, 50.6268451632606], [5.82334832264974, 50.62941225500874], [5.826429692987699, 50.63093772365397]]]}, "type": "Feature", "properties": {"id": null}, "id": 0}'
And the point coordinates of the Polygon (WGS84 in degrees)
import json
json.loads(feature.ExportToJson())['geometry']['coordinates']
[[[5.826429692987699, 50.63093772365397], [5.830982302422351, 50.62928355089628], [5.826407932565759, 50.6268451632606], [5.82334832264974, 50.62941225500874], [5.826429692987699, 50.63093772365397]]]
2) With the same shapefile in a projected coordinate system (in meters)
infile = ogr.Open("aproj.shp")
layer = infile.GetLayer()
feature = layer.GetFeature(0)
json.loads(feature.ExportToJson())['geometry']['coordinates']
[[[253122.92278611325, 147711.88454888575], [253448.57840302447, 147534.25421241205], [253130.3240500753, 147256.7068115687], [252908.28612947493, 147537.9548443528], [253122.92278611325, 147711.88454888575]]]
3) For the conversion between the two geometries, I need to reproject the shapefile (degrees to meters) with osgeo.osr
or Pyproj (there are many examples in GIS SE).
4) Instead of using osgeo.ogr why don't use the more "Pythonic" Fiona (another Python wrapper of the OGR library)
import fiona
file = fiona.open("aWGS84.shp")
spatialRef = file.crs
spatialRef
{'init': u'epsg:4326'}
Fiona use Python dictionaries for all (GeoJson format), therefore the first feature is obtained by
file.next()
{'geometry': {'type': 'Polygon', 'coordinates': [[(5.826429692987699, 50.63093772365397), (5.830982302422351, 50.62928355089628), (5.826407932565759, 50.6268451632606), (5.82334832264974, 50.62941225500874), (5.826429692987699, 50.63093772365397)]]}, 'type': 'Feature', 'id': '0', 'properties': OrderedDict([(u'id', None)])}
Best Answer
It depends on what version of the LAS specification you are using. If it is 1.3 or less, then the specs define georeferencing information using pre-defined (see specs) variable length records (VLRs) using the same format as the GeoTIFF:
This format, though somewhat challenging to grok at times, is remarkably flexible. It relies on three defined tags called the GeoKeyDirectoryTag tag, which is like a table of contents for georef data, the GeoDoubleParamsTag tag, which is like a store of all double-precision values referred to in the GeoKeyDirectoryTag, and the GeoAsciiParamsTag tag, which similarly is used to store all ASCII (text) values. This site provides a good explanation and an example.
As of LAS v. 1.4 however, this method of storing georeferencing information was changed to favour the well-known text (WKT) format, also stored in defined VLRs, although the GeoTIFF format is still used for legacy:
I see no reason given these flexible formats why you couldn't store point info in geographic coordinates (lat/long) but this would be fairly unusual for LAS data in that I've never seen it done previously. I imagine the reason is that LiDAR datasets tend to be of rather large scale (small spatial extent) and projected coordinate systems are therefore preferred. It makes calculating the distances between points, which is important for some algorithms (e.g. point classification or filtering), much easier.