SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Introdução à Programação em SIG – Tutorial PostGis



Considerações iniciais…

A concepção deste segundo trabalho consiste no desenvolvimento de um tutorial que exponha os
procedimentos e a metodologia utilizada para a sua concepção de uma base de dados através da
linguagem SQL, com o suporte do software PostGis.
Este trabalho vem no seguimento do primeiro, uma vez que a concepção dos dados fora
desenvolvida no JOSM e posteriormente adicionados ao OpenStreetMap.




Fig.1 - Visão geral da área de intervenção, após editar as vias de acesso secundárias, cursos de água e
alguns pontos de interesse.


Neste sentido, os dados resultantes do desenho do OpenStreetMap, como se pode observar na
fig.1, foram importados para o PostGis, de modo a poder questiomnar a base de dados através da
linguagem SQL.




                                           Andreia Soares Fecha                                      1
Introdução à Programação em SIG – Tutorial PostGis



No entanto, primeiramente, os dados foram importados para o programa Quantum Gis, de modo a
converter a geometria para shapefiles, para posteriormente serem importados para o PostGis /
PgAdmin III.


Neste sentido utilizei os seguintes procedimentos:
- Importar linhas:




                                         Andreia Soares Fecha                                        2
Introdução à Programação em SIG – Tutorial PostGis

- Importar polignos:




- Importar Pontos




                       Andreia Soares Fecha                                    3
Introdução à Programação em SIG – Tutorial PostGis



- De modo a confirmar que as tabelas necessárias foram adicionadas, faz-se actualizar.




                                        Andreia Soares Fecha                                     4
Introdução à Programação em SIG – Tutorial PostGis

Inquirição à base de dados:
                                        Tabela Pontos
Query 1 – Selecciona a tabela pontos?
Linguagem SQL - select * from pontos




Query 2 – Selecciona somente a coluna name com os elementos da tabela pontos?
Linguagem SQL - select name from pontos




                                        Andreia Soares Fecha                                    5
Introdução à Programação em SIG – Tutorial PostGis



Query 3 – Qual o nome a as coordenadas dos elementos constantes nas colunas da tabela
pontos?
Linguagem SQL - select name, the_geom from pontos




Query 4 – Qual o número de pontos realizados pelo user dreia_fecha, constantes na tabela
pontos?
Linguagem SQL - select count (pontos.user)from pontos where pontos.user like '%dreia_fecha%'




                                       Andreia Soares Fecha                                    6
Introdução à Programação em SIG – Tutorial PostGis



Query 5 – Qual o nome dos pontos, a geometria e as coordenadas dos pontos realizados,
constantes na tabela pontos?
Linguagem SQL - select name, st_astext(the_geom) from pontos




Query 6 – Qual a designação completa dos pontos de interesse que começa pela letra “C”,
constantes na tabela pontos?
Linguagem SQL - select * from Pontos where name like'C%'


       Segundo a consulta os resultados foram: o Centro de Saúde, a Central de Camionagem e
o Colégio de Albergaria.




                                      Andreia Soares Fecha                                    7
Introdução à Programação em SIG – Tutorial PostGis



                                        Tabela Linhas




Query 7 – Qual o número de linhas desenhadas pela user dreia_fecha?
Linguagem SQL - select count (linhas.user)from linhas where linhas.user like '%dreia_fecha%'




Query 8 – Qual o comprimento máximo da linha desenhada pelo user dreia_fecha?
Linguagem SQL - select max (length(the_geom)), user from linhas where linhas.user like
'%dreia_fecha%'




                                        Andreia Soares Fecha                                    8
Introdução à Programação em SIG – Tutorial PostGis

Query 9 – Qual o código postal das estradas inseridas pelo utilizador "dreia_fecha", ordenado
pelo nome da rua?


A realização deste procedimento resulta da tabela linhas que já constava do projecto, e da tabela
CTT que foi posteriormente adicionada ao projecto.


