[gdal-dev] invalid data in spatial file

Even Rouault even.rouault at spatialys.com
Thu Jan 16 08:35:16 PST 2020


On jeudi 16 janvier 2020 11:59:30 CET Wuyyuru Ravi Teja Krishna wrote:
> Hello,
> 
> The geojson file before conversion and csv file after conversion are
> attached below.
> 
> 
> the ogr2ogr command line used is 
> 
> java -cp :gdal.jar -Djava.library.path=libs/ ogr2ogr "-f" "CSV" "-t_srs"
> "CRS:84" gdaltampered.csv gdaltampered.geojson "-lco" "GEOMETRY=AS_WKT"
> 

I don't reproduce the problem with recent versions of GDAL (2.4 and above)

Your original file is:

{
"type": "FeatureCollection",
"name": "ne_110m_geography_regions_points",
"features": [
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": 
"waterfall", "name": "Niagara Falls"}, "geometry": { "type": "Point", 
"coordinates": [ -643212.061818000385017, 5765.686896063275327 ] } },
{ "type": "Feature", "properties": { "scalerank": 2, "featurecla": 
"waterfall", "name": "Iguazu Falls"}, "geometry": { "type": "Point", 
"coordinates": [ -52344.582997199603767, -25433.568291925005923 ] } }
]
}

The output:

WKT,scalerank,featurecla,name
"POINT (-643212.061818 5765.68689606328)","2",waterfall,Niagara Falls
"POINT (-52344.5829971996 -25433.568291925)","2",waterfall,Iguazu Falls


Note: it is quite risky to have a GeoJSON file using obviously non-WGS84 
coordinates without specifying in it the CRS in which they are encoding. This 
can confuse a lot of tools using GeoJSON.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list