我已成功在我的服务器中安装了TileStache。 现在我有一个geojson文件,并希望通过TileStache提供它。 我是TileStache的新手,我无法找到如何在TileStache中设置Geojson的明确解释。我能找到的最佳解释是here,但它使用shp文件作为数据源。
我想知道如何使用Geojson作为数据源来设置它。
修改
我尝试在配置文件中添加tes
图层,因此我的配置文件如下所示:
{
"cache":
{
"name": "Test",
"path": "/tmp/stache",
"umask": "0000"
},
"layers":
{
"osm":
{
"provider": {"name": "proxy", "provider": "OPENSTREETMAP"},
"png options": {"palette": "http://tilestache.org/example-palette-openstreetmap-mapnik.act"}
},
"example":
{
"provider": {"name": "mapnik", "mapfile": "examples/style.xml"},
"projection": "spherical mercator"
},
"tes":{
"provider": {
"name": "vector", "driver": "GeoJSON",
"parameters": {"file": "tes.geojson"},
"properties": []
}
}
}
}
当我尝试使用tilestache-server.py -c /etc/TileStache/tilestache.cfg
运行时,它会给出如下错误:
Error loading Tilestache config:
Traceback (most recent call last):
File "/usr/local/bin/tilestache-server.py", line 5, in <module>
pkg_resources.run_script('TileStache==1.50.1', 'tilestache-server.py')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/TileStache-1.50.1-py2.7.egg/EGG-INFO/scripts/tilestache-server.py", line 55, in <module>
app = TileStache.WSGITileServer(config=options.file, autoreload=True)
File "/usr/local/lib/python2.7/dist-packages/TileStache-1.50.1-py2.7.egg/TileStache/__init__.py", line 342, in __init__
self.config = parseConfigfile(config)
File "/usr/local/lib/python2.7/dist-packages/TileStache-1.50.1-py2.7.egg/TileStache/__init__.py", line 107, in parseConfigfile
return Config.buildConfiguration(config_dict, dirpath)
File "/usr/local/lib/python2.7/dist-packages/TileStache-1.50.1-py2.7.egg/TileStache/Config.py", line 218, in buildConfiguration
config.layers[name] = _parseConfigfileLayer(layer_dict, config, dirpath)
File "/usr/local/lib/python2.7/dist-packages/TileStache-1.50.1-py2.7.egg/TileStache/Config.py", line 448, in _parseConfigfileLayer
_class = Providers.getProviderByName(provider_dict['name'])
File "/usr/local/lib/python2.7/dist-packages/TileStache-1.50.1-py2.7.egg/TileStache/Providers.py", line 122, in getProviderByName
from . import Vector
File "/usr/local/lib/python2.7/dist-packages/TileStache-1.50.1-py2.7.egg/TileStache/Vector/__init__.py", line 164, in <module>
from osgeo import ogr, osr
ImportError: No module named osgeo
我无法弄清楚出了什么问题。
答案 0 :(得分:1)
ImportError:没有名为osgeo的模块
您错过了GDAL library。安装起来非常棘手,我使用PPA ppa:ubuntugis/ubuntugis-unstable
在Ubuntu 14.04上工作,在GIS Stackexchange上阅读this post中的说明。