[gdal-dev] Can we combine all layers of kml into single GeoJSON

Jukka Rahkonen jukka.rahkonen at maanmittauslaitos.fi
Thu Feb 5 03:19:19 PST 2015


Even Rouault <even.rouault <at> spatialys.com> writes:



> 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.

Hi,

Just thinking, but wouldn't it be nice to have "ogrbuildvrt" tool that would
take list of OGR supported layers and outputs a simple vrt with one  union
layer like the one in your example?

-Jukka Rahkonen-



More information about the gdal-dev mailing list