This weekend I started using ogr2ogr and discovered that it's a great tool for converting from one spatial reference system to another. I used it to convert a shapefile to GeoJSON, from WGS84 to a NAD83 stateplane, and wanted decimals truncated, but I discovered that its "smart truncation" feature then truncated the trailing zeros on the resulting integers (e.g., 1100000 was written as 11). I searched the web for a while, but wasn't able to find a command-line argument that would avoid this issue.

Below is the full command I was running. My short-term solution was to set the precision to 1 and then use a regex on the resulting file to truncate decimals.

ogr2ogr -f "GeoJSON" CTABusStops.json -s_srs EPSG:4326 -t_srs EPSG:102671 -select
coordinate_precision=0 CTA_BusStops.shp

1 Answer 1


Perhaps the answer is to update GDAL. At least I cant't repeat the error with GDAL 1.11

Without coordinate_precision

ogr2ogr -f "GeoJSON"  geojsontest1.json -s_srs EPSG:4326 -t_srs EPSG:3857 -select ID  geojsontest.shp
{ "type": "Feature", "properties": { "id": 340 }, "geometry": { "type": "Point", "coordinates": [ 1669792.3618991044, -1689200.1396078952 ] } },

With coordinate_precision=0

ogr2ogr -f "GeoJSON"  geojsontest2.json -s_srs EPSG:4326 -t_srs EPSG:3857 -select ID -lco coordinate_precision=0 geojsontest.shp
{ "type": "Feature", "properties": { "id": 340 }, "geometry": { "type": "Point", "coordinates": [ 1669792, -1689200 ] } },

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.