[gdal-dev] ogr2ogr not creating feature ID

Cindy Hoskey choskey at agiledragonconsulting.com
Mon Jul 8 19:35:26 PDT 2019


Hi, I'm new to gdal so please forgive me if this is covered elsewhere.
I've looked and can't seem to find any answer, including looking in Github
to see if this is listed as an issue.

I'm creating a geojson sequence file (with a newline chracter) using
node.js on a Windows 10 machine.  When I run the folowing command I would
expect that there would be an ID at the end of each feature but there is
not.

ogr2ogr -f GeoJSONseq -lco ID_FIELD="ZCTA5CE10" -lco ID_TYPE=String -sql
"SELECT ZCTA5CE10 as zip, INTPTLAT10 as lat, INTPTLON10 as lon FROM
tl_2018_us_zcta510" tl_2018_us_zcta510geojsonseq.geojson
tl_2018_us_zcta510.shp


I've tried a few variants (without -lco ID_Type=String, without the
double-quotes around the name of the ID_FIELD column) and none seem to
work.  What I'm getting looks like this example:

{ "type": "Feature", "properties": { "zip": "43463", "lat": "+41.5086650",
"lon": "-083.5080344" }, "geometry": { "type": "Polygon", "coordinates": [
[ [ -83.509096, 41.508401 ], [ -83.508555, 41.508162 ], [ -83.508223,
41.508021 ], [ -83.507674, 41.50777 ], [ -83.507465, 41.507665 ], [
-83.507435, 41.507659 ], [ -83.50741, 41.507659 ], [ -83.507335, 41.507675
], [ -83.507296, 41.507702 ], [ -83.507263, 41.507733 ], [ -83.507244,
41.50776 ], [ -83.507232, 41.507795 ], [ -83.507247, 41.507878 ], [
-83.507412, 41.508499 ], [ -83.507534, 41.508952 ], [ -83.507569, 41.509078
], [ -83.507752, 41.50974 ], [ -83.507841, 41.510002 ], [ -83.508447,
41.509233 ], [ -83.509096, 41.508401 ] ] ] } }

What I was expecting would be something like the following:

{ "type": "Feature", "properties": { "zip": "43463", "lat": "+41.5086650",
"lon": "-083.5080344" }, "geometry": { "type": "Polygon", "coordinates": [
[ [ -83.509096, 41.508401 ], [ -83.508555, 41.508162 ], [ -83.508223,
41.508021 ], [ -83.507674, 41.50777 ], [ -83.507465, 41.507665 ], [
-83.507435, 41.507659 ], [ -83.50741, 41.507659 ], [ -83.507335, 41.507675
], [ -83.507296, 41.507702 ], [ -83.507263, 41.507733 ], [ -83.507244,
41.50776 ], [ -83.507232, 41.507795 ], [ -83.507247, 41.507878 ], [
-83.507412, 41.508499 ], [ -83.507534, 41.508952 ], [ -83.507569, 41.509078
], [ -83.507752, 41.50974 ], [ -83.507841, 41.510002 ], [ -83.508447,
41.509233 ], [ -83.509096, 41.508401 ] ] ] } ,"id":"43463"}

Is this a bug or is my syntax incorrect?

 - Cindy


[image: logo] <https://agiledragonconsulting.com/> Cindy Hoskey
President • Agile Dragon Consulting LLC
mobile: 631-333-1312
email: choskey at agiledragonconsulting.com
agiledragonconsulting.com
[image: banner] <https://agiledragonconsulting.com/>
The content of this email is confidential and intended for the recipient
specified in message only. It is strictly forbidden to share any part of
this message with any third party, without a written consent of the sender.
If you received this message by mistake, please reply to this message and
follow with its deletion, so that we can ensure such a mistake does not
occur in the future.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190708/788e18e3/attachment.html>


More information about the gdal-dev mailing list