Difference between revisions of "Tutoriais por Pedro Costa"

From OSGeo
Jump to navigation Jump to search
Line 12: Line 12:
  
 
<syntaxhighlight lang="sql">
 
<syntaxhighlight lang="sql">
 
 
select count(*), portugal.municipio
 
select count(*), portugal.municipio
 
from planet_osm_roads, portugal
 
from planet_osm_roads, portugal
Line 19: Line 18:
 
group by portugal.municipio
 
group by portugal.municipio
 
order by count (planet_osm_roads) desc
 
order by count (planet_osm_roads) desc
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 26: Line 24:
  
 
<syntaxhighlight lang="sql">
 
<syntaxhighlight lang="sql">
 
 
update planet_osm_roads set highway = 'unclassified'
 
update planet_osm_roads set highway = 'unclassified'
 
where planet_osm_roads.highway is null
 
where planet_osm_roads.highway is null
 
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 09:03, 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>