VSI file API support in ogr2ogr

It seems that streaming input support is weak 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 cannot 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 one 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. 
+4
source share
1 answer

What version of GDAL are you using? This seems fixed as gdal-2.2.0 , as this command works, it seems to work:

 $ ogr2ogr --version GDAL 2.2.0, released 2017/04/28 $ 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/ 
0
source

Source: https://habr.com/ru/post/1492529/


All Articles