gdal raster info: emit short form for CRS if possible#14286
gdal raster info: emit short form for CRS if possible#14286rouault wants to merge 1 commit intoOSGeo:masterfrom
Conversation
d9864c7 to
6d9415a
Compare
6d9415a to
cb4984c
Compare
|
Edited to include more details for the CRS part: |
and add a --crs-format=AUTO|WKT2|PROJJSON, only for --format=text
Demo:
```
$ gdal raster info byte.tif
Driver: GTiff/GeoTIFF
Files: byte.tif
Size is 20, 20
Coordinate Reference System name: NAD27 / UTM zone 11N
Coordinate Reference System ID: EPSG:26711
Coordinate Reference System type: Projected
Coordinate Reference System projection type: UTM zone 11N, Transverse Mercator
Coordinate Reference System units: metre
Coordinate Reference System area of use: North America..., west -120.00, south 26.93, east -114.00, north 78.13
Data axis to CRS axis mapping: 1,2
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 440720.000, 3751320.000) (117d38'28.21"W, 33d54' 8.47"N)
Lower Left ( 440720.000, 3750120.000) (117d38'27.92"W, 33d53'29.51"N)
Upper Right ( 441920.000, 3751320.000) (117d37'41.48"W, 33d54' 8.71"N)
Lower Right ( 441920.000, 3750120.000) (117d37'41.20"W, 33d53'29.75"N)
Center ( 441320.000, 3750720.000) (117d38' 4.70"W, 33d53'49.11"N)
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray
```
```
$ gdal raster info byte.tif --crs-format=WKT2
Driver: GTiff/GeoTIFF
Files: byte.tif
Size is 20, 20
Coordinate Reference System WKT:
PROJCRS["NAD27 / UTM zone 11N",
BASEGEOGCRS["NAD27",
DATUM["North American Datum 1927",
ELLIPSOID["Clarke 1866",6378206.4,294.978698213898,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4267]],
CONVERSION["UTM zone 11N",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",-117,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",0.9996,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",500000,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Engineering survey, topographic mapping."],
AREA["North America - between 120°W and 114°W - onshore. Canada - Alberta; British Columbia; Northwest Territories; Nunavut. Mexico. United States (USA) - California; Idaho; Nevada; Oregon; Washington."],
BBOX[26.93,-120,78.13,-114]],
ID["EPSG",26711]]
Data axis to CRS axis mapping: 1,2
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 440720.000, 3751320.000) (117d38'28.21"W, 33d54' 8.47"N)
Lower Left ( 440720.000, 3750120.000) (117d38'27.92"W, 33d53'29.51"N)
Upper Right ( 441920.000, 3751320.000) (117d37'41.48"W, 33d54' 8.71"N)
Lower Right ( 441920.000, 3750120.000) (117d37'41.20"W, 33d53'29.75"N)
Center ( 441320.000, 3750720.000) (117d38' 4.70"W, 33d53'49.11"N)
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray
```
cb4984c to
80c7b06
Compare
|
@rouault - I really like this summary, and I think it is more than sufficient for the majority of use cases. It also removes multiple mentions of EPSG codes which will remove a lot of confusion. I presume this only affects the new CLI output, so anyone relying on text output for |
no, in that case the full WKT is given, since in that situation there's a high chance the summary might not be enough to make sense of the CRS
Yes, only for new CLI output. I intend to do the same for "gdal vector info" Regular gdalinfo and ogrinfo unchanged.
yes |
done in #14303, with some adjustments for nicer output, also transposed to gdal raster info |
|
merged as part of #14303 |
and add a --crs-format=AUTO|WKT2|PROJJSON, only for --format=text
Triggered by remark in #14285 . @geographika @dbaston @jratike80 Good / bad idea ?
Demo:
[ ] AI (Copilot or something similar) supported my development of this PR. See our policy about AI tool use. Use of AI tools must be indicated.