-
Notifications
You must be signed in to change notification settings - Fork 1
Carga no PostGIS
Peter edited this page Sep 29, 2018
·
3 revisions
Ideal já instalar o nominatim... focando no Brasil.
Para aprender a usar base de dados osm2pgsql, ver https://github.com/openstreetmap/osm2pgsql/blob/master/tests/regression-test.py porém parece ser outra estrutura.
Reproduzindo passo-a-passo dos comandos no servidor UBUNTU 16 LTS.
osm2pgsql -E 4326 -c -d osm_br -U postgres -W -H localhost -P 5432 --slim --hstore brazil-latest.osm.pbf
osm2pgsql SVN version 0.88.1 (64bit id space)
Password:......
Using built-in tag processing pipeline
Using projection SRS 4326 (EPSG:4326)
Setting up table: planet_osm_point
Setting up table: planet_osm_line
Setting up table: planet_osm_polygon
Setting up table: planet_osm_roads
Allocating memory for dense node cache
Allocating dense node cache in one big chunk
Allocating memory for sparse node cache
Sharing dense sparse
Node-cache: cache=800MB, maxblocks=102400*8192, allocation method=11
Mid: pgsql, scale=100 cache=800
Setting up table: planet_osm_nodes
Setting up table: planet_osm_ways
Setting up table: planet_osm_rels
Going over pending relations...
0 relations are pending
Using 1 helper-processes
Finished processing 0 relations in 0 sec
Committing transaction for planet_osm_point
WARNING: there is no transaction in progress
Committing transaction for planet_osm_line
WARNING: there is no transaction in progress
Committing transaction for planet_osm_polygon
WARNING: there is no transaction in progress
Committing transaction for planet_osm_roads
WARNING: there is no transaction in progress
Sorting data and creating indexes for planet_osm_line
Sorting data and creating indexes for planet_osm_roads
Stopping table: planet_osm_nodes
Stopping table: planet_osm_ways
Building index on table: planet_osm_ways
Sorting data and creating indexes for planet_osm_polygon
Sorting data and creating indexes for planet_osm_point
Stopping table: planet_osm_rels
Stopped table: planet_osm_nodes in 0s
Building index on table: planet_osm_rels
Copying planet_osm_polygon to cluster by geometry finished
Creating geometry index on planet_osm_polygon
Creating osm_id index on planet_osm_polygon
Creating indexes on planet_osm_polygon finished
All indexes on planet_osm_polygon created in 1s
Completed planet_osm_polygon
Copying planet_osm_roads to cluster by geometry finished
Creating geometry index on planet_osm_roads
Creating osm_id index on planet_osm_roads
Creating indexes on planet_osm_roads finished
All indexes on planet_osm_roads created in 2s
Completed planet_osm_roads
Copying planet_osm_line to cluster by geometry finished
Creating geometry index on planet_osm_line
Creating osm_id index on planet_osm_line
Creating indexes on planet_osm_line finished
All indexes on planet_osm_line created in 5s
Completed planet_osm_line
Stopped table: planet_osm_rels in 6s
Copying planet_osm_point to cluster by geometry finished
Creating geometry index on planet_osm_point
Creating osm_id index on planet_osm_point
Creating indexes on planet_osm_point finished
All indexes on planet_osm_point created in 49s
Completed planet_osm_point
Stopped table: planet_osm_ways in 447s
node cache: stored: 60524882(69.65%), storage efficiency: 57.72% (dense blocks: 23108, sparse nodes: 40597505), hit rate: 71.27%
Osm2pgsql took 2069s overall
- Jaguarão https://www.openstreetmap.org/relation/242390
- Jaraguá do Sul https://www.openstreetmap.org/relation/296625 Verificar IBGE:GEOCODIGO e wikidata=Q1022458
- https://www.openstreetmap.org/relation/3758
SELECT
round(SUM(
ST_Length(ST_Transform(
ST_Intersection(way, (SELECT way FROM planet_osm_polygon WHERE osm_id=-242390))
,4326)::geography)
)) AS "distance (meters)", highway AS "highway type"
FROM planet_osm_line
WHERE highway IS NOT NULL
AND ST_Intersects(way, (SELECT way FROM planet_osm_polygon WHERE osm_id=-242390))
GROUP BY highway
ORDER BY "distance (meters)" DESC
LIMIT 10;
-- select * from planet_osm_rels where 'type'=any(tags) limit 2;
--select distinct admin_level, boundary, st_astext(way) from planet_osm_roads where boundary='administrative' limit 2
SELECT name, ST_AsText(ST_Transform(way,4326)) AS pt_lonlattext -- tags
FROM planet_osm_point
WHERE tags @> 'cuisine=>sushi'::hstore limit 2;