Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created October 27, 2011 23:47
Show Gist options
  • Save springmeyer/1321228 to your computer and use it in GitHub Desktop.
Save springmeyer/1321228 to your computer and use it in GitHub Desktop.
ogr file type detection in debug mode `export CPL_DEBUG=ON`
d:~ dane$ echo '{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} } ]}' > file.json
d:~ dane$ export CPL_DEBUG=ON
d:~ dane$ ogrinfo file.json
ERROR 4: GeoJSON Driver doesn't support update.
OGR: OGROpen(file.json/0x101d114b0) succeeded as GeoJSON.
Had to open data source read-only.
INFO: Open of `file.json'
using driver `GeoJSON' successful.
OGR: GetLayerCount() = 1
1: OGRGeoJSON (Point)
GDAL: In GDALDestroy - unloading GDAL shared library.
d:~ dane$ python -c "import mapnik2 as m;m.Datasource(type='ogr',file='file.json')"OGR: OGROpen(file.json) failed using driver 'ESRI Shapefile'
OGR: OGROpen(file.json) failed using driver 'MapInfo File'
OGR: OGROpen(file.json) failed using driver 'UK .NTF'
OGR: OGROpen(file.json) failed using driver 'SDTS'
OGR: OGROpen(file.json) failed using driver 'TIGER'
OGR: OGROpen(file.json) failed using driver 'S57'
OGR: OGROpen(file.json) failed using driver 'DGN'
OGR: OGROpen(file.json) failed using driver 'VRT'
OGR: OGROpen(file.json) failed using driver 'REC'
OGR: OGROpen(file.json) failed using driver 'Memory'
OGR: OGROpen(file.json) failed using driver 'BNA'
OGR: OGROpen(file.json) failed using driver 'CSV'
OGR: OGROpen(file.json) failed using driver 'GML'
OGR: OGROpen(file.json) failed using driver 'GPX'
OGR: OGROpen(file.json) failed using driver 'LIBKML'
OGR: OGROpen(file.json) failed using driver 'KML'
OGR: OGROpen(file.json/0x104001040) succeeded as GeoJSON.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Python/2.6/site-packages/mapnik2/__init__.py", line 332, in Datasource
return CreateDatasource(keywords)
RuntimeError: OGR Plugin: missing <layer> or <layer_by_index> or <layer_by_sql> parameter, available layers are: 'OGRGeoJSON'
GDAL: In GDALDestroy - unloading GDAL shared library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment