msCross: AJAX (WEB 2.0) WEB GIS Client
Download
Example 1 (Main + reference map)
Here, an easy example to work out the msCross interface:
<html>
<head>
<title>msCross Sample Test</title>
<script src="mscross.js"
type="text/javascript"></script>
</head>
<body>
<div style="width: 460px; height: 400px;"
id="map_tag"></div>
<div style="width: 190px; height: 400px;"
id="ref_tag"></div>
<script type="text/javascript">
//<![CDATA[
myMap1 = new msMap(
document.getElementById('map_tag') );
myMap1.setCgi( '/cgi-bin/mapserv' );
myMap1.setFullExtent( Xmin,
Xmax, Ymin );
myMap1.setMapFile(
'/home/user/map_files/mymapfile.map' );
myMap1.setLayers( 'layer1
layer2 layer3' );
myMap2 = new msMap(
document.getElementById('ref_tag') );
myMap2.setCgi( '/cgi-bin/mapserv' );
myMap2.setActionNone();
myMap2.setFullExtent( Xmin,
Xmax, Ymin );
myMap2.setMapFile(
'/home/user/map_files/mymapfile.map' );
myMap2.setLayers( 'layer4
layer5' );
myMap1.setReferenceMap(myMap2);
myMap1.redraw(); myMap2.redraw();
//]]>
</script>
</body>
</html>
In red color users must input
their own settings.
Example 2 (Map + WFS Point Overlay Layer)
<html>
<head>
<title>msCross Sample Test</title>
<script src="mscross.js"
type="text/javascript"></script>
</head>
<body>
<div style="width: 460px; height: 400px;"
id="map_tag"></div>
<script type="text/javascript">
//<![CDATA[
myMap1 = new msMap(
document.getElementById('map_tag') );
myMap1.setCgi( '/cgi-bin/mapserv' );
myMap1.setFullExtent( Xmin,
Xmax, Ymin );
myMap1.setMapFile(
'/home/user/map_files/mymapfile.map' );
myMap1.setLayers( 'layer1
layer2 layer3' );
myMap1.setBorder(50);
a =
'http://www.google.com/mapfiles/markerG.png';
b =
'http://www.google.com/mapfiles/shadow50.png';
myIcon = new msIcon(a, b, 1,
2);
mySkin = null;
myMap1.loadPointsOverlayWFS('http://wms_server.com/wms',
'layer4 layer5',
myIcon,
mySkin);
myMap1.redraw();
//]]>
</script>
</body>
</html>
In red color users
must input
their own settings.
Description of the API interface (incomplete)
Instance the msMap object
var myMap = new msMap(DivTag [, ControlType]);
ControlType: is a costant string that define toolbar position
- standard, standardRight
- standardLeft
- standardUp
- standardCornerLeft
- standardCornerRigh
Set the MapServer CGI path
msMap.setCgi(url);
Set the MapServer MapFile
msMap.setMapFile(path);
Set the extent of the map
msMap.setFullExtent(Xmin, Xmax, Ymin);
Chose the layers list to be visualised
msMap.setLayers(string);
Set the size of hidden buffer around the map (in pixel, invisible zone)
msMap.setBorder(integer);
Load a point layer overlay via WFS protocol (the data are in GML (XML)
format). Insieme ai dati geografici vengono anche
scambiati gli attributi alfanumerici, visualizzabili tramite click del mouse
sul punto
msMap.loadPointsOverlayWFS(server url, layers, msIcon, msInfoSkin);
Set borders of the map in pixel (no visible zone)
msMap.setBorder(integer);
xxx
msMap.setActionZoombox()
xxx
msMap.setActionPan()
xxx
xxx msMap.setActionZoomIn()
xxx
xxx msMap.setActionZoomOut()
To disable the Toolbar
msMap.setActionNone();
To redraw the map
msMap.redraw();
To set the function mode
msMap.setMode(Mode);
Mode: Mapserver "mode" parameter
- map
- legend
To set a reference map(the box has the same extent of your map)
msMap.setReferenceMap(msMap);
To link two objects in the msMap
msMap.attachMap(msMap);
To change the icons in the Toolbar
msMap.setIcon(id, url);
To set additional parameters in the CGI MapServer
msMap.setArgs(string);
Set image format in WMS protocol
msMap.setWmsImageFormat(string);
Set the Spatial Reference System (projection) for WMS requests
msMap.setWmsProjection(string);
Activate debug mode, click to Degub link to get requested url
msMap.debug();
Relating projects
- WMS-MAP
- quickWMS
- ka-Map
|