Linguagem SQL -
select linhas.name as name, linhas.user as name, cttshapefile.cp4 as Codigo_Postal from linhas,
cttshapefile
where linhas.the_geom && cttshapefile.the_geom and
Contains(linhas.the_geom, linhas.the_geom) and linhas.user like '%dreia_fecha%' order by
linhas.name




                                         Andreia Soares Fecha                                       9
Introdução à Programação em SIG – Tutorial PostGis



Query 10 – Quais são os rios desenhados pelo user dreia_fecha?


Linguagem SQL - select * from linhas where waterway like'%river%'




Query 11 – A que distância se encontra a Rua da Fonte da tabela linhas, do Centro de Saúde de
Albergaria – A-Velha da tabela pontos, desenhados pelo user dreia_fecha?


Linguagem SQL -
select   linhas.name,   pontos.user,   pontos.name       pontos,   pontos.amenity,    st_distance
(linhas.the_geom, pontos.the_geom) from linhas, pontos
where linhas.name like '%Rua da Fonte%'and pontos.name like '%Centro de Saúde de Albergaria-
A-Velha%'and pontos.user like 'dreia_fecha%'




                                       Andreia Soares Fecha                                    10
Introdução à Programação em SIG – Tutorial PostGis



                                    Tabela - Polígonos


Query 12 – Quantos polígnos foram desenhados pelo user dreia_fecha?


Linguagem SQL - select count (polignos.user)from polignos where polignos.user like
'%dreia_fecha%'




                                     Andreia Soares Fecha                                    11
Introdução à Programação em SIG – Tutorial PostGis

                                         Tabela - Ctt


Query 13 – Selecciona a tabela ctt?


Linguagem SQL - select * from cttshapefile




                                       Andreia Soares Fecha                                    12
Introdução à Programação em SIG – Tutorial PostGis



Query 14 – Qual o código postal do nome das vias da tabela linhas?


Linguagem SQL - select linhas.name as name, cttshapefile.cp4 as Codigo_Postal from linhas,
cttshapefile




.




                                       Andreia Soares Fecha                                    13

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Bullying - Texto e cruzadinha
Bullying        -     Texto e cruzadinhaBullying        -     Texto e cruzadinha
Bullying - Texto e cruzadinhaMary Alvarenga
 
02. Informática - Windows 10 apostila completa.pdf
02. Informática - Windows 10 apostila completa.pdf02. Informática - Windows 10 apostila completa.pdf
02. Informática - Windows 10 apostila completa.pdfJorge Andrade
 
FCEE - Diretrizes - Autismo.pdf para imprimir
FCEE - Diretrizes - Autismo.pdf para imprimirFCEE - Diretrizes - Autismo.pdf para imprimir
FCEE - Diretrizes - Autismo.pdf para imprimirIedaGoethe
 
DIA DO INDIO - FLIPBOOK PARA IMPRIMIR.pdf
DIA DO INDIO - FLIPBOOK PARA IMPRIMIR.pdfDIA DO INDIO - FLIPBOOK PARA IMPRIMIR.pdf
DIA DO INDIO - FLIPBOOK PARA IMPRIMIR.pdfIedaGoethe
 
HORA DO CONTO4_BECRE D. CARLOS I_2023_2024
HORA DO CONTO4_BECRE D. CARLOS I_2023_2024HORA DO CONTO4_BECRE D. CARLOS I_2023_2024
HORA DO CONTO4_BECRE D. CARLOS I_2023_2024Sandra Pratas
 
ABRIL VERDE.pptx Slide sobre abril ver 2024
ABRIL VERDE.pptx Slide sobre abril ver 2024ABRIL VERDE.pptx Slide sobre abril ver 2024
ABRIL VERDE.pptx Slide sobre abril ver 2024Jeanoliveira597523
 
