1

It seems that support for streaming input is wishy-washy in ogr2ogr. For example, why can I do this:

curl "http://data.usgin.org/arizona/wfs?service=WFS&version=1.1.0&
request=GetFeature&typeName=azgs:activefaults&maxFeatures=10" | 
ogr2ogr -f "KML" /vsistdout/ /vsistdin/

... but I can't do this:

curl "http://data.usgin.org/arizona/wfs?service=WFS&version=1.1.0&
request=GetFeature&typeName=azgs:activefaults&maxFeatures=10&
outputformat=application/json" | ogr2ogr -f "KML" /vsistdout/ /vsistdin/

The first request uses the "WFS" driver for the source layer, and the second request uses the "GeoJSON" driver for the source layer. The first one works fine, but the second gives me:

ERROR 1: GeoJSON parsing error: unexpected end of data (at offset 6000)
ERROR 4: Failed to read GeoJSON data
FAILURE:
Unable to open datasource `/vsistdin/' with the following drivers.
  • Maybe the json is invalid. Can you just dump the result from curl out to a file and have a look. – Nathan W Jul 21 '13 at 23:00
1

May be something specific to that service but it is impossible to say because it cannot be connected any more. Generally speaking GDAL is able to read geojson at least from Geoserver.

>ogrinfo /vsicurl/"http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&req
uest=getfeature&typename=topp:states&outputformat=JSON" -al -ro |more
INFO: Open of `/vsicurl/http://demo.opengeo.org/geoserver/wfs?service=wfs&version=1.0.0&request=getf
eature&typename=topp:states&outputformat=JSON'
      using driver `GeoJSON' successful.

Layer name: OGRGeoJSON
Geometry: Multi Polygon
Feature Count: 49
Extent: (-124.731422, 24.955967) - (-66.969849, 49.371735)
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
STATE_NAME: String (0.0)
STATE_FIPS: String (0.0)
etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.