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

Luigi Pirelli luipir at gmail.com
Tue Jun 21 01:13:31 PDT 2016


becase of you are running raster2postgres command via subprocess, do
you mind would be better to add it as Processing script/command?

remember that using an external command does not give you the help to
have credential stored in the QGIS Authnetication Manager...

another note, try to use subprocess.popen and not .call to avoid user
interface block for long operations.

cheers
Luigi Pirelli

**************************************************************************************************
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS:
https://www.packtpub.com/application-development/mastering-qgis
**************************************************************************************************


On 17 June 2016 at 23:51, Daniel Vicente Lühr Sierra <dluhr at ieee.org> wrote:
> 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
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list