<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><tt>Olá,</tt></p>
    <p><tt>Parece-me que a solução mais adequada é carregar a área na
        base de dados e depois fazer uma query que só carrega no QGIS os
        dados dentro da shapefile.</tt></p>
    <p><tt>Se uma tabela se chamar 'estudo' e a outra 'areadeestudo', a
        query seria:</tt></p>
    <pre><span class="k">select</span> estudo.* 
<span class="k">from</span> estudo<span class="p">,</span> areaestudo
<span class="k">where</span><span class="k"></span> <span class="n">st_contains</span><span class="p">(</span>areaestudo<span class="p">.</span><span class="n">geom</span><span class="p">,</span> estudo<span class="p"></span><span class="p">.</span><span class="n">geom</span><span class="p">)</span>
<span class="s1"></span>
Pode-se acrescentar mais condições no where para restringir os dados a carregar no QGIS.

Bom trabalho

Jorge Gustavo
</pre>
    <div class="moz-cite-prefix">Às 16:58 de 04/04/19, Luis Bentes
      escreveu:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+bg8VBz6_0Rm-wPWvfhJaaYhqVGT=d8VarmXcEBkA6wwpLeuw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>A questão principal que tenho, para além da que eu coloquei
          inicialmente, é que a tabela da qual eu quero selecionar dados
          de uma área reduzida (a minha área de estudo) tem muitos
          milhões de dados e por isso nunca a consigo carregar em nenhum
          computador a que tenho acesso. Por isso pensei em fazer a
          selecção dos dados antes de os importar para o QGIS, usando
          para isso o SQL. Tudo seria mais simples se a área tivesse um
          formato regular mas como é um poligono de formato estranho não
          ajuda nada, daí querer utilizar a informação da geometria da
          shape da área de estudo para selecionar os dados da outra
          tabela.</div>
        <div><br>
        </div>
        <div>De qualquer modo vou continuar a tentar.</div>
        <div><br>
        </div>
        <div>Obrigado</div>
        <div>Cumprimentos</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div class="gmail_attr" dir="ltr">On Thu, Apr 4, 2019 at 4:30 PM
          Alexandre Neto <<a href="mailto:senhor.neto@gmail.com"
            moz-do-not-send="true">senhor.neto@gmail.com</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
          <div dir="auto">Como está a fazer esse import. Eu acho que com
            ogr2org talvez dê.
            <div dir="auto"><br>
            </div>
            <div dir="auto">Caso contrário pelo qgis pode usar a shape
              para seleccionar os elementos que quer importar, e depois
              no db manager usar a opção selected only. </div>
          </div>
          <br>
          <div class="gmail_quote">
            <div class="gmail_attr" dir="ltr">A qui, 4/04/2019, 15:47,
              Luis Bentes <<a href="mailto:lmbentes@gmail.com"
                target="_blank" rel="noreferrer noreferrer noreferrer"
                moz-do-not-send="true">lmbentes@gmail.com</a>>
              escreveu:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
              <div dir="ltr">
                <div>Obrigado Nelson, no entanto, o que quero mesmo é
                  que durante o carregamento dos dados PostGIS eles
                  sejam selecionados usando uma shape (a integrar no
                  SQL), ainda antes de os carregar.</div>
                <div><br>
                </div>
                <div>Luis</div>
              </div>
              <br>
              <div class="gmail_quote">
                <div class="gmail_attr" dir="ltr">On Thu, Apr 4, 2019 at
                  3:36 PM Nelson Silva <<a
                    href="mailto:nelson.jgs@gmail.com" target="_blank"
                    rel="noreferrer noreferrer noreferrer noreferrer"
                    moz-do-not-send="true">nelson.jgs@gmail.com</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">Luís,<br>
                  <br>
                  Sem ter experimentado.<br>
                  Carregue dados PostGIS e experimente no DB Manager
                  usar como Virtual Layers.<br>
                  <br>
                  Nelson<br>
                  <br>
                  Enviado do meu iPhone<br>
                  <br>
                  No dia 04/04/2019, às 14:58, Luis Bentes <<a
                    href="mailto:lmbentes@gmail.com" target="_blank"
                    rel="noreferrer noreferrer noreferrer noreferrer"
                    moz-do-not-send="true">lmbentes@gmail.com</a>>
                  escreveu:<br>
                  <br>
                  > Boa tarde a todos,<br>
                  > <br>
                  > Pergunto se é possível fazer um query SQL a uma
                  base postgis usando um shapefile como limite
                  geográfico para a selecção de dados e se sim como devo
                  fazé-lo?<br>
                  > <br>
                  > Muito obrigado.<br>
                  > Cumprimentos,<br>
                  > Luis Bentes<br>
                  > _______________________________________________<br>
                  > QGIS-pt mailing list<br>
                  > <a href="mailto:QGIS-pt@lists.osgeo.org"
                    target="_blank" rel="noreferrer noreferrer
                    noreferrer noreferrer" moz-do-not-send="true">QGIS-pt@lists.osgeo.org</a><br>
                  > <a
                    href="https://lists.osgeo.org/mailman/listinfo/qgis-pt"
                    target="_blank" rel="noreferrer noreferrer
                    noreferrer noreferrer noreferrer"
                    moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-pt</a><br>
                  _______________________________________________<br>
                  QGIS-pt mailing list<br>
                  <a href="mailto:QGIS-pt@lists.osgeo.org"
                    target="_blank" rel="noreferrer noreferrer
                    noreferrer noreferrer" moz-do-not-send="true">QGIS-pt@lists.osgeo.org</a><br>
                  <a
                    href="https://lists.osgeo.org/mailman/listinfo/qgis-pt"
                    target="_blank" rel="noreferrer noreferrer
                    noreferrer noreferrer noreferrer"
                    moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-pt</a><br>
                </blockquote>
              </div>
              _______________________________________________<br>
              QGIS-pt mailing list<br>
              <a href="mailto:QGIS-pt@lists.osgeo.org" target="_blank"
                rel="noreferrer noreferrer noreferrer noreferrer"
                moz-do-not-send="true">QGIS-pt@lists.osgeo.org</a><br>
              <a href="https://lists.osgeo.org/mailman/listinfo/qgis-pt"
                target="_blank" rel="noreferrer noreferrer noreferrer
                noreferrer noreferrer" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-pt</a><br>
            </blockquote>
          </div>
          _______________________________________________<br>
          QGIS-pt mailing list<br>
          <a href="mailto:QGIS-pt@lists.osgeo.org" target="_blank"
            moz-do-not-send="true">QGIS-pt@lists.osgeo.org</a><br>
          <a href="https://lists.osgeo.org/mailman/listinfo/qgis-pt"
            target="_blank" rel="noreferrer" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-pt</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-pt mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-pt@lists.osgeo.org">QGIS-pt@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-pt">https://lists.osgeo.org/mailman/listinfo/qgis-pt</a>
