when tilestache using mapnik as provider,it can't show the map in the browser

173 Views Asked by At

this is the mapnik's xml(world_style.xml):

<Map background-color="steelblue" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="My Style">
<Rule>
  <PolygonSymbolizer fill="#f2eff9" />
  <LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="0.1" />
</Rule>
</Style>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style</StyleName>
<Datasource>
  <Parameter name="type">shape</Parameter>
  <Parameter name="file">ne_110m_admin_0_countries.shp</Parameter>
</Datasource>
</Layer>
</Map>

when i use python to render this xml,it's ok.

import mapnik
stylesheet = 'world_style.xml'
image = 'world_style.png'
m = mapnik.Map(600, 300)
mapnik.load_map(m, stylesheet)
m.zoom_all() 
mapnik.render_to_file(m, image)
print "rendered image to '%s'" % image

But now,I use tilestache to render the mapnik's style.xml,I can't see the map in the browser. The tilestache.cfg is:

{
"_comment":"tilestache.cfg包含两个顶级元素,分别实现缓存、图层的配置",
"cache":
{
 "name":"Disk",
 "path":"/tmp/tilescache",
 "umask": "0000"
},
"layers":
{
     "world":
    {
      "provider":
  {
    "name":"mapnik",
    "mapfile":"file://D:/Python27/Scripts/world_style.xml"      
   }
    }
}   
}

when I input the url:"http://localhost:8016/world/preview.html" .I will see the blue screen or the blank screen.Is it caused that I don't zoom the style.xml into the max?If it's the reason,how should I resolve?

0

There are 0 best solutions below