Created
October 27, 2011 20:54
-
-
Save springmeyer/1320838 to your computer and use it in GitHub Desktop.
ogrinfo detecting geojson
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ogrinfo --version | |
GDAL 1.8.1, released 2011/07/09 | |
# create a normal json file with an ext | |
$ echo '{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} } ]}' > file.json | |
# this works as expected | |
$ ogrinfo file.json | |
ERROR 4: GeoJSON Driver doesn't support update. | |
Had to open data source read-only. | |
INFO: Open of `file.json' | |
using driver `GeoJSON' successful. | |
1: OGRGeoJSON (Point) | |
# create a json file with no extension | |
$ echo '{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} } ]}' > filejson | |
$ head -n 1 filejson | |
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} } ]} | |
# this does not work | |
# this http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/geojson/ogrgeojsonutils.cpp#L39 must not be being called for some reason so '{' is not detected | |
$ ogrinfo filejson | |
FAILURE: | |
Unable to open datasource `filejson' with the following drivers. | |
-> ESRI Shapefile | |
-> MapInfo File | |
-> UK .NTF | |
-> SDTS | |
-> TIGER | |
-> S57 | |
-> DGN | |
-> VRT | |
-> REC | |
-> Memory | |
-> BNA | |
-> CSV | |
-> NAS | |
-> GML | |
-> GPX | |
-> LIBKML | |
-> KML | |
-> GeoJSON | |
-> Interlis 1 | |
-> Interlis 2 | |
-> GMT | |
-> SQLite | |
-> DODS | |
-> ODBC | |
-> PGeo | |
-> MSSQLSpatial | |
-> OGDI | |
-> PostgreSQL | |
-> MySQL | |
-> PCIDSK | |
-> XPlane | |
-> AVCBin | |
-> AVCE00 | |
-> DXF | |
-> Geoconcept | |
-> GeoRSS | |
-> GPSTrackMaker | |
-> VFK | |
-> PGDump | |
-> GPSBabel | |
-> SUA | |
-> OpenAir | |
-> PDS | |
-> WFS | |
-> HTF | |
-> AeronavFAA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment