[Geocoding] [OpenStreetMap] #4329: Several errors in utils/setup.php
OpenStreetMap
trac at openstreetmap.org
Wed Mar 28 12:51:47 BST 2012
#4329: Several errors in utils/setup.php
--------------------------------------+-------------------------------------
Reporter: f.v.claus@… | Owner: geocoding@…
Type: defect | Status: new
Priority: minor | Milestone:
Component: nominatim | Version: 2.0
Keywords: |
--------------------------------------+-------------------------------------
I tried setting up nominatim according to the wiki entry and I came across
several errors.
Im running Ubuntu 10.10 with postgres 8.4 and osm2pgsql works if i do it
by hand.
{{{
$oDB =& DB::connect(CONST_Database_DSN, false);
if (!PEAR::isError($oDB)){
fail('database already exists ('.CONST_Database_DSN.')');
}
}}}
Terminates script if database does not exists which should not be the case
if you want to create a new database.
I changed the following line
{{{
passthru($osm2pgsql.' -lsc -O gazetteer -C 12000 --hstore -d
'.$aDSNInfo['database'].' '.$aCMDResult['osm-file']);
}}}
to
{{{
passthru($osm2pgsql.' -s -d ' .$aDSNInfo['database'].' '.$aCMDResult['osm-
file'])
}}}
Fails because the command line does take the argument --hstore.
With the compiled osm2pgsql I always get
{{{
usr/local/bin/osm2pgsql: error while loading shared libraries:
libprotobuf-c.so.0: cannot open shared object file: No such file or
directory
}}}
which I can solve in the user shell by adding
{{{
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
}}}
I recompiled but the problem seems to persist.
{{{
function pgsqlRunScript($sScript)
{
// Convert database DSN to psql paramaters
$aDSNInfo = DB::parseDSN(CONST_Database_DSN);
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port']
= 5432;
$sCMD = 'psql -p '.$aDSNInfo['port'].' '.$aDSNInfo['database']. '--no-
password ';
}}}
I added --no-password to it and set the pg_hba.conf to local all ident
and started the script with sudo -u www-data ./config/setup.php.
Otherwise this will fail with failed user authentication or no password
specified. If you want to get rid of the million password prompts as the
script pipes the sql files.
Still on the old osm2psql (but the head one seems to have the same
config).
{{{
$oDB =& getDB();
$x = $oDB->getRow('select * from planet_osm_point limit 1');
f (!$x || PEAR::isError($x)) fail('No Data');
}}}
will fail because there is not table place. osm2pgsql inserts
planet_osm_point , etc. But no place and if you insert an empty prefix
with -p "" it will still be _point.
A little later it died on me (note: still the old osm2psql) with no hstore
error. I commented the hstore insert out, because the sql file is not
present on my system and manual osm2pgsql did not complained about the
lack of it.
I tried it again with the hstore.sql from the lucid postgres .deb package
and the old osm2pgsql. Is the version important?. Here is the output. I
made changes to the setup.php as descriped above. The output is shortened.
The first line is right after using osm2pgsql which succeeded.
{{{
NOTICE: argument type hstore is only a shell
ERROR: PL/pgSQL functions cannot accept type hstore
ERROR: type wordscore[] does not exist
NOTICE: argument type hstore is only a shell
ERROR: PL/pgSQL functions cannot accept type hstore
NOTICE: argument type hstore is only a shell
ERROR: PL/pgSQL functions cannot accept type hstore
NOTICE: argument type hstore is only a shell
ERROR: PL/pgSQL functions cannot accept type hstore
ERROR: type "addressline" does not exist
ERROR: type "hstore" is only a shell
ERROR: type "addressline" does not exist
ERROR: type "place_boundingbox" does not exist
ERROR: type "place_boundingbox" does not exist
ERROR: type "place_boundingbox" does not exist
CONTEXT: compilation of PL/pgSQL function "update_place" near line 2
ERROR: syntax error at or near "$1"
LINE 1: insert into location_property_tiger (place_id, $1 , $2 , h...
^
QUERY: insert into location_property_tiger (place_id, $1 , $2 ,
housenumber, postcode, centroid) values (nextval('seq_place'), $1 , $2 ,
$3 , $4 , ST_Line_Interpolate_Point( $5 , ( $3 ::float- $6 ::float)/ $7
::float))
CONTEXT: SQL statement in PL/PgSQL function "tigger_create_interpolation"
near line 75
ERROR: syntax error at or near "$1"
LINE 1: insert into location_property_aux (place_id, $1 , parent_pl...
^
QUERY: insert into location_property_aux (place_id, $1 ,
parent_place_id, housenumber, postcode, centroid) values
(nextval('seq_place'), $1 , $2 , $3 , $4 , $5 )
CONTEXT: SQL statement in PL/PgSQL function "aux_create_property" near
line 40
NOTICE: argument type hstore is only a shell
ERROR: PL/pgSQL functions cannot accept type hstore
ERROR: type wordscore[] does not exist
NOTICE: argument type hstore is only a shell
ERROR: PL/pgSQL functions cannot accept type hstore
NOTICE: argument type hstore is only a shell
ERROR: PL/pgSQL functions cannot accept type hstore
NOTICE: argument type hstore is only a shell
ERROR: PL/pgSQL functions cannot accept type hstore
ERROR: type "addressline" does not exist
ERROR: type "hstore" is only a shell
ERROR: type "addressline" does not exist
ERROR: syntax error at or near "$1"
LINE 1: insert into location_property_tiger (place_id, $1 , $2 , h...
^
QUERY: insert into location_property_tiger (place_id, $1 , $2 ,
housenumber, postcode, centroid) values (nextval('seq_place'), $1 , $2 ,
$3 , $4 , ST_Line_Interpolate_Point( $5 , ( $3 ::float- $6 ::float)/ $7
::float))
CONTEXT: SQL statement in PL/PgSQL function "tigger_create_interpolation"
near line 75
ERROR: syntax error at or near "$1"
LINE 1: insert into location_property_aux (place_id, $1 , parent_pl...
^
QUERY: insert into location_property_aux (place_id, $1 ,
parent_place_id, housenumber, postcode, centroid) values
(nextval('seq_place'), $1 , $2 , $3 , $4 , $5 )
CONTEXT: SQL statement in PL/PgSQL function "aux_create_property" near
line 40
ERROR: DB Error: no such table
}}}
--
Ticket URL: <https://trac.openstreetmap.org/ticket/4329>
OpenStreetMap <http://www.openstreetmap.org/>
OpenStreetMap is a free editable map of the whole world
More information about the Geocoding
mailing list