码迷,mamicode.com
首页 > 其他好文 > 详细

MapServer中的WMS与WFS

时间:2019-01-20 14:57:30      阅读:510      评论:0      收藏:0      [点我收藏+]

标签:filesyste   drive   cti   none   password   resource   csv   partial   AMM   

# reference https://github.com/mapserver/msautotest_DEPRECATED/blob/master/wxs/wfs_ogr.map
# reference https://www.gdal.org/drv_csv.html

# WMS
# http://127.0.0.1:8010/cgi-bin/mapserv.exe?map=D:/GISSoft/ms4w/apps/mapserv-demo/HuBei.map&width=938&height=543&bbox=11974124.692393914,3344710.0734871025,13121291.612897534,4008794.9752285373&format=image/png&request=GetMap&service=WMS&styles=&transparent=true&version=1.3.0&crs=EPSG:3857&layers=station,municipality,prov,image

# WFS
# http://127.0.0.1:8010/cgi-bin/mapserv.exe?map=D:/GISSoft/ms4w/apps/mapserv-demo/HuBei.map&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=station&OUTPUTFORMAT=CSVXY&PROPERTYNAME=STCD
# http://127.0.0.1:8010/cgi-bin/mapserv.exe?map=D:/GISSoft/ms4w/apps/mapserv-demo/HuBei.map&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=station&OUTPUTFORMAT=json&PROPERTYNAME=STCD
# http://127.0.0.1:8010/cgi-bin/mapserv.exe?map=D:/GISSoft/ms4w/apps/mapserv-demo/HuBei.map&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=station&OUTPUTFORMAT=csv&PROPERTYNAME=STCD



