Creo la geodatabase "formación"
sudo su
su postgres
createdb -E UTF8 template_postgis2
createlang -d template_postgis2 plpgsql
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis2'"
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/rtpostgis.sql
psql -d template_postgis2 -c "GRANT ALL ON geometry_columns TO PUBLIC;"
psql -d template_postgis2 -c "GRANT ALL ON geography_columns TO PUBLIC;"
psql -d template_postgis2 -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
createdb training -T template_postgis2
formación sobre bases de datos geográficos http://savepic.su/3233935.jpg
Luego cambié "default.style"
sudo cp "./default.style" "/usr/share/osm2pgsql/default.style"
Luego cargo formas
sudo apt-get install subversion
mkdir "/home/oleg/mapnik"
svn co "http://svn.openstreetmap.org/applications/rendering/mapnik" "/home/oleg/mapnik"
bash /home/oleg/mapnik/get-coastlines.sh
Ahora quiero crear estilo
python /home/oleg/mapnik/generate_xml.py osm.xml my_osm.xml --dbname training --user postgres --password postgres --accept-none
enlace http://savepic.su/3233934.jpg
Por favor, dime cómo crear estilo.
Actualización: Ahora tengo este problema.
oleg@oleg-pkvb:~/mapnik$ ./generate_xml.py osm.xml osm_new.xml --dbname training --user osm --world_boundaries /home/oleg/world_boundaries/ --accept-none
Traceback (most recent call last):
File "./generate_xml.py", line 204, in <module>
serialize(template_xml,options)
File "./generate_xml.py", line 80, in serialize
mapnik.load_map(m,xml,True)
RuntimeError: Postgis Plugin: FATAL: Peer authentication failed for user "osm"
Connection string: ' dbname=training user=osm connect_timeout=4'
encountered during parsing of layer 'landcover' in Layer at line 341 of 'osm.xml'
Actualización 2:
oleg@oleg-pkvb:~/mapnik$ ./generate_xml.py osm.xml osm_new.xml --dbname training --host localhost --port 5432 --user osm --password postgres --world_boundaries /home/oleg/world_boundaries/ --accept-none
Traceback (most recent call last):
File "./generate_xml.py", line 204, in <module>
serialize(template_xml,options)
File "./generate_xml.py", line 80, in serialize
mapnik.load_map(m,xml,True)
RuntimeError: ERROR: relation "planet_osm_polygon" does not exist
Actualización 3
Intento descargar datos en mi base de datos "formación"
oleg@oleg-pkvb:~$ sudo osm2pgsql -U osm -d training -W postgres -H localhost -P 5432 Moscow.osm.gz
osm2pgsql SVN version 0.70.5
Password:
Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE: table "planet_osm_point" does not exist, skipping
NOTICE: table "planet_osm_point_tmp" does not exist, skipping
PREPARE get_way (int4) AS SELECT AsText(way) FROM planet_osm_point WHERE osm_id = $1;
failed: ERROR: function astext(geometry) does not exist
LINE 1: PREPARE get_way (int4) AS SELECT AsText(way) FROM planet_osm...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Error occurred, cleaning up
Actualización 4:
Ahora uso osm2pgsql 0.83, postgis 2.1, postgres 9.1, mapnik 300000. Creo usuario 'gisuser' y base de datos 'gis'. Pero tengo el mismo problema ((
postgres=# ALTER USER gisuser WITH PASSWORD 'postgres';
ALTER ROLE
postgres=# \q
oleg@oleg-pkvb:~$ sudo osm2pgsql -U gisuser -W postgres -d gis -H localhost -P 5432 Moscow.osm.gz
osm2pgsql SVN version 0.83.0 (64bit id space)
Password:
Warning: program compiled against libxml 209 using older 207
Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE: table "planet_osm_point" does not exist, skipping
NOTICE: table "planet_osm_point_tmp" does not exist, skipping
SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, 'POINT', 2 );
failed: ERROR: AddGeometryColumn() - invalid SRID
CONTEXT: SQL statement "SELECT AddGeometryColumn('','',$1,$2,$3,$4,$5, $6)"
PL/pgSQL function "addgeometrycolumn" line 5 at SQL statement