2015-08-14 49 views
1

我已經在我的服務器中成功安裝了TileStache。 現在我有一個geojson文件,並希望通過TileStache提供它。 我是TileStache的新手,我無法找到如何在TileStache中設置Geojson的清晰說明。我能找到的最佳解釋是here,但它使用shp文件作爲數據源。如何在TileStache中將Geojson設置爲數據源

我想知道如何使用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 

我無法弄清楚什麼是錯的。

回答

1

ImportError: No module named osgeo

您缺少GDAL library。安裝起來可能非常棘手,我使用PPA ppa:ubuntugis/ubuntugis-unstable在Ubuntu 14.04上運行,在GIS Stackexchange上閱讀this post中的說明。

相關問題