[OSM-dev] Populating the database

Diarmuid Wrenne dwrenne at yahoo.com
Mon Dec 10 23:53:04 GMT 2007


After trying to find teh python wrappers on the server i came across this

root at domU-12-31-38-00-41-98:/usr/lib/python2.4/site-packages/mapnik# cd /usr/local/lib/mapnik
root at domU-12-31-38-00-41-98:/usr/local/lib/mapnik# ls
fonts  input
root at domU-12-31-38-00-41-98:/usr/local/lib/mapnik# cd input/
root at domU-12-31-38-00-41-98:/usr/local/lib/mapnik/input# ls
raster.so  shape.so
root at domU-12-31-38-00-41-98:/usr/local/lib/mapnik/input#

While in __init.py__ in the   /usr/lib/python2.4/site-packages/mapnik/ __init__.py it says that 

def Shapefile(**keywords):
  keywords['type'] = 'shape'
  return CreateDatasource(keywords)

def PostGIS(**keywords):
  keywords['type'] = 'postgis'
  return CreateDatasource(keywords)

def Raster(**keywords):
  keywords['type'] = 'raster'
  return CreateDatasource(keywords)


Notice that postgis is mentioned there but missing above. I can;t remember now whether postgress etc was installed when I compile mapnik. I better have a look again.

Cheers

Diarmuid
 
NOTICE: The information contained in this e-mail message and any attached files may be confidential information. If you are not the intended recipient, any use, disclosure or copying of this e-mail and any attached files is unauthorised. If you have received this e-mail in error, please notify me immediately by reply e-mail and delete the original.

----- Original Message ----
From: Diarmuid Wrenne <dwrenne at yahoo.com>
To: Jon Burgess <jburgess777 at googlemail.com>; kleptog at gmail.com
Cc: dev at openstreetmap.org
Sent: Monday, December 10, 2007 11:25:17 PM
Subject: Re: [OSM-dev] Populating the database


Thanks for the replies,

Mapnik is working as generate_image works fine. It is definitely database access that is the problem. 


gis=# select count(*) from planet_osm_point;
 count
-------
 20753
(1 row)

gis=# select count(*) from planet_osm_roads;
 count
-------
 31929
(1 row)



I have tried to run as root and as su- postgres  and the same each time.

I changed the port and that had no effect

I ran postmaster with debug 5  and run never saw a connection. I ran psql and saw loads of connection info in the postmaster log. Is there a password field in osm.xml schema?

Is there a remote postgresql I could use to check if the maps work at least.

BTW, I just found the form. Should I use
 that instead of this list?

Thanks

Diarmuid



 
NOTICE: The information contained in this e-mail message and any attached files may be confidential information. If you are not the intended recipient, any use, disclosure or copying of this e-mail and any attached files is unauthorised. If you have received this e-mail in error, please notify me immediately by reply e-mail and delete the original.

----- Original Message ----
From: Jon Burgess <jburgess777 at googlemail.com>
To: Diarmuid Wrenne <dwrenne at yahoo.com>
Cc: dev at openstreetmap.org
Sent: Monday, December 10, 2007 9:57:31 PM
Subject: Re: [OSM-dev] Populating the database



On Mon, 2007-12-10 at 12:38 -0800, Diarmuid Wrenne wrote:
> Hi,
> 
> I am having problems populating the database. I have downloaded the
> data from  http://download.geofabrik.de/osm/europe/   and extracted
> it. I have created a postgresql database and created the schema as
 per
> http://www.passback.org.uk/maps/fedora.shtml
> 
> I have modified the original big osm.xml to reflect the database
> setup.
> 
>   <Layer name="text" status="on" srs="+proj=merc +datum=WGS84  +k=1.0
> +units=m +over +no_defs">
>     <StyleName>text</StyleName>
>     <Datasource>
>       <Parameter name="type">postgis</Parameter>
>       <Parameter name="host">localhost</Parameter>
>       <Parameter name="port">5433</Parameter>     
>       <Parameter name="user">apache</Parameter>
>       <Parameter name="dbname">gis</Parameter>
>       <Parameter
 name="table">planet_osm_point</Parameter>
>       <Parameter name="estimate_extent">true</Parameter>
>     </Datasource>
>   </Layer>
> 
> I am
> running
 /mnt/svn.openstreetmap.org/applications/utils/export/osm2pgsql/osm2pgsql -c -v /mnt/spatialdata/france.osm and getting
> 
> 
> Using projection SRS 3395 (WGS84 Mercator)
> Setting up table: planet_osm_point
> Setting up table: planet_osm_line
> Setting up table: planet_osm_polygon
> Setting up table: planet_osm_roads
> 
> Reading in file: /mnt/spatialdata/france.osm
> Processing: Node(1012k) Way(97k) Relation(0k)
> Writing rel(0k)
> 
> Writing way(8k)
> 
> Node stats: total(1012818), max(157452867)
> Way stats: total(97612), max(15739751)
> Relation stats: total(97), max(3506)
> 
>  echo 'select count(*) from planet_osm_point;' | psql gis
>  count
> -------
>  20753
> (1 row)
> 
> However when I run Generate_tiles.py I get no road data.
 
> 
> Any ideas

Unfortunately debugging why Mapnik fails to render data can be tricky
 at
the best of times since it rarely produces useful error messages (it
just tends to carry on and ignore the data source).


>       <Parameter name="type">postgis</Parameter>
>       <Parameter name="host">localhost</Parameter>
>       <Parameter name="port">5433</Parameter>     
>       <Parameter name="user">apache</Parameter>
> 

It is quite likely that your Postgres setup will not allow a connection
via localhost with no password. On Fedora you can typically avoid this
by setting:

<Parameter name="host">/tmp</Parameter>

This will force the client to connect via a Unix domain socket instead
of an IP socket and will typically avoid needing to specify any user
name, password or port number. 

The equivalent data source in my local osm.xml file
 has simply...

  <Layer name="text" status="on" srs="+proj=merc +datum=WGS84  +k=1.0
 +units=m +over +no_defs">
    <StyleName>text</StyleName>
    <Datasource>
      <Parameter name="type">postgis</Parameter>
      <Parameter name="host">/tmp</Parameter>
      <Parameter name="dbname">gis</Parameter>
      <Parameter name="table">planet_osm_point</Parameter>
      <Parameter name="estimate_extent">true</Parameter>
    </Datasource>
  </Layer>

Other distros setup the Postgres unix socket in other locations
(/var/run/postgresql is used by Debian/Ubuntu).

You might also find that changing the estimate_extent parameter to
 false
is needed (this depends on you mapnik version and the data you have
loaded):

      <Parameter name="estimate_extent">false</Parameter>

If all that fails, try recompiling mapnik with DEBUG=1 set. Then when
you run the script you will get lots of debug information about what it
is doing on stdout/stderr.

    Jon









      Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.





      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20071210/637e53c3/attachment.html>


More information about the dev mailing list