[Qgis-developer] raster to postgresql/postgis GUI plugin

Daniel Vicente Lühr Sierra dluhr at ieee.org
Fri Jun 17 14:51:48 PDT 2016


Hi,

I was unable to find a way to upload raster data to a PostGis DB from QGIS.

I was aware of the raster2pgsql tool, but for the user-cases in my
projects, it is not an acceptable alternative (users do not have cli or
programming skills).

So, to temporally workaround this shortcoming, I decided to implement a
QGIS plugin to act as a GUI to the raster2pgsql program.

I have a working prototype available at
https://bitbucket.org/danielluehr/rastertopgsql/overview

Please, note that it is the result of just a couple of days' work, and
it is my first attempt at writing a QGIS plugin. It is just a
quick&dirty implementation that is far from being complete or foolproof.

My goal was to call the raster2pgsql program and pipe the output to the
DB directly, but I still don't know what is the best approach to send
data to an established connection (or maybe open one at that moment).
So, currently, the plugin just calls raster2pgsql on a file (with user
specified options from the plugin GUI) and saves the results to a SQL
file to be "manually" injected on the database (using some DB-manager
GUI, for instance).

I think a good alternative would be to incorporate it as a sub-plugin in
the dbmanager plugin.

I have briefly tested the plugin only against QGIS 2.8.9 and
PostGIS/raster2pgsql 2.1.4 which is my target environment.

Any comments, suggestions, contributions are welcome.

I used plugin-builder and I think it has the minimal requirements to be
uploaded to the plugin repository (at least, as an experimental plugin),
but I would prefer to have some feedback before uploading it there.

Regards

-- 
Daniel Vicente Lühr Sierra
IEEE Member
IEEE Student Branch Counselor - Universidad Austral de Chile



More information about the Qgis-developer mailing list