Skip to content

Instantly share code, notes, and snippets.

@faza
Last active August 29, 2015 14:17
Show Gist options
  • Save faza/c43d58be5b9599f0bea5 to your computer and use it in GitHub Desktop.
Save faza/c43d58be5b9599f0bea5 to your computer and use it in GitHub Desktop.
gdalinfo json format
{
"driver": "GTiff/GeoTIFF",
"files": [
"../gcore/data/byte.tif",
"../gcore/data/byte.tif.aux.xml"
],
"size": [
20,
20
],
"coordinateSystem": {
"proj": "+proj=.......",
"wkt": "PROJCS[....]"
},
"gcp": {
"proj": "PROJCS[...",
"gcpList": [
{
"id": "1",
"info": "a",
"pixel": 0.5,
"line": 0.5,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
]
},
"origin": [
440720.000000000000000,
3751320.000000000000000
],
"pixelSize": [
60.000000000000000,
-60.000000000000000
],
"metadata": {
"AREA_OR_POINT": "Area"
},
"imageStructureMetadata": {
"INTERLEAVE": "BAND"
},
"cornerCoordinates": {
"upperLeft": [
440720.000,
3751320.000
],
"lowerLeft": [
440720.000,
3750120.000
],
"upperRight": [
441920.000,
3751320.000
],
"lowerRight": [
441920.000,
3750120.000
],
"center": [
441320.000,
3750720.000
]
},
"bands": [
{
"band": 1,
"block": [
20,
20
],
"type": "Byte",
"colorInterp": "Gray",
"min": 74.000,
"max": 255.000,
"computedMin": 74.000,
"computedMax": 255.000,
"minimum": 74.000,
"maximum": 255.000,
"mean": 126.765,
"stdDev": 22.928,
"overviews": [
{
"size": [
400,
400 ],
"checksum": X (if -checksum specified)
},
{ "size": [
200,
200 ],
"checksum": X (if -checksum specified)
}
],
"metadata": {
"STATISTICS_MAXIMUM": "255",
"STATISTICS_MEAN": "126.765",
"STATISTICS_MINIMUM": "74",
"STATISTICS_STDDEV": "22.928470838676"
},
"histogram": {
"count": 25,
"min": -0.5,
"max": 255.5,
"buckets": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
"checksum": 4672,
"colorTable": {
"palette": "RGB",
"count": 6,
"entries": [
[255,255,255,255],
[255,255,208,255],
[255,255,204,255],
[153,204,255,255],
[0,153,255,255],
[102,102,102,255]
]
}
}
]
}
@rouault
Copy link

rouault commented Mar 25, 2015

I'd encourage you to remove the spaces from the key strings (CoordinateSystem, CornerCoordinates, ... would be better). Actually in JSON, keys are generally with camelCase convention, so coordinateSystem, cornerCoordinates, etc...
For coordinateSystem, you could have a dictionary like

"coordinateSystem": {
"proj": "+proj=.......",
"wkt": "PROJCS[....]"

Yes the full WKT string is a string that cannot easily been represented more naturally as a JSon objet. In your example, I think you might have quoting issues by the way due to the presence of " inside WKT itself.

Metadata should be represented as JSON dictionary.
"metadata" : {
"KEY1": "value1",
"KEY2":"value2
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment