formazione:web_programming:ms_browse_map_template
MapServer browse map
Utilizzo di MapServer in modalità browse. Si tratta di un mini applicativo web-gis interamente realizzato con MapServer CGI, senza utilizzare PHP/MapScript. Utile anche al fine di debuggare il file .map.
Per far funzionare l'esempio bisogna predisporre:
- Il file .map
- Il template .html
- La reference map (file .png)
- Il file fonts.txt contenente l'elenco dei font
- I file .ttf con i font TrueType
- Gli shapefile
File .map
090_browse_decorated.map
MAP # Copyright (C) 2009 Niccolo Rigacci (niccolo@rigacci.org) # This file is licensed under the # Creative Commons Attribution-Share Alike 2.5 IT License. NAME "firenze10k" EXTENT 1681956 4847827 1685784 4850697 SIZE 800 600 SHAPEPATH "gisdata" IMAGETYPE aggpng24 FONTSET "fonts/fonts.txt" OUTPUTFORMAT NAME "aggpng24" DRIVER "AGG/PNG" IMAGEMODE RGB END WEB TEMPLATE "090_browse_decorated.html" IMAGEPATH "tmp/" IMAGEURL "/mapserver/tmp/" MINSCALE 5000 MAXSCALE 100000 END SCALEBAR INTERVALS 5 UNITS kilometers OUTLINECOLOR 0 0 0 STYLE 0 STATUS embed LABEL SIZE small COLOR 0 0 0 END END REFERENCE IMAGE "089_reference.png" SIZE 200 150 EXTENT 1681455 4846972 1687316 4851711 STATUS ON MINBOXSIZE 10 MAXBOXSIZE 200 OUTLINECOLOR 192 0 0 COLOR -1 -1 -1 END LEGEND LABEL ENCODING UTF-8 TYPE truetype FONT arial SIZE 9 END STATUS ON END LAYER NAME "curve_livello" STATUS ON TYPE LINE DATA "shape/geofesta2008/firenze10k/s_275040/275040cu" CLASS NAME "Curve di livello" COLOR 212 164 96 END END LAYER NAME "aree_idriche" STATUS ON TYPE POLYGON DATA "shape/geofesta2008/firenze10k/s_275040/275040ad" CLASS NAME "Aree idriche" COLOR 64 168 252 OUTLINECOLOR 0 0 243 END END LAYER NAME "entita_lineari" STATUS ON TYPE LINE DATA "shape/geofesta2008/firenze10k/s_275040/275040el" CLASS NAME "Entità lineari" COLOR 120 120 120 END END LAYER NAME "archi_ferroviari" STATUS ON TYPE LINE DATA "shape/geofesta2008/firenze10k/s_275040/275040af" CLASS NAME "Archi ferroviari" STYLE COLOR 0 0 0 WIDTH 3 END END END END
Template html
090_browse_decorated.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>MapServer Web Map Browse</title> </head> <body> <form name="mapserv" method="GET" action="/cgi-bin/mapserv.exe"> <!-- Hidden MapServer CGI variables --> <input type="hidden" name="map" value="[map]"> <input type="hidden" name="imgext" value="[mapext]"> <input type="hidden" name="imgxy" value="[center]"> <input type="hidden" name="zoom" value="1"> <input type="hidden" name="zoomsize" value="2"> <input type="hidden" name="mode" value="browse"> <table> <tr><td> <!-- The interactive, dynamically created map --> <input type="image" name="img" src="[img]" border="1"><br> </td><td valign="top"> <!-- Zoom controls --> <input type="radio" name="zoomdir" value="1" [zoomdir_1_check]>Zoom In<br> <input type="radio" name="zoomdir" value="0" [zoomdir_0_check]>Pan<br> <input type="radio" name="zoomdir" value="-1" [zoomdir_-1_check]>Zoom Out<br> <p> <!-- Layer controls --> <input type="checkbox" name="layer" value="curve_livello" [curve_livello_check]>Curve di livello<br> <input type="checkbox" name="layer" value="aree_idriche" [aree_idriche_check]>Aree idriche<br> <input type="checkbox" name="layer" value="entita_lineari" [entita_lineari_check]>Entità lineari<br> <input type="checkbox" name="layer" value="archi_ferroviari" [archi_ferroviari_check]>Archi ferroviari<br> <input type="submit" name="submit" value="Aggiorna"><br> <p> <!-- Reference map and legend --> <input type="image" name="ref" src="[ref]" border="1"><br> <p> <img name="legend" src="[legend]" border="1"><br> </td></tr> </table> <small>Scala 1:[scale]</small> </form> </body> </html>
Reference map
Indice dei font
fonts/fonts.txt
arial Arial.ttf arial_italic Arial_Italic.ttf arial_bold Arial_Bold.ttf arial_bold_italic Arial_Bold_Italic.ttf
formazione/web_programming/ms_browse_map_template.txt · Ultima modifica: 2010/11/13 00:39 da 127.0.0.1