------------------------------------------------------------------------------------------------------
pertama buat file .map
MAP # tanda awal mapfile NAME "Indonesia" # EXTENT 92.59 -19.443566666 142.88 14.1298 # B1,L1; B2,L2 STATUS ON # UNITS DD # satuan derajat SIZE 520 400 # ukuran image SHAPEPATH "C:\ms4w\apps\latihan\data" IMAGECOLOR 255 255 255 # # Mulai pendefinisian layers # OUTPUTFORMAT NAME "png" EXTENSION "png" MIMETYPE "image/png" DRIVER AGG/PNG IMAGEMODE RGBA FORMATOPTION "INTERLACE=OFF" END OUTPUTFORMAT NAME 'json' DRIVER 'TEMPLATE' MIMETYPE 'application/json' FORMATOPTION 'FILE=C:/ms4w_alpha/apps/wms/mapfile/wms.js' EXTENSION "json" END PROJECTION "init=epsg:4326" END WEB TEMPLATE "C:\ms4w\apps\latihan\html\tmplb.html" IMAGEPATH "/ms4w/tmp/ms_tmp/" IMAGEURL "/ms_tmp/" METADATA 'ows_title' 'Peta wilayah Indonesia' 'ows_onlineresource' 'http://localhost/wms?' 'wms_srs' 'EPSG:4326 EPSG:3857' 'wms_abstract' 'WMS' 'wms_enable_request' '*' 'wms_encoding' 'utf-8' 'wfs_getfeature_formatlist' 'json' END END # objek web LAYER NAME "propinsi" DATA "C:\ms4w\apps\latihan\data\IDN_adm2.shp" STATUS ON TYPE POLYGON UNITS DD METADATA 'ows_title' 'Indonesia (Tematik)' 'wfs_srs' 'EPSG:4326 EPSG:3857' 'gml_include_items' 'all' ## Optional (serves all attributes for layer) 'gml_featureid' 'id' 'wfs_enable_request' '*' END CLASS NAME "Batas propinsi" STYLE COLOR 179 243 251 OUTLINECOLOR 0 0 0 END # style END # class END # Akhir definisi layer # END # Akhir mapfile
kedua template HTML
<!-- MapServer Template --> <html> <head> <title> Feature Inline mapserver</title> </head> <body> <h2> Features Inline MapServer</h2> <form method="GET" action="[program]"> <img border=1 src=[img]> </form> </body> </html>
ketiga template json
// mapserver template [resultset layer=propinsi] { "type": "FeatureCollection", "features": [ [feature trimlast=","] { "type": "Feature", "id": "[id]", "nama": "[PROVINSI]", "geometry": { "type": "MultiPolygon", "coordinates": [ { "type": "MultiPolygon", "coordinates": [[shpxy]] } ] } [/feature] ] } [/resultset]
sumber:
http://mapserver.org/output/template_output.html
http://mapserver.org/mapfile/template.html (penjelasn koordinat [shpxy] )
--------------------------------------------------------------------------------
urlnya :
localhost/cgi-bin/mapserv?map=c:/ms4w/apps/latihan/map/TestLaflet/map22.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=propinsi&OUTPUTFORMAT=json
0 komentar:
Post a Comment