[gdal-dev] Filtering Null Coordinates and rounding coordinates Using ogr2ogr?

Brandon Biggs brandon.biggs at ski.org
Wed Oct 16 14:29:41 PDT 2019


Hello,

I have two questions with ogr2ogr:

How do I remove features that have a null geometry?

I tried:

-where "\"geometry\" != null"

But got the error:

ERROR 1: "geometry" not recognised as an available field.

ERROR 1: SetAttributeFilter("geometry" != null) on layer 'entities' failed.



Here is the output in geojson without this filter that I want to remove:

{ "type": "Feature", "properties": { "Layer": "Table et accessoire", "SubClasses": "AcDbEntity:AcDbBlockReference", "EntityHandle": "1972C" }, "geometry": null }

Note that during conversion, I get an error " Warning 1: Block Bloc truss 16X16X8 does not exist", so this may be that error, but I did have:

-skipfailures=true

Set, so I'm not sure why it would still be there if that is the error.



Second, my coordinates are in inches, and I would like them to be in meters. Is there some way where I can convert and maybe round the result to meters? I currently have:



{ "type": "Feature", "properties": { "Layer": "01_Grid-rigging", "SubClasses": "AcDbEntity:AcDbMText", "EntityHandle": "15F4", "Text": "1" }, "geometry": { "type": "Point", "coordinates": [ 4295.092091614642413, 4656.968211681276443, 0.0 ] } },



And would like:



{ "type": "Feature", "properties": { "Layer": "01_Grid-rigging", "SubClasses": "AcDbEntity:AcDbMText", "EntityHandle": "15F4", "Text": "1" }, "geometry": { "type": "Point", "coordinates": [ 109.1, 118.29, 0.0 ] } }



I'm wondering if -spat_srs or -a_srs would do this if I passed some kind of WKT definition?

I would like to divide coordinates by 39.37 and round to the 2nd decimal place.

Thank you,




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20191016/38b2bcbc/attachment.html>


More information about the gdal-dev mailing list