I managed to partially setup osm2psql
to work with my PostGIS
DB.
My DB contains now the following tables:
Schema | Name | Type | Owner
--------+-------------------+-------+-------
public | geography_columns | view | user
public | geometry_columns | view | user
public | spatial_ref_sys | table | user
Now I get the following error when I try to import osm
data into it.
I'm using the following command:
osm2pgsql england.osm -d mydb -U user -S default.style
The error I got :
sm2pgsql SVN version 0.70.5
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
Does anyone know what could be the problem?
Best Answer
I think you must (in addition to other scripts you've run) also run legacy.sql file which you can find next to postgis.sql and spatial_ref_sys.sql on whatever platform you are. This will add function aliases for old names because in Postgis 2.0, all functions have a 'ST_' prefix.. so AsText is now named ST_AsTexT().
Hope this helps!