MapServer Interactive map and Browse mode


This dynamic map was generated inbrowsemode. Click on the map with the mouse, you will find that the map moves.

This map uses the same Mapfile definition as the previous static maps. The difference is that the second map (the dynamically created one) relies on HTML forms for interaction. If you look at the source code on this page and the previous page, you'll notice the differences between them. This page is called an HTML template in MapServer terminology.

After clicking on the map, you will find that the URL of the page has changed. Let's parse the parameters in the URL, and note that some parameters of the URL are related to the user's click:


>>> url =
'http://webgis.pub/cgi-bin/mapserv?map=%2Fowg%2Fmfc1.map&imgext=-77.658863+-140.267559+282.943144+39.732441&imgxy=300.0+150.0&zoom=0&layer=topo&layer=states_line&mode=browse&img.x=342&img.y=119'
>>> para_str = url.replace('%2F', '/').split('?')[-1].split('&')
>>> from pprint import pprint
>>> pprint([x.split('=') for x in para_str])
[['map', '/owg/mfc1.map'],
['imgext', '-77.658863+-140.267559+282.943144+39.732441'],
['imgxy', '300.0+150.0'],
['zoom', '0'],
['layer', 'modis'],
['layer', 'states_line'],
['mode', 'browse'],
['img.x', '342'],
['img.y', '119']]