[Gdal-dev] SHP Files as Layers into a KML File

Philippe de Franclieu ph_de_fr at club-internet.fr
Fri May 11 08:18:07 EDT 2007


Hello,
 
Objective : put several SHP files as different layers - attribute data being
different - into a KML file.
Pb : I cannot -append -update the KML file : "Unable to open existing output
datasource 'out1.kml'".
 
shp2kml.bat file is as follows :
ogr2ogr -s_srs EPSG:27572 -t_srs EPSG:4326 -f "KML" out1.kml in_1.shp -dsco
NameField=LABEL -nln NewLayerName_1
ogr2ogr -update -append -s_srs EPSG:27572 -t_srs EPSG:4326 -f "KML" out1.kml
in_2.shp -dsco NameField=ID -nln NewLayerName_2
ogr2ogr -update -append -s_srs EPSG:27572 -t_srs EPSG:4326 -f "KML" out1.kml
in_3.shp -dsco NameField=ID -nln NewLayerName_3
 
What is wrong?
 
The other option, merge several SHP files into 'out.shp' then convert it to
'out2.kml', does not work either.
 
My shp2shp2kml.bat file is as follows :
ogr2ogr -s_srs EPSG:27572 -t_srs EPSG:27572 -f "ESRI Shapefile" out.shp
in_1.shp -nln NewLayerName_1
ogr2ogr -update -append -s_srs EPSG:27572 -t_srs EPSG:27572 -f "ESRI
Shapefile" out.shp in_2.shp -nln NewLayerName_2
ogr2ogr -update -append -s_srs EPSG:27572 -t_srs EPSG:27572 -f "ESRI
Shapefile" out.shp in_3.shp -nln NewLayerName_3
ogr2ogr -s_srs EPSG:27572 -t_srs EPSG:4326 -f "KML" out2.kml out.shp
 
ERROR 1: Failed to create file out.shp\NewLayerName_2.shp.
ERROR 4: Failed to open Shapefile 'out.shp\NewLayerName_2.shp'.
ERROR 1: Terminating translation prematurely after failed translation of
layer in_2
etc.
 
Also note that the -nln option does not replace the layer name from 'out' to
'NewLayerName_%' whith the - f "ESRI Shapefile" option while it does with
the -f "KML".
 
Thank you for your help
 
Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070511/ba2e3b21/attachment.html


More information about the Gdal-dev mailing list