2016-07-22 23 views
0

maproxy OGC WMS服务Python脚本请问可不可以使用以编程方式创建一个新的OGC WMS(1.1/1/3)服务:用于创建使用Mapnik的和的PostGIS

  1. 的Python
  2. MapProxy
  3. Mapnik的
  4. 的PostGIS/Postgres的

任何脚本/要点或样品会更然后理解。

干杯,M

回答

0

一般来说,一切都是关于配置文件。我使用python脚本为我的Mapserver/Mapproxy设置自动创建新的WMS端点,该脚本也处理我的图像。

地图服务器的配置模式:

MAP 
    NAME "WMS Server" 
    #IMAGECOLOR 255 255 255 
    IMAGETYPE custom 
    TRANSPARENT OFF 
    CONFIG "MS_ERRORFILE" [error.txt] 
    EXTENT [Extent] 
    SIZE 800 600 
    WEB 
    METADATA 
     "wms_title"   [title] 
     "wms_srs"    [epsg] 
     "wms_enable_request" "*" 
    END 
    END 
    PROJECTION 
    "init=[epsg]" 
    END 

    INCLUDE [layer list] 

    OUTPUTFORMAT 
    NAME "custom" 
    DRIVER "GDAL/GTiff" 
    MIMETYPE "image/tiff" 
    IMAGEMODE RGBA 
    TRANSPARENT ON 
    EXTENSION "tif" 
    FORMATOPTION "GAMMA=1.0" 
    END 
END 

Mapproxy配置模式:你所要做的

caches: 
    [cache folder]: 
    cache: 
     directory_layout: tms 
     type: file 
    grids: 
    - webmercator 
    image: 
     format: image/png 
     mode: RGBA 
     resampling_method: bilinear 
     encoding_options: 
     jpeg_quality: 100 
     transparent: true 
    meta_size: 
    - 2 
    - 2 
    sources: 
    - [source] 
globals: 
    cache: 
    base_dir: [base dir] 
    lock_dir: [lock dir] 
    tile_lock_dir: [tile lock dir] 
    image: 
    paletted: false 
grids: 
    webmercator: 
    base: GLOBAL_WEBMERCATOR 
    num_levels: 22 
layers: 
- name: [layer name] 
    sources: 
    - [cache] 
    title: [title] 
services: 
    demo: null 
    wms: 
    md: 
     abstract: This is a minimal MapProxy example. 
     title: MapProxy WMS Proxy 
    srs: 
    - [epsg] 
sources: 
    45_source: 
    coverage: 
     datasource: [coverage datasource] 
     srs: [epsg] 
    mapserver: 
     binary: [mapserver binary] 
     working_dir:/
    req: 
     layers: [mapserver layer name] 
     map: [mapserver mapfile] 
     transparent: true 
    supported_formats: 
    - image/tiff 
    supported_srs: 
    - [epsg] 
    type: mapserver 

一切到配置分成不同的部分,你则可以用编辑python脚本。

0

如果我们正在寻找postgres中的发布数据到WMS,启用tilecache,并使用更高级的渲染引擎(如mapnik),那么我会说缺少一个组件就是GIS服务器。

所以,如果我猜中你的要求,因为我前面提到那么这里是系统设计可能是什么:

  1. 使用的Postgres/PostGIS的数据库连接。
  2. 使用python编写您自己的服务器端程序,为动态WMS创建 服务定义文件(如果您使用的是 ,则使用MapServer)。
  3. 然后你的程序通过在mapproxy中更改 配置文件(.yaml)来处理tilecache/tile种子。
  4. 然后将WMS升级到mapnik进行渲染并显示输出结果。 就像其他人提到的那样,每个步骤都有一个模板 配置文件并做参数替换会很容易。