</pre>
    </blockquote>
    <div class="moz-signature">-- <br>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div class="moz-signature">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <div class="moz-signature">
          <meta http-equiv="content-type" content="text/html;
            charset=UTF-8">
          <div class="moz-signature">
            <div class="moz-signature">
              <div class="moz-signature"><img
                  src="cid:part13.4E90C242.6DAD4795@geomaster.pt"
                  alt="Logo" width="50" height="50" align="left"><span
                  class="im"><b><font size="+2"><font size="-2">   </font>Geomaster,
                      LDA</font></b></span><br>
                <div class="moz-signature">
                  <div class="moz-signature">  <b><font size="-2"
                        color="#999999">VENHA DESCOBRIR O CAMINHO DO
                        OPEN SOURCE CONNOSC</font></b><b><font size="-2"
                        color="#999999">O<br>
                        <br>
                      </font></b>
                    <meta http-equiv="content-type" content="text/html;
                      charset=UTF-8">
                    <title></title>
                    <div class="moz-signature">
                      <div class="moz-signature">
                        <div class="moz-signature">
                          <div class="moz-signature">
                            <div class="moz-signature">
                              <div class="moz-signature">
                                <table width="450" height="126"
                                  cellspacing="1" cellpadding="2"
                                  border="0">
                                  <tbody>
                                    <tr>
                                      <td width="150" valign="top"
                                        height="50"><font size="-1"><span
                                            class="im"><font size="-2"> </font><br>
                                            Avenida Barros e Soares<br>
                                            N.º 423, 4715-214 Braga<br>
                                            VAT/NIF</span><span
                                            class="im"> 510 906 109<br>
                                            Phone</span><span class="im">
                                              +351 253 680 323<br>
                                          </span>Site       <a
                                            href="http://geomaster.pt"
                                            rel="noreferrer"
                                            target="_blank"
data-saferedirecturl="https://www.google.com/url?hl=pt-PT&q=http://geomaster.pt&source=gmail&ust=1532515644545000&usg=AFQjCNEUP4MdlcHYefwCgfNLz4DspDBtXA">geomaster.pt</a><br>
                                          GPS       41.53322, -8.41929</font><br>
                                        <span class="im"></span></td>
                                      <td width="25" valign="top"
                                        align="right"><font size="-1"><span
                                            class="im"></span></font>
                                        <hr width="2" size="100"
                                          align="right"></td>
                                      <td width="150" valign="top"
                                        nowrap="nowrap" height="50"><font
                                          size="-1"><font size="-1"><font
                                              size="-2"> </font><br>
                                            Jorge Gustavo Rocha</font><br>
                                          <font size="-2"
                                            color="#999999">CTO<br>
                                            <br>
                                          </font>Mobile</font><font
                                          size="-1"><span class="im"> 
                                            +351 910 333 888<br>
                                            Email    <a class="moz-txt-link-abbreviated" href="mailto:jgr@geomaster.pt">jgr@geomaster.pt</a></span></font></td>
                                    </tr>
                                  </tbody>
                                </table>
                                <br>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>