[OSM-dev] Mapnik doesn't find geometry columns

Hans Musil hansm at wikivoyage.org
Tue Jul 7 17:25:05 BST 2009


Sure, exactly this was the problem! That's why I wanted to know how to 
tell Mapnik what the geometry column is. It didn't find it by itself and 
just left it blank in the SQL query.

Hans

Milo van der Linden wrote:
> Shouldn't the syntax be: select asbinary(way) because I think asbinary()
> will return nothing.
>
> ?
>
>
> Hans Musil wrote:
>   
>> No, this not the problem.
>>
>> osm=> SELECT * FROM spatial_ref_sys WHERE srid = 900913;
>>
>> shows the corresponding row. Anyhow, I could not imagine that a
>> missing spatial_ref_sys entry would cause mapnik to forget the name of
>> the geometry column.
>>
>> I also have tried a
>>
>> <Parameter name="geometry_field">way</Parameter>
>>
>> inside each Layer tag in osm.xml, but this seems not yet to work with
>> version 0.5.1.
>>
>> Is there a way to run mapnik in debug mode in order to see what
>> queries it sends to PostgreSQL? I wonder if it really does the SELECT
>> on the geometry_columns tabel.
>>
>> Hans
>>
>> Milo van der Linden wrote:
>>     
>>> The table Geometry_columns tells mapnik that it has to use way as the
>>> geometry_column. The only thing that might be wrong is that you do not
>>> have the 900913 projection set up in the spatial_ref_sys table. This
>>> means that features cannot get rendered by mapnik because it does not
>>> know how to project them.
>>>
>>>
>>> Hans Musil wrote:
>>>  
>>>       
>>>> I'm running mapnik version 0.5.1 as shipped with Debian Lenny.
>>>> Following
>>>> http://wiki.openstreetmap.org/wiki/Mapnik/Installation#For_Debian_Lenny_or_Sid,
>>>> this should be ready to work.
>>>>
>>>> Also, I have downloaded the latest SVN revision from
>>>> http://svn.openstreetmap.org/applications/rendering/mapnik and done
>>>> the steps described on
>>>> http://wiki.openstreetmap.org/wiki/Mapnik#Rendering_with_Mapnik.
>>>>
>>>> I have imported the extract for the UK
>>>> (http://nick.dev.openstreetmap.org/downloads/planet/uk-090701.osm.bz2)
>>>> with osm2pgsql. No problem with the import and everything looks good
>>>> in the PostGIS db. The following tables are populated with
>>>> reasonably looking data:
>>>>
>>>>  Schema |        Name        | Type  |  Owner
>>>> --------------+------------------------+----------+------------
>>>>  public | planet_osm_line    | table | hansm
>>>>  public | planet_osm_nodes   | table | hansm
>>>>  public | planet_osm_point   | table | hansm
>>>>  public | planet_osm_polygon | table | hansm
>>>>  public | planet_osm_rels    | table | hansm
>>>>  public | planet_osm_roads   | table | hansm
>>>>  public | planet_osm_ways    | table | hansm
>>>>
>>>>
>>>> osm=> SELECT * FROM geometry_columns;
>>>>  f_table_catalog | f_table_schema |    f_table_name    |
>>>> f_geometry_column | coord_dimension |  srid  |    type
>>>> -----------------+----------------+--------------------+-------------------+-----------------+--------+------------
>>>>
>>>>                  | public         | planet_osm_point   |
>>>> way               |               2 | 900913 | POINT
>>>>                  | public         | planet_osm_line    |
>>>> way               |               2 | 900913 | LINESTRING
>>>>                  | public         | planet_osm_polygon |
>>>> way               |               2 | 900913 | POLYGON
>>>>                  | public         | planet_osm_roads   |
>>>> way               |               2 | 900913 | LINESTRING
>>>>
>>>>
>>>> When trying to render tiles with generate_tiles, I only get PNG
>>>> files with waterbodies and land, but not the actual OSM features.
>>>> This is independend from the zoom level.
>>>>
>>>> When checking my PostgreSQL log files, I see malformed SQL queries
>>>> issued by mapnik. Obviously, it does not know about the tables'
>>>> geometry columns:
>>>>
>>>> select asbinary() as geom,"highway","railway" from
>>>>               (select way,highway,railway,
>>>>                case when tunnel in ('yes','true','1') then
>>>> 'yes'::text else tunnel end as tunnel
>>>>                from planet_osm_roads
>>>>                where highway is not null
>>>>                   or railway is not null
>>>>                order by z_order
>>>>               ) as roads
>>>>                where  && setSRID('BOX3D(-19724422.27493316
>>>> 7200979.560689881,-18472078.00350883
>>>> 8453323.832114212)'::box3d,537534573)
>>>>
>>>> Now my big question: How do I explain mapnik that it has to use
>>>> "way" as geometry column?
>>>>
>>>> Thanks for helping
>>>>
>>>> Hans
>>>>
>>>> _______________________________________________
>>>> dev mailing list
>>>> dev at openstreetmap.org
>>>> http://lists.openstreetmap.org/listinfo/dev
>>>>
>>>>       
>>>>         
>>>   
>>>       
>>     
>
>   





More information about the dev mailing list