Opened 6 years ago
Closed 6 years ago
#7112 closed defect (fixed)
Switch the default output format from Shapefile to GeoPackage
Reported by: | jachym | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | ESRI Shapefile, GeoPackage, GPKG |
Cc: |
Description
Hi. I'm attaching patch, which changes the default output vector format from ESRI Shapefile to OGC GeoPackage.
I've come trough most of the tools, but I expect, there are more. If you point me to missing code parts, I'll try to change them too.
Thank you for your help
Attachments (1)
Change History (5)
by , 6 years ago
Attachment: | shp2gpkg.diff added |
---|
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Hi Even,
whatever you think is the best.
I agree, having "guessing" mechanism of output file type would probably be the best option
P.S. Just asking: is there any reason, why GDAL interprets directory with shapefiles as data source with layers, but this does not apply on directory with geopackages?
comment:3 by , 6 years ago
About your question, initial reason is probably historical and I guess that it has been made so to help conversion to/from formats which support multiple layers. Unlike shapefiles geopackage can have however many layers so there is no such need. In addition I guess it could be complicated to handle the situation because either you need to open an own connection for each gpkg in the directory or to use one gpkg as a master and attach the other geopackages into that. I believe that it would get complicated to add new layers into such bunch-of-packages.
There's some intersection with https://trac.osgeo.org/gdal/wiki/rfc70_output_format_guess , which basically removes (or reduce it to a minimum proportion) any need for a default output format.
With your change, "ogr2ogr out.shp in.geojson" will generate a GeoPackage file called out.shp, which is unexpected, and violates a GeoPackage requirement that requires the .gpkg extension. And this would be quite a disruptive change for a lot of existing scripts.
With RFC70 (unimplemented yet), "ogr2ogr out.shp in.geojson" would generate a shapefile, and "ogr2ogr out.gpkg in.geojson" a GeoPackage. "ogr2ogr out in_with_several_layers.gml" would continue to create a 'out' directory with a shapefile per input layer in it.