Hi, I need to merge 2 huge shapefiles (~3.4GB each). I was using QGIS explorer to merge 2 shapefiles but the application runs out of memory and getting error can't exceed 4 GB shapefile limit . I want the same way QGIS merges vectors but using commandline tool so that I can merge them on the cloud server. I tried merging 2 separate .osm files but there is some issue in osrm-extraction. What is the proper way to merge 2 shape files? asked 13 Feb '21, 09:36 Mukul2990 |
You cannot merge two 3.4 GB shape files. Shape files have a size limit of 2 GB, and some applications like GDAL will allow you to create up to 4 GB (using unsigned IDs internally) but will warn you that these files might not be readable with other software. More than 4 GB isn't possible with any software. Depending on what you want to do, you might want to switch to SQLite files which can be readily processed with GDAL (ogr2ogr command line tool). You can convert the first shape file to SQLite and then append the second shape file to that existing SQLite file. QGIS can load SQLite files. Note that this simply combines the file into one. If by "merge" you mean an actual merge operation on geometries, combining overlapping features into one, then that's a different ballgame that would require loading the data into PostGIS. answered 13 Feb '21, 11:31 Frederik Ramm ♦ I was appending both shapefiles data to the table using this command to insert shapefile to PostGIS DB. ogr2ogr -update -append -progress -f "ESRI Shapefile" PG:"dbname=postgres user=postgres port=5432 password=postgres" Shape1.shp -nln ShapeFilesData But there were some issues with this approach. OSRM cluster was not showing the routes correctly.
(14 Feb '21, 05:35)
Mukul2990
OSRM does not read shape files OR PostGIS database tables. If you want to do routing on PostGIS database tables, try PGRouting.
(14 Feb '21, 11:37)
Frederik Ramm ♦
No. What I mean to say is I was using the shapefile data loaded in QGIS and generate .osm files, then that osm will generate .pbf which is supplied to the osrm-extraction.
(14 Feb '21, 21:43)
Mukul2990
|