MAP
  NAME "HBWMS"
  STATUS ON
  MAXSIZE 4096
  SIZE 800 600
  EXTENT 107.795 28.559 116.977 33.627
  UNITS METERS
  SHAPEPATH "data/HuBei"
  #IMAGECOLOR 255 255 255
  FONTSET "etc/fonts.txt"
  #http://mapserver.org/mapfile/symbology/construction.html#sym-construction
  SYMBOLSET "etc/symbols.txt"
  
  WEB
    IMAGEPATH "D:/GISSoft/ms4w/tmp/ms_tmp/"
    IMAGEURL "/ms_tmp/"
    METADATA
      "wms_title"     "HB WMS Server"  ##required
      "wms_onlineresource" "http://127.0.0.1:8010/cgi-bin/mapserv.exe?map=D:/GISSoft/ms4w/apps/mapserv-demo/HuBei.map&"   ##required
      "wms_srs"       "EPSG:4326 EPSG:3857"  ##recommended
      "ows_enable_request" "*"   ##necessary
      
      "wfs_title"          "HB WFS Server"
      "wfs_onlineresource"  "http://127.0.0.1:8010/cgi-bin/mapserv.exe?map=D:/GISSoft/ms4w/apps/mapserv-demo/HuBei.map&"
      "wfs_srs"            "EPSG:4326 EPSG:3857"
      "wfs_enable_request" "*"   ##necessary
    END
  END # Web

  PROJECTION
    "init=epsg:4326"   ##required
  END

  OUTPUTFORMAT
    NAME "png"
    DRIVER AGG/PNG
    MIMETYPE "image/png"
    IMAGEMODE RGB
    EXTENSION "png"
    FORMATOPTION "GAMMA=0.75"
    TRANSPARENT ON
  END
  
  OUTPUTFORMAT
    NAME "svg"
    DRIVER CAIRO/SVG
    MIMETYPE "image/svg+xml"
    IMAGEMODE RGB
    EXTENSION "svg"
  END

  OUTPUTFORMAT
      NAME "geojson"
      DRIVER "TEMPLATE"
      MIMETYPE "application/json; subtype=geojson"
      FORMATOPTION "FILE=../misc/rfc36.tmpl"
    END
  
  OUTPUTFORMAT
    NAME "json"
    DRIVER "OGR/GEOJSON"
    MIMETYPE "application/json; subtype=geojson"
    FORMATOPTION "FORM=SIMPLE"
    FORMATOPTION "STORAGE=stream"
  END
  
    OUTPUTFORMAT
      NAME "CSV"
      DRIVER "OGR/CSV"
      MIMETYPE "text/csv"
      FORMATOPTION "LCO:GEOMETRY=AS_WKT"
      FORMATOPTION "STORAGE=filesystem"
      FORMATOPTION "FORM=simple"
      FORMATOPTION "FILENAME=result.csv"
    END

  OUTPUTFORMAT
      NAME "CSVXY"
      DRIVER "OGR/CSV"
      MIMETYPE "text/csv"
      FORMATOPTION "LCO:GEOMETRY=AS_XY"
      FORMATOPTION "STORAGE=filesystem"
      FORMATOPTION "FORM=simple"
      FORMATOPTION "FILENAME=result.csv"
    END
  
    OUTPUTFORMAT
      NAME "CSVSTREAM"
      DRIVER "OGR/CSV"
      MIMETYPE "text/csv; streamed"
      FORMATOPTION "LCO:GEOMETRY=AS_WKT"
      FORMATOPTION "STORAGE=stream"
      FORMATOPTION "FORM=simple"
      FORMATOPTION "FILENAME=result.csv"
    END
  
  #
  # Start of layer definitions
  #
  # image
  LAYER
    NAME "image"
    DATA "L41.tif"
    TYPE RASTER
    PROJECTION
      "init=epsg:32648"   ##recommended  EPSG:32648
    END
    STATUS ON
    OFFSITE 0 0 0
    PROCESSING "RESAMPLE=BILINEAR"
    #PROCESSING "SCALE=AUTO"    
    PROCESSING "SCALE_1=5704,7855" ## 2% -- 98% statistic value
    PROCESSING "SCALE_2=6270,7991"
    PROCESSING "SCALE_3=7060,8539"
    
    #PROCESSING "SCALE_1=5642,16283"
    #PROCESSING "SCALE_2=6101,15079"
    #PROCESSING "SCALE_3=6969,14990"
    
    #PROCESSING "LUT=5704:7855,6270:7991,7060:8539"
    PROCESSING "BANDS=1,2,3"
    PROCESSING "COLOR_MATCH_THRESHOLD=3"
  END
  
  
  #province
  LAYER
    NAME "prov"
    METADATA
      "ows_title"         "prov"   ##required
      "ows_featureid"     "ENNMCD"
      "ows_geomtype"      "Polygon"
      "ows_enable_request" "*"
      "wfs_getfeature_formatlist" "json,CSVSTREAM,CSV"      
      "gml_include_items" "all"
    END
    TYPE POLYGON
    STATUS ON
    DATA "prov"
    PROJECTION
      "init=epsg:4326"   ##recommended
    END
    CLASS
      NAME "prov"
      STYLE
        #COLOR 200 255 0
        OUTLINECOLOR 255 0 0
        #LINECAP BUTT
        #PATTERN 8 12 END
        WIDTH 2.0
      END # Style
    END # Class
  END # Layer

  #municipality
  LAYER
    NAME "municipality"
    METADATA
      "ows_title"         "municipality"   ##required
      "ows_featureid"     "ENNMCD"
      "ows_geomtype"      "Polygon"
      "ows_enable_request" "*"
      "gml_default_items"  "all"
      "wfs_result_fields" "ENNMCD"
      "gml_include_items" "all"
    END
    TYPE POLYGON
    STATUS ON
    DATA "municipality"
    PROJECTION
      "init=epsg:4326"   ##recommended
    END
    CLASS
      NAME "municipality"      
      STYLE
        #COLOR 200 255 0
        OUTLINECOLOR 100 100 100
        WIDTH 0.5
        LINECAP BUTT
        PATTERN 8 12 END
      END # STYLE
    END # Class
  END # Layer

  LAYER
    NAME "station"
    METADATA
      "ows_title"         "station"   ##required
      "ows_featureid"     "stcd"
      "ows_geomtype"      "Point"
      "ows_enable_request" "*"
      "wfs_getfeature_formatlist" "json,CSVSTREAM,CSV,CSVXY"
      "gml_default_items"  "stcd"
      "gml_include_items" "all"
      "gml_optional_items" "all"
      "gml_mandatory_items" ""
    END
    TYPE POINT
    STATUS ON
    CONNECTIONTYPE OGR  
    CONNECTION "MySQL:smfs,host=127.0.0.1,user=root,password=gis,port=3306"
    DATA "SELECT stcd, stnm, geoLB FROM gis_station_hb WHERE sttp in (‘ZZ‘,‘ZQ‘,‘PP‘)"
    LABELITEM "stnm"    
    PROJECTION
      "init=epsg:4326"
      END
    CLASS
      NAME "station"
      STYLE
        SYMBOL "stationSym"
        SIZE 5
        COLOR 251 154 153
      END # Style
      LABEL
        ENCODING utf-8
        MAXSCALEDENOM 240000
        COLOR 150 75 76
        OUTLINECOLOR 255 255 255            
        TYPE truetype
        FONT "simhei"
        SIZE 12
        POSITION AUTO
        PARTIALS FALSE
      END
    END
  END # layer 
  
END # Map File

MapServer中的WMS与WFS

标签:filesyste   drive   cti   none   password   resource   csv   partial   AMM   

原文地址:https://www.cnblogs.com/gispathfinder/p/10294690.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!