[gdal-dev] Merge the GeoJSON files

MRRAJESH rajeshreddy82 at gmail.com
Mon Mar 1 01:32:22 PST 2021


Hi,

I have two GeoJSON files. One is having features A and B, another one is
having Features B and C. In these two files Feature B is common ( same
attributes and same geometry).

Now I want to merge these two GeoJSON files into either a single GoeJSON
file or a GPKG file. But the Output file should not contain the duplicates.
This means It should contain only A, B, and C features.

I have tried to use -

ogr2ogr -f GPKG "C:\Test.gpkg" "C:\test.vrt"

VRT file is - 
<?xml version="1.0" encoding="utf-8"?>
<OGRVRTDataSource>
<OGRVRTUnionLayer name="unionLayer">
  <OGRVRTLayer name="File1">
    <SrcDataSource relativeToVRT="1">File1.json</SrcDataSource>    
  </OGRVRTLayer>
  <OGRVRTLayer name="File2">
    <SrcDataSource relativeToVRT="1">File2.json</SrcDataSource>    
  </OGRVRTLayer>  
</OGRVRTUnionLayer>
</OGRVRTDataSource>

I have gone through the below link -
https://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/ogrupdate.py

But How to use it here?

Regards,
Rajesh



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list