<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><font face="Helvetica, Arial, sans-serif">Hi,</font><br>
    </p>
    <div class="moz-cite-prefix">El 21/06/16 a las 04:13, Luigi Pirelli
      escribió:<br>
    </div>
    <blockquote
cite="mid:CAFO80_pruoypedjUdsD63GRnfqYdsHeFH52iD-f_5d=G-ZCLAg@mail.gmail.com"
      type="cite">
      <pre wrap="">becase of you are running raster2postgres command via subprocess, do
you mind would be better to add it as Processing script/command?</pre>
    </blockquote>
    Maybe... I mean, for now, as it is a "standalone" plugin which does
    not connect to the database, it probably is a good idea.<br>
    But, if added as a processing sub-plugin, will it be able to find
    the db connection selected either in the "sources-browser" tree or
    in db-manager? That functionality will be needed when the
    raster2pgsql output is sent directly to the db connection.<br>
    <blockquote
cite="mid:CAFO80_pruoypedjUdsD63GRnfqYdsHeFH52iD-f_5d=G-ZCLAg@mail.gmail.com"
      type="cite">
      <pre wrap="">

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.</pre>
    </blockquote>
    Sure, I just grabbed the first option that appeared on the python
    manual. It would also be nice to show the progress, but apparently
    raster2pgsql doesn't output some kind of feedback which could be
    used in that way.<br>
    <br>
    Thanks<br>
    <blockquote
cite="mid:CAFO80_pruoypedjUdsD63GRnfqYdsHeFH52iD-f_5d=G-ZCLAg@mail.gmail.com"
      type="cite">
      <pre wrap="">

cheers
Luigi Pirelli

**************************************************************************************************
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: <a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/luigipirelli">https://www.linkedin.com/in/luigipirelli</a>
* Stackexchange: <a class="moz-txt-link-freetext" href="http://gis.stackexchange.com/users/19667/luigi-pirelli">http://gis.stackexchange.com/users/19667/luigi-pirelli</a>
* GitHub: <a class="moz-txt-link-freetext" href="https://github.com/luipir">https://github.com/luipir</a>
* Mastering QGIS:
<a class="moz-txt-link-freetext" href="https://www.packtpub.com/application-development/mastering-qgis">https://www.packtpub.com/application-development/mastering-qgis</a>
**************************************************************************************************


On 17 June 2016 at 23:51, Daniel Vicente Lühr Sierra <a class="moz-txt-link-rfc2396E" href="mailto:dluhr@ieee.org"><dluhr@ieee.org></a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">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
<a class="moz-txt-link-freetext" href="https://bitbucket.org/danielluehr/rastertopgsql/overview">https://bitbucket.org/danielluehr/rastertopgsql/overview</a>

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
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
      </blockquote>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel Vicente Lühr Sierra
IEEE Member
IEEE Student Branch Counselor - Universidad Austral de Chile

</pre>
  </body>
</html>