[OSM-dev] Populating the database

Jon Burgess jburgess777 at googlemail.com
Mon Dec 10 21:57:31 GMT 2007


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







More information about the dev mailing list