Re: ogr2ogr not creating feature ID

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr not creating feature ID

Mike Flannigan

I don't know about node.js, but my home grown
geoj's look like this:

{ "type": "Feature", "properties": { "id": 2, "name": "Boxley AR to
Halltown MO2" }, "geometry": { "type": "LineString", "coordinates": [ [
-93.40203, 35.97839 ],  [ -93.4031, 35.97831 ],  [ -93.40372, 35.97807
],  [ -93.40444, 35.97744 ],  [ -93.40544, 35.97578 ],  [ -93.40589,
35.97552 ],  [ -93.40636, 35.97549 ],  [ -93.407, 35.97576 ],  [
-93.6255, 37.18735 ] ] } },

So I'm thinking the id needs to be first and
I guess node.js is doing it right.


Mike


On 7/9/2019 6:57 AM, [hidden email] wrote:

> 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


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev