[gdal-dev] OGR GeoJSON output

Jeremy Palmer palmerjnz at gmail.com
Sun Dec 17 14:08:55 PST 2017


Thanks Both.

On Mon, Dec 18, 2017 at 10:58 AM, Sean Gillies <sean at mapbox.com> wrote:

> Even,
>
> I found an example in the jq Cookbook of doing it with nothing other than
> jq.
>
>   https://github.com/stedolan/jq/wiki/Cookbook#convert-a-
> csv-file-with-headers-to-json
>
> The "sed for JSON" tagline is pretty accurate!
>

 jq is definitely very cool. My workflow is a little more complex, than
reading a CSV file as I'm converting from from a WFS endpoint and doing a
transformation with SQL. e.g:

ogr2ogr -f GeoJSON /vsistdout WFS:"
https://data.linz.govt.nz/services;key=$API_KEY/wfs/layer-51572" -dialect
sqlite -sql "SELECT id, lease_name AS name,
ST_Y(ST_Transform(ST_Centroid(geometry), 4326)) || ', ' ||
ST_X(ST_Transform(ST_Centroid(geometry), 4326)) AS latlon FROM
\"data.linz.govt.nz:layer-51572\"" | jq "[.features[].properties]"

Cheers
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171218/ea78b0df/attachment.html>


More information about the gdal-dev mailing list