LEMBRANDO A MORTE E CELEBRANDO A RESSUREIÇÃO
LEMBRANDO A MORTE E CELEBRANDO A RESSUREIÇÃOLEMBRANDO A MORTE E CELEBRANDO A RESSUREIÇÃO
LEMBRANDO A MORTE E CELEBRANDO A RESSUREIÇÃOColégio Santa Teresinha
 
ALMANANHE DE BRINCADEIRAS - 500 atividades escolares
ALMANANHE DE BRINCADEIRAS - 500 atividades escolaresALMANANHE DE BRINCADEIRAS - 500 atividades escolares
ALMANANHE DE BRINCADEIRAS - 500 atividades escolaresLilianPiola
 
Slides Lição 03, Central Gospel, O Arrebatamento, 1Tr24.pptx
Slides Lição 03, Central Gospel, O Arrebatamento, 1Tr24.pptxSlides Lição 03, Central Gospel, O Arrebatamento, 1Tr24.pptx
Slides Lição 03, Central Gospel, O Arrebatamento, 1Tr24.pptxLuizHenriquedeAlmeid6
 
Simulado 1 Etapa - 2024 Proximo Passo.pdf
Simulado 1 Etapa - 2024 Proximo Passo.pdfSimulado 1 Etapa - 2024 Proximo Passo.pdf
Simulado 1 Etapa - 2024 Proximo Passo.pdfEditoraEnovus
 
Gerenciando a Aprendizagem Organizacional
Gerenciando a Aprendizagem OrganizacionalGerenciando a Aprendizagem Organizacional
Gerenciando a Aprendizagem OrganizacionalJacqueline Cerqueira
 
ATIVIDADE AVALIATIVA VOZES VERBAIS 7º ano.pptx
ATIVIDADE AVALIATIVA VOZES VERBAIS 7º ano.pptxATIVIDADE AVALIATIVA VOZES VERBAIS 7º ano.pptx
ATIVIDADE AVALIATIVA VOZES VERBAIS 7º ano.pptxOsnilReis1
 
Investimentos. EDUCAÇÃO FINANCEIRA 8º ANO
Investimentos. EDUCAÇÃO FINANCEIRA 8º ANOInvestimentos. EDUCAÇÃO FINANCEIRA 8º ANO
Investimentos. EDUCAÇÃO FINANCEIRA 8º ANOMarcosViniciusLemesL
 
HORA DO CONTO3_BECRE D. CARLOS I_2023_2024
HORA DO CONTO3_BECRE D. CARLOS I_2023_2024HORA DO CONTO3_BECRE D. CARLOS I_2023_2024
HORA DO CONTO3_BECRE D. CARLOS I_2023_2024Sandra Pratas
 
Slides Lição 4, CPAD, Como se Conduzir na Caminhada, 2Tr24.pptx
Slides Lição 4, CPAD, Como se Conduzir na Caminhada, 2Tr24.pptxSlides Lição 4, CPAD, Como se Conduzir na Caminhada, 2Tr24.pptx
Slides Lição 4, CPAD, Como se Conduzir na Caminhada, 2Tr24.pptxLuizHenriquedeAlmeid6
 
trabalho wanda rocha ditadura
trabalho wanda rocha ditaduratrabalho wanda rocha ditadura
trabalho wanda rocha ditaduraAdryan Luiz
 
QUARTA - 1EM SOCIOLOGIA - Aprender a pesquisar.pptx
QUARTA - 1EM SOCIOLOGIA - Aprender a pesquisar.pptxQUARTA - 1EM SOCIOLOGIA - Aprender a pesquisar.pptx
QUARTA - 1EM SOCIOLOGIA - Aprender a pesquisar.pptxIsabellaGomes58
 
O Universo Cuckold - Compartilhando a Esposas Com Amigo.pdf
O Universo Cuckold - Compartilhando a Esposas Com Amigo.pdfO Universo Cuckold - Compartilhando a Esposas Com Amigo.pdf
O Universo Cuckold - Compartilhando a Esposas Com Amigo.pdfPastor Robson Colaço
 

