I like using SpatiaLite because, for me, it's easier to manage files on my computer instead of having tables inside a PostgreSQL database. However, there are sometimes I need PostGIS functions that I can't find equivalents on SpatiaLite (like the ST_Dump
function for example).
So, even though I know I can import my SpatiaLite database to a PostGIS database for using a specific function, I've started to wonder if there's any alternative way of doing that, perhaps a tool like ogr2ogr
that uses a PostGIS dialect in a SpatiaLite file (apparently not possible with ogr2ogr
as discussed on this GitHub thread)... Is it possible? Can I make PostGIS queries on SpatiaLite files? Without importing my SpatiaLite file to PostGIS?
Additional Information
I understand that I can run queries on PostgreSQL from the command line using psql
like the following:
psql postgresql://user:passwds@host:port/database -c "SELECT * FROM table"
On this GitHub thread, it's described a way of using the following command to do something similar to what I want:
ogr2ogr -f PostgreSQL PG: source && psql -c 'sql' && ogr2ogr dest PG: && psql -c 'SELECT * FROM table'
I think there's a solution mixing these two command lines (ogr2ogr
and psql
), but I didn't manage to make it work by trying to tweak them together so far.