How to convert kml to shape format throught ogr2ogr

You can create your kml file online with scribblemaps and download it to your computer.
If you create lines and markers in the same file, you will get this error:

ogr2ogr -f "ESRI Shapefile" file.shp file.kml -skipfailures
Warning 6: Normalized/laundered field name: 'description' to 'descriptio'
Warning 6: Field timestamp create as date field, though DateTime requested.
Warning 6: Field begin create as date field, though DateTime requested.
Warning 6: Field end create as date field, though DateTime requested.
Warning 6: Normalized/laundered field name: 'altitudeMode' to 'altitudeMo'
ERROR 1: Attempt to write non-point (LINESTRING) geometry to point shapefile.
ERROR 1: Attempt to write non-point (LINESTRING) geometry to point shapefile.
ERROR 1: Attempt to write non-point (LINESTRING) geometry to point shapefile.

To avoid it, you must create separated files for points, linestring or polygon as:

ogr2ogr point.shp point.kml -skipfailures -nlt point
ogr2ogr linestring.shp linestring.kml -skipfailures -nlt linestring
ogr2ogr polygon.shp polygon.kml -skipfailures -nlt polygon

Enjoy it!

Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

How to fix Android when developer options are not available for this user

Webcam streaming throught VLC with YUY2 compatibility