Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of import options in Export to PostgreSQL ogr2ogr #58392

Closed
NyakudyaA opened this issue Aug 14, 2024 · 0 comments · Fixed by #58440
Closed

Improve handling of import options in Export to PostgreSQL ogr2ogr #58392

NyakudyaA opened this issue Aug 14, 2024 · 0 comments · Fixed by #58440
Labels
Feature Request Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@NyakudyaA
Copy link
Contributor

NyakudyaA commented Aug 14, 2024

Feature description

Currently when importing a dataset into PostgreSQL using the ogr2ogr algorithm, if you set the following:
Screenshot 2024-08-14 at 15 12 15

By default, the other option for converting to multi is also set i.e
Screenshot 2024-08-14 at 15 13 25

This will lead to a command line being generated like

ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL "PG:dbname='gis' host=localhost port=5432 user='docker' password='docker' sslmode=allow active_schema=public" -lco DIM=2 /Applications/QGIS.app/Contents/Resources/resources/data/world_map.gpkg countries -overwrite -nlt POLYGON -lco GEOMETRY_NAME=geom -lco FID=id -nln public.countries -nlt PROMOTE_TO_MULTI

This leads to having

 -nlt POLYGON  -nlt PROMOTE_TO_MULTI

Additional context

You can always untick the Promote to MultiPart so your algorithm works properly. I think it would make sense to implement the following logic

Solution A

  • If the geometry type is unset then we default to have Promote to Multipart active by default

Solution B

  • If the geometry type option is selected then deactivate Promote to Multipart

Solution C

  • by default have the Promote to Multipart deactivated

Note There are other options like overwriting the existing table and appending to an existing table that should be mutually exclusive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants