这是mapnik的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>
当我使用python渲染这个xml时,它没问题。
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
但是现在,我使用tilestache来渲染mapnik的style.xml,我无法在浏览器中看到地图。 tilestache.cfg是:
{
"_comment":"tilestache.cfg包含两个顶级元素,分别实现缓存、图层的配置",
"cache":
{
"name":"Disk",
"path":"/tmp/tilescache",
"umask": "0000"
},
"layers":
{
"world":
{
"provider":
{
"name":"mapnik",
"mapfile":"file://D:/Python27/Scripts/world_style.xml"
}
}
}
}
当我输入网址时:&#34; http://localhost:8016/world/preview.html&#34; 。我会看到蓝屏或空白屏幕。是不是因为我没有将style.xml缩放到最大?如果是原因,我应该如何解决?