Difference between revisions of "Tutoriais por Pedro Costa"
Jump to navigation
Jump to search
(Created page with 'Quantas estradas existem sem qualquer tipo de classificação?') |
|||
Line 1: | Line 1: | ||
− | Quantas estradas existem sem qualquer tipo de classificação? | + | == Quantas estradas existem sem qualquer tipo de classificação, por concelho?== |
+ | |||
+ | 1º Passo: Importar ''shapefile'' da CAOP com os concelhos: | ||
+ | [http://www.igeo.pt/produtos/cadastro/caop/download/CAOP20090_Shapes/Cont_AAd_CAOP20090.zip] | ||
+ | |||
+ | 2º Passo: Converter para o Sistema de coordenadas da Base de Dados descarregada do OSM | ||
+ | |||
+ | |||
+ | 3º Passo: Sintaxe da query: | ||
+ | |||
+ | <syntaxhighlight lang="sql"> | ||
+ | select count(*), portugal.municipio | ||
+ | from planet_osm_roads, portugal | ||
+ | where highway is null | ||
+ | and st_contains (way, way) | ||
+ | group by portugal.municipio | ||
+ | order by count (planet_osm_roads) desc | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | 4º Passo: Alterar highways sem classificação para "unclassifield": | ||
+ | |||
+ | <syntaxhighlight lang="sql"> | ||
+ | update planet_osm_roads set highway = 'unclassified' | ||
+ | where planet_osm_roads.highway is null | ||
+ | </syntaxhighlight> |
Revision as of 08:59, 15 April 2011
Quantas estradas existem sem qualquer tipo de classificação, por concelho?
1º Passo: Importar shapefile da CAOP com os concelhos: [1]
2º Passo: Converter para o Sistema de coordenadas da Base de Dados descarregada do OSM
3º Passo: Sintaxe da query:
<syntaxhighlight lang="sql"> select count(*), portugal.municipio from planet_osm_roads, portugal where highway is null and st_contains (way, way) group by portugal.municipio order by count (planet_osm_roads) desc </syntaxhighlight>
4º Passo: Alterar highways sem classificação para "unclassifield":
<syntaxhighlight lang="sql"> update planet_osm_roads set highway = 'unclassified' where planet_osm_roads.highway is null </syntaxhighlight>