Hello everyone
After working a while with tilestache and searching a bit over the net, I couldn't find a solution to my problem. I am using a pgsql/postgis db imported from OSM with osm2pgsql with Sperical Mercator projection. I want to create 2 layers, one from the osm_planet_line with mapnik and png tiles, and one from osm_planet_point with geojson tiles. I have successfully connected the db with tilestache and created the layers, I have set the projection to spherical Mercator, but there seems to be a mismatch between the layers. I centered the map on a specific point (expressed in latitude and longitude) and compared the result that was produced by mapnik with the one from the official OSM and they match. So I believe I have done something wrong with the configuration of the vector layer.
Here is my cfg:
{
"cache": {
"name": "Disk",
"path": "/tmp/tiles/",
"dirs": "portable",
"gzip": [],
"logging": "debug"
},
"layers": {
"osm_point":
{
"provider": {"name": "vector", "driver": "postgis",
"parameters": {"dbname": "gis", "user": "postgres", "password": "12345",
"table": "planet_osm_point"}},
"projection": "spherical mercator",
"allowed origin": "*",
"bounds": { "low":9 }
},
"osm_ori_line":
{
"provider": {"name": "mapnik", "mapfile": "/home/ubuntu/mapnik2.xml"}
}
}
}
In case you need it, here is the mapnik configuration:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map [
<!ENTITY % entities SYSTEM "/home/ubuntu/mapnik/inc/entities.xml.inc">
%entities;
]>
<Map background-color="#b5d0d0"
srs="&srs900913;" minimum-version="2.0.0">
<Style
name="MyStyle">
<Rule>
<LineSymbolizer stroke="rgb(10%,10%,10%)" stroke-width="0.2" />
</Rule>
</Style>
<Layer name="osm_ori_line"
status="on" srs="&srs900913;">
<StyleName>MyStyle</StyleName>
<Datasource>
<Parameter name="type">postgis</Parameter>
<Parameter name="host">localhost</Parameter>
<Parameter name="dbname">gis</Parameter>
<Parameter name="user">postgres</Parameter>
<Parameter name="password">12345</Parameter>
<Parameter
name="table">
(select way
from planet_osm_polygon
UNION
select way
from planet_osm_roads
) as MyStyle
</Parameter>
&datasource-settings;
</Datasource>
</Layer>
</Map>
Any ideas would be a great help.
Thank you for your time
Th.D.
The srs that i am using is dedined in /home/ubuntu/mapnik/inc/entities.xml.inc:<!ENTITY srs900913 "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over"> <!ENTITY srsmercator "+proj=merc +datum=WGS84 +over"> <!ENTITY srs4326 "+init=epsg:4326"> <!ENTITY maxscale_zoom0 "<MaxScaleDenominator>250000000000</MaxScaleDenominator>"> .............. <!ENTITY minscale_zoom18 "">
Hi Mike
Thanks for the fast responses
I used the site and firebug to test the tiles with their data. I centered to a point and got the tile id that was at that point. I then checked with firebug to see what tiles are requested. Both layers (vector and mapnik) request the same set of tiles, with the same IDs. The mapnik layer centers at the same point, as the link you showed me did. I checked the tile with the same ID from the vector layer and it has different data in it.
I also checked the code from Tilestache to see where the rule for the spherical projection exists. I think I spotted it under Tilestache/Geography.py. I compared the rules between them and it seems that the mapnik rule is missing the +wktext option. I added it, cleared the cache but nothing changed. I also updated from 1.41 to 1.44 still no luck…
Thanks again
T.D.