Le mardi 03 février 2015 06:57:32, Manikanta Kondeti a écrit : > Hi, > > I am trying to figure out if there is way to combine all layers in kml into > a single Geojson object using ogr2ogr? > > One way I figured out is to iteratively traverse through all the layers and > create geojson for each layer. Now the issue it to have all json's into a > single json object?
Mani, you could use a VRT union layer to merge all layers into a single one. This is documented at http://gdal.org/drv_vrt.html In your case this would be creating a .vrt file like : <OGRVRTDataSource> <OGRVRTUnionLayer name="unionLayer"> <OGRVRTLayer name="source1"> <SrcDataSource>source.kml</SrcDataSource> <SrcLayer>name_of_first_kml_layer</SrcLayer> </OGRVRTLayer> <OGRVRTLayer name="source2"> <SrcDataSource>source.kml</SrcDataSource> <SrcLayer>name_of_second_kml_layer</SrcLayer> </OGRVRTLayer> </OGRVRTUnionLayer> </OGRVRTDataSource> and then use ogr2ogr to convert this .vrt into geojson. Even > > > Need some pointers. > > Thanks, > Mani -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
