I'm trying to convert this KML dataset of ice arenas to a shapefile using ogr2ogr (GDAL 1.8). After some initial troubleshooting to get the script running, it's creating 184 different shapefiles (736 unique files including required siblings)!
My ogr2ogr script is essentially this, with some extra flags. The -append and -skipfailures flags are necessary (not sure if precision or geometry are doing anything, but I'm pretty sure they don't hurt). I'd prefer not to use -skipfailures, as clearly it means losing data, but without it the script won't finish:
ogr2ogr -f "ESRI Shapefile" "E:\4_GIS\HockeyArenas\shp\ice_rinks.shp" "E:\4_GIS\HockeyArenas\doc.kml" -lco PRECISION=false -nlt "geometry" -append -skipfailures
Ultimately I want to move this data into PostgreSQL/PostGIS, but if it's making 184 shapefiles, I don't want to litter my PostGIS db with 184 tables..
Anyone know how to get one shapefile, preferably without using -skipfailures?
Thanks, community.
-lco OVERWRITE=YESis doing some damage, as there are multiple division names .. thus only the last-most division remains. KML files can have a complicated hierarchy that client programs have difficulty streamlining into a simple model. – Mike T Feb 23 '12 at 21:56-lco OVERWRITE=YESdue to non-unique layer names. One option is to control the conversion via python andfrom osgeo import ogr– Mike T Feb 23 '12 at 22:32-loc OVERWRITE=YESmay essentially swap-in for my-skipfailures? I wonder if you're losing data from overwrite while I'm losing it from, well, not writing? I was curious if someone would suggest the push-into-throwaway-db-merge-then-drop route. I'm not against it, necessarily. :) – elrobis Feb 24 '12 at 01:56OVERWRITE=YESis more specific than-skipfailures, but it is overwriting non-unique layers. You can get a better idea of this by looking at the layer names withogrinfo doc.kml | cut -d ":" -f 2 | sort(from an OSGeo4w shell). E.g., there are 6 "Central Division", but only one of those will be imported. – Mike T Feb 24 '12 at 03:31