postgresqlgispostgisgeopackage

Is it is possible to convert query on postgresql database to geopackage file


I am working on postgresql database with postgis. I was generate csv file from the database which includes geo information but I need now to generate geopackage file instead. I searched on this but I did not found any tools making something like that directly. I know I can use gdal to convert from csv to geopackage file but I do not need to make that. I need to generate the geopackage file direct from the database. Can anyone help me in that?

Thanks


Solution

  • gdal support also generate geopackage file from the table/view direct using command like the following:

    ogr2ogr -f "GPKG" mynewfilename.gpkg \
    PG:"host=localhost user=postgres dbname=postgres password=mypassword" "mytablename"