Kürzlich hochgeladen (20)

Bullying - Texto e cruzadinha
Bullying        -     Texto e cruzadinhaBullying        -     Texto e cruzadinha
Bullying - Texto e cruzadinha
 
02. Informática - Windows 10 apostila completa.pdf
02. Informática - Windows 10 apostila completa.pdf02. Informática - Windows 10 apostila completa.pdf
02. Informática - Windows 10 apostila completa.pdf
 
FCEE - Diretrizes - Autismo.pdf para imprimir
FCEE - Diretrizes - Autismo.pdf para imprimirFCEE - Diretrizes - Autismo.pdf para imprimir
FCEE - Diretrizes - Autismo.pdf para imprimir
 
DIA DO INDIO - FLIPBOOK PARA IMPRIMIR.pdf
DIA DO INDIO - FLIPBOOK PARA IMPRIMIR.pdfDIA DO INDIO - FLIPBOOK PARA IMPRIMIR.pdf
DIA DO INDIO - FLIPBOOK PARA IMPRIMIR.pdf
 
Em tempo de Quaresma .
Em tempo de Quaresma                            .Em tempo de Quaresma                            .
Em tempo de Quaresma .
 
HORA DO CONTO4_BECRE D. CARLOS I_2023_2024
HORA DO CONTO4_BECRE D. CARLOS I_2023_2024HORA DO CONTO4_BECRE D. CARLOS I_2023_2024
HORA DO CONTO4_BECRE D. CARLOS I_2023_2024
 
ABRIL VERDE.pptx Slide sobre abril ver 2024
ABRIL VERDE.pptx Slide sobre abril ver 2024ABRIL VERDE.pptx Slide sobre abril ver 2024
ABRIL VERDE.pptx Slide sobre abril ver 2024
 
LEMBRANDO A MORTE E CELEBRANDO A RESSUREIÇÃO
LEMBRANDO A MORTE E CELEBRANDO A RESSUREIÇÃOLEMBRANDO A MORTE E CELEBRANDO A RESSUREIÇÃO
LEMBRANDO A MORTE E CELEBRANDO A RESSUREIÇÃO
 
ALMANANHE DE BRINCADEIRAS - 500 atividades escolares
ALMANANHE DE BRINCADEIRAS - 500 atividades escolaresALMANANHE DE BRINCADEIRAS - 500 atividades escolares
ALMANANHE DE BRINCADEIRAS - 500 atividades escolares
 
Slides Lição 03, Central Gospel, O Arrebatamento, 1Tr24.pptx
Slides Lição 03, Central Gospel, O Arrebatamento, 1Tr24.pptxSlides Lição 03, Central Gospel, O Arrebatamento, 1Tr24.pptx
Slides Lição 03, Central Gospel, O Arrebatamento, 1Tr24.pptx
 
Simulado 1 Etapa - 2024 Proximo Passo.pdf
Simulado 1 Etapa - 2024 Proximo Passo.pdfSimulado 1 Etapa - 2024 Proximo Passo.pdf
Simulado 1 Etapa - 2024 Proximo Passo.pdf
 
XI OLIMPÍADAS DA LÍNGUA PORTUGUESA -
XI OLIMPÍADAS DA LÍNGUA PORTUGUESA      -XI OLIMPÍADAS DA LÍNGUA PORTUGUESA      -
XI OLIMPÍADAS DA LÍNGUA PORTUGUESA -
 
Gerenciando a Aprendizagem Organizacional
Gerenciando a Aprendizagem OrganizacionalGerenciando a Aprendizagem Organizacional
Gerenciando a Aprendizagem Organizacional
 
ATIVIDADE AVALIATIVA VOZES VERBAIS 7º ano.pptx
ATIVIDADE AVALIATIVA VOZES VERBAIS 7º ano.pptxATIVIDADE AVALIATIVA VOZES VERBAIS 7º ano.pptx
ATIVIDADE AVALIATIVA VOZES VERBAIS 7º ano.pptx
 
