Visitas: 1
Para convertir un archivo OSM a una base de datos PostgreSQL/PostGIS debemos de hacer unos pasos muy sencillos.
Entramos a la consola y escribimos:
sudo aptitude update && sudo aptitude install osm2pgsql -y
Ahora volvemos a escribir en la consola:
su postgres osm2pgsql -W -d osm_paraguay_pruebas /home/proyectosbeta/UnaParteParaguay.osm
Referencias:
- -d: nombre de la base de datos que queremos introducir los datos geométricos. Asumimos que ya existe la base de datos creada con las opciones geométricas.
- /home/proyectosbeta/UnaParteParaguay.osm: ruta donde se encuentra el archivo OSM:
Nos saldría algo así por pantalla:
Using projection SRS 900913 (Spherical Mercator) Setting up table: planet_osm_point NOTICE: la tabla «planet_osm_point» no existe, ignorando NOTICE: la tabla «planet_osm_point_tmp» no existe, ignorando Setting up table: planet_osm_line NOTICE: la tabla «planet_osm_line» no existe, ignorando NOTICE: la tabla «planet_osm_line_tmp» no existe, ignorando Setting up table: planet_osm_polygon NOTICE: la tabla «planet_osm_polygon» no existe, ignorando NOTICE: la tabla «planet_osm_polygon_tmp» no existe, ignorando Setting up table: planet_osm_roads NOTICE: la tabla «planet_osm_roads» no existe, ignorando NOTICE: la tabla «planet_osm_roads_tmp» no existe, ignorando Using built-in tag processing pipeline 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=3 Mid: Ram, scale=100 Reading in file: /home/proyectosbeta/UnaParteParaguay.osm StartElement: Unknown element name: note Unknown node type 3 EndElement: Unknown element name: note StartElement: Unknown element name: meta EndElement: Unknown element name: meta Processing: Node(131k 131.9k/s) Way(24k 12.21k/s) Relation(210 210.00/s) parse time: 3s Node stats: total(131873), max(3593725436) in 1s Way stats: total(24412), max(353561903) in 2s Relation stats: total(210), max(5182479) in 0s Committing transaction for planet_osm_point Committing transaction for planet_osm_line Committing transaction for planet_osm_polygon Committing transaction for planet_osm_roads Writing way (24k) Committing transaction for planet_osm_point Committing transaction for planet_osm_line Committing transaction for planet_osm_polygon Committing transaction for planet_osm_roads Writing relation (207) Sorting data and creating indexes for planet_osm_line Sorting data and creating indexes for planet_osm_roads Sorting data and creating indexes for planet_osm_polygon node cache: stored: 131873(100.00%), storage efficiency: 49.92% (dense blocks: 3, sparse nodes: 130553), hit rate: 96.37% Sorting data and creating indexes for planet_osm_point Analyzing planet_osm_roads finished Analyzing planet_osm_point finished Analyzing planet_osm_polygon finished Copying planet_osm_roads to cluster by geometry finished Creating geometry index on planet_osm_roads Creating indexes on planet_osm_roads finished Copying planet_osm_point to cluster by geometry finished Creating geometry index on planet_osm_point All indexes on planet_osm_roads created in 0s Completed planet_osm_roads Creating indexes on planet_osm_point finished All indexes on planet_osm_point created in 0s Completed planet_osm_point Copying planet_osm_polygon to cluster by geometry finished Creating geometry index on planet_osm_polygon Creating indexes on planet_osm_polygon finished All indexes on planet_osm_polygon created in 0s Completed planet_osm_polygon Analyzing planet_osm_line finished Copying planet_osm_line to cluster by geometry finished Creating geometry index on planet_osm_line Creating indexes on planet_osm_line finished All indexes on planet_osm_line created in 1s Completed planet_osm_line Osm2pgsql took 5s overall
Para verificar entramos al pgAdmin III.