<div dir="ltr"><div>Muito obrigado, as vossas sugestões (Jorge Gustavo Rocha e Fernando Ribeiro) funcionaram na perfeição.</div><div><br></div><div>Cumprimentos</div><div>Luis</div></div><br><div class="gmail_quote"><div class="gmail_attr" dir="ltr">On Thu, Apr 4, 2019 at 5:26 PM Jorge Gustavo Rocha <<a href="mailto:jgr@geomaster.pt">jgr@geomaster.pt</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 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="gmail-m_6725560670084750653k">select</span> estudo.* 
<span class="gmail-m_6725560670084750653k">from</span> estudo<span class="gmail-m_6725560670084750653p">,</span> areaestudo
<span class="gmail-m_6725560670084750653k">where</span><span class="gmail-m_6725560670084750653k"></span> <span class="gmail-m_6725560670084750653n">st_contains</span><span class="gmail-m_6725560670084750653p">(</span>areaestudo<span class="gmail-m_6725560670084750653p">.</span><span class="gmail-m_6725560670084750653n">geom</span><span class="gmail-m_6725560670084750653p">,</span> estudo<span class="gmail-m_6725560670084750653p"></span><span class="gmail-m_6725560670084750653p">.</span><span class="gmail-m_6725560670084750653n">geom</span><span class="gmail-m_6725560670084750653p">)</span>
<span class="gmail-m_6725560670084750653s1"></span>
Pode-se acrescentar mais condições no where para restringir os dados a carregar no QGIS.

Bom trabalho

Jorge Gustavo
</pre>
    <div class="gmail-m_6725560670084750653moz-cite-prefix">Às 16:58 de 04/04/19, Luis Bentes
      escreveu:<br>
    </div>
    <blockquote type="cite">
      
      <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" target="_blank">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">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">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">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">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">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">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">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">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">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">QGIS-pt@lists.osgeo.org</a><br>
          <a href="https://lists.osgeo.org/mailman/listinfo/qgis-pt" target="_blank" rel="noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-pt</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="gmail-m_6725560670084750653mimeAttachmentHeader"></fieldset>
      <pre class="gmail-m_6725560670084750653moz-quote-pre">_______________________________________________
QGIS-pt mailing list
<a class="gmail-m_6725560670084750653moz-txt-link-abbreviated" href="mailto:QGIS-pt@lists.osgeo.org" target="_blank">QGIS-pt@lists.osgeo.org</a>
<a class="gmail-m_6725560670084750653moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-pt" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-pt</a>
</pre>
    </blockquote>
    <div class="gmail-m_6725560670084750653moz-signature">-- <br>
      
      <div class="gmail-m_6725560670084750653moz-signature">
        
        <div class="gmail-m_6725560670084750653moz-signature">
          
          <div class="gmail-m_6725560670084750653moz-signature">
            <div class="gmail-m_6725560670084750653moz-signature">
              <div class="gmail-m_6725560670084750653moz-signature"><img width="50" height="50" align="left" alt="Logo" src="cid:169ed1e8f97481bf9481"><span class="gmail-m_6725560670084750653im"><b><font size="+2"><font size="-2">   </font>Geomaster,
                      LDA</font></b></span><br>
                <div class="gmail-m_6725560670084750653moz-signature">
                  <div class="gmail-m_6725560670084750653moz-signature">  <b><font color="#999999" size="-2">VENHA DESCOBRIR O CAMINHO DO
                        OPEN SOURCE CONNOSC</font></b><b><font color="#999999" size="-2">O<br>
                        <br>
                      </font></b>
                    
                    
                    <div class="gmail-m_6725560670084750653moz-signature">
                      <div class="gmail-m_6725560670084750653moz-signature">
                        <div class="gmail-m_6725560670084750653moz-signature">
                          <div class="gmail-m_6725560670084750653moz-signature">
                            <div class="gmail-m_6725560670084750653moz-signature">
                              <div class="gmail-m_6725560670084750653moz-signature">
                                <table width="450" height="126" border="0" cellspacing="1" cellpadding="2">
                                  <tbody>
                                    <tr>
                                      <td width="150" height="50" valign="top"><font size="-1"><span class="gmail-m_6725560670084750653im"><font size="-2"> </font><br>
                                            Avenida Barros e Soares<br>
                                            N.º 423, 4715-214 Braga<br>
                                            VAT/NIF</span><span class="gmail-m_6725560670084750653im"> 510 906 109<br>
                                            Phone</span><span class="gmail-m_6725560670084750653im">
                                              +351 253 680 323<br>
                                          </span>Site       <a href="http://geomaster.pt" target="_blank" rel="noreferrer">geomaster.pt</a><br>
                                          GPS       41.53322, -8.41929</font><br>
                                        <span class="gmail-m_6725560670084750653im"></span></td>
                                      <td width="25" align="right" valign="top"><font size="-1"><span class="gmail-m_6725560670084750653im"></span></font>
                                        <hr width="2" size="100" align="right"></td>
                                      <td width="150" height="50" nowrap valign="top"><font size="-1"><font size="-1"><font size="-2"> </font><br>
                                            Jorge Gustavo Rocha</font><br>
                                          <font color="#999999" size="-2">CTO<br>
                                            <br>
                                          </font>Mobile</font><font size="-1"><span class="gmail-m_6725560670084750653im"> 
                                            +351 910 333 888<br>
                                            Email    <a class="gmail-m_6725560670084750653moz-txt-link-abbreviated" href="mailto:jgr@geomaster.pt" target="_blank">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>
  </div>

_______________________________________________<br>
QGIS-pt mailing list<br>
<a href="mailto:QGIS-pt@lists.osgeo.org" target="_blank">QGIS-pt@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/qgis-pt" target="_blank" rel="noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-pt</a><br>
</blockquote></div>