Investimentos. EDUCAÇÃO FINANCEIRA 8º ANO
Investimentos. EDUCAÇÃO FINANCEIRA 8º ANOInvestimentos. EDUCAÇÃO FINANCEIRA 8º ANO
Investimentos. EDUCAÇÃO FINANCEIRA 8º ANO
 
HORA DO CONTO3_BECRE D. CARLOS I_2023_2024
HORA DO CONTO3_BECRE D. CARLOS I_2023_2024HORA DO CONTO3_BECRE D. CARLOS I_2023_2024
HORA DO CONTO3_BECRE D. CARLOS I_2023_2024
 
Slides Lição 4, CPAD, Como se Conduzir na Caminhada, 2Tr24.pptx
Slides Lição 4, CPAD, Como se Conduzir na Caminhada, 2Tr24.pptxSlides Lição 4, CPAD, Como se Conduzir na Caminhada, 2Tr24.pptx
Slides Lição 4, CPAD, Como se Conduzir na Caminhada, 2Tr24.pptx
 
trabalho wanda rocha ditadura
trabalho wanda rocha ditaduratrabalho wanda rocha ditadura
trabalho wanda rocha ditadura
 
QUARTA - 1EM SOCIOLOGIA - Aprender a pesquisar.pptx
QUARTA - 1EM SOCIOLOGIA - Aprender a pesquisar.pptxQUARTA - 1EM SOCIOLOGIA - Aprender a pesquisar.pptx
QUARTA - 1EM SOCIOLOGIA - Aprender a pesquisar.pptx
 
