[gdal-dev] How to read CSV with GeoJSON correctly?

Ian Turton ijturton at gmail.com
Thu Sep 7 01:45:29 PDT 2017


As i said in my answer to the question the GeoJSON is invalid due to the
ring order, but I'm not sure if OGR checks for that.

Ian

On 7 September 2017 at 07:38, Rahkonen Jukka (MML) <
jukka.rahkonen at maanmittauslaitos.fi> wrote:

> Hi,
>
> I was thinking about this question on gis.stackexchange
> https://gis.stackexchange.com/questions/254536/how-to-
> convert-txt-containing-two-columns-id-and-geojson-geometry
>
> I copy-pasted the CSV example and edited it to use semicolon as field
> separator. Then I read http://www.gdal.org/drv_csv.html and had a try
> with ogrinfo
>
> ogrinfo geojson_csv.csv -al -oo GEOM_POSSIBLE_NAMES=geoJSON
> INFO: Open of `geojson_csv.csv'
>       using driver `CSV' successful.
>
> Layer name: geojson_csv
> Geometry: Unknown (any)
> Feature Count: 1
> Layer SRS WKT:
> (unknown)
> Geometry Column = geoJSON
> Id: String (0.0)
> geoJSON: String (0.0)
> OGRFeature(geojson_csv):1
>   Id (String) = 49518
>   geoJSON (String) = {type:Polygon,coordinates:[[[
> 29.9596,-2.3272],[29.9189,-2.7
> 9],[29.3706,-2.8401],[29.1497,-2.5917],[29.0405,-2.7447],[
> 28.8619,-2.5309],[29.1
> 1,-1.8602],[29.3616,-1.5092],[29.8237,-1.3089],[29.9149,-1.
> 4825],[30.0524,-1.431
> ,[30.8394,-1.6514],[30.8567,-2.3151],[30.1356,-2.4382],[29.
> 9596,-2.3272]]]}
>
> The GeoJSON geometry is not recognized but ogrinfo converts it into a
> string, with double quetes removed. Is there something wrong in the CSV or
> in my syntax?
>
> -Jukka Rahkonen-
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev




-- 
Ian Turton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170907/16159846/attachment.html>


More information about the gdal-dev mailing list