O Universo Cuckold - Compartilhando a Esposas Com Amigo.pdf
O Universo Cuckold - Compartilhando a Esposas Com Amigo.pdfO Universo Cuckold - Compartilhando a Esposas Com Amigo.pdf
O Universo Cuckold - Compartilhando a Esposas Com Amigo.pdf
 

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Introdução à Programação em SIG – Tutorial PostGis com PostGIS

  • 1. Introdução à Programação em SIG – Tutorial PostGis Considerações iniciais… A concepção deste segundo trabalho consiste no desenvolvimento de um tutorial que exponha os procedimentos e a metodologia utilizada para a sua concepção de uma base de dados através da linguagem SQL, com o suporte do software PostGis. Este trabalho vem no seguimento do primeiro, uma vez que a concepção dos dados fora desenvolvida no JOSM e posteriormente adicionados ao OpenStreetMap. Fig.1 - Visão geral da área de intervenção, após editar as vias de acesso secundárias, cursos de água e alguns pontos de interesse. Neste sentido, os dados resultantes do desenho do OpenStreetMap, como se pode observar na fig.1, foram importados para o PostGis, de modo a poder questiomnar a base de dados através da linguagem SQL. Andreia Soares Fecha 1
  • 2. Introdução à Programação em SIG – Tutorial PostGis No entanto, primeiramente, os dados foram importados para o programa Quantum Gis, de modo a converter a geometria para shapefiles, para posteriormente serem importados para o PostGis / PgAdmin III. Neste sentido utilizei os seguintes procedimentos: - Importar linhas: Andreia Soares Fecha 2
  • 3. Introdução à Programação em SIG – Tutorial PostGis - Importar polignos: - Importar Pontos Andreia Soares Fecha 3
  • 4. Introdução à Programação em SIG – Tutorial PostGis - De modo a confirmar que as tabelas necessárias foram adicionadas, faz-se actualizar. Andreia Soares Fecha 4
  • 5. Introdução à Programação em SIG – Tutorial PostGis Inquirição à base de dados: Tabela Pontos Query 1 – Selecciona a tabela pontos? Linguagem SQL - select * from pontos Query 2 – Selecciona somente a coluna name com os elementos da tabela pontos? Linguagem SQL - select name from pontos Andreia Soares Fecha 5
  • 6. Introdução à Programação em SIG – Tutorial PostGis Query 3 – Qual o nome a as coordenadas dos elementos constantes nas colunas da tabela pontos? Linguagem SQL - select name, the_geom from pontos Query 4 – Qual o número de pontos realizados pelo user dreia_fecha, constantes na tabela pontos? Linguagem SQL - select count (pontos.user)from pontos where pontos.user like '%dreia_fecha%' Andreia Soares Fecha 6
  • 7. Introdução à Programação em SIG – Tutorial PostGis Query 5 – Qual o nome dos pontos, a geometria e as coordenadas dos pontos realizados, constantes na tabela pontos? Linguagem SQL - select name, st_astext(the_geom) from pontos Query 6 – Qual a designação completa dos pontos de interesse que começa pela letra “C”, constantes na tabela pontos? Linguagem SQL - select * from Pontos where name like'C%' Segundo a consulta os resultados foram: o Centro de Saúde, a Central de Camionagem e o Colégio de Albergaria. Andreia Soares Fecha 7
  • 8. Introdução à Programação em SIG – Tutorial PostGis Tabela Linhas Query 7 – Qual o número de linhas desenhadas pela user dreia_fecha? Linguagem SQL - select count (linhas.user)from linhas where linhas.user like '%dreia_fecha%' Query 8 – Qual o comprimento máximo da linha desenhada pelo user dreia_fecha? Linguagem SQL - select max (length(the_geom)), user from linhas where linhas.user like '%dreia_fecha%' Andreia Soares Fecha 8
  • 9. Introdução à Programação em SIG – Tutorial PostGis Query 9 – Qual o código postal das estradas inseridas pelo utilizador "dreia_fecha", ordenado pelo nome da rua? A realização deste procedimento resulta da tabela linhas que já constava do projecto, e da tabela CTT que foi posteriormente adicionada ao projecto. Linguagem SQL - select linhas.name as name, linhas.user as name, cttshapefile.cp4 as Codigo_Postal from linhas, cttshapefile where linhas.the_geom && cttshapefile.the_geom and Contains(linhas.the_geom, linhas.the_geom) and linhas.user like '%dreia_fecha%' order by linhas.name Andreia Soares Fecha 9
  • 10. Introdução à Programação em SIG – Tutorial PostGis Query 10 – Quais são os rios desenhados pelo user dreia_fecha? Linguagem SQL - select * from linhas where waterway like'%river%' Query 11 – A que distância se encontra a Rua da Fonte da tabela linhas, do Centro de Saúde de Albergaria – A-Velha da tabela pontos, desenhados pelo user dreia_fecha? Linguagem SQL - select linhas.name, pontos.user, pontos.name pontos, pontos.amenity, st_distance (linhas.the_geom, pontos.the_geom) from linhas, pontos where linhas.name like '%Rua da Fonte%'and pontos.name like '%Centro de Saúde de Albergaria- A-Velha%'and pontos.user like 'dreia_fecha%' Andreia Soares Fecha 10
  • 11. Introdução à Programação em SIG – Tutorial PostGis Tabela - Polígonos Query 12 – Quantos polígnos foram desenhados pelo user dreia_fecha? Linguagem SQL - select count (polignos.user)from polignos where polignos.user like '%dreia_fecha%' Andreia Soares Fecha 11
  • 12. Introdução à Programação em SIG – Tutorial PostGis Tabela - Ctt Query 13 – Selecciona a tabela ctt? Linguagem SQL - select * from cttshapefile Andreia Soares Fecha 12
  • 13. Introdução à Programação em SIG – Tutorial PostGis Query 14 – Qual o código postal do nome das vias da tabela linhas? Linguagem SQL - select linhas.name as name, cttshapefile.cp4 as Codigo_Postal from linhas, cttshapefile . Andreia Soares Fecha 13