Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are various different ways of using iShare to integrate maps within a website. Have a look at the following examples:

...

Again, zoom_value is the backwards compatible width of the map in metres. If any of the parameters are not passed then all three are ignored (note this is different to the jQuery method) 


Code Block
titleURL Example
?StartEasting=easting_value&StartNorthing=northing_value &StartZoom=zoom_value


...

Code Block
titleJavaScript Example
window.astun.mapWrapper.searchISMLayer( layer, field, value, function( response ) {
 window.astun.mapWrapper.showResults( response );
} );

...


Anchor
setscale
setscale
Set the Scale for the Map

The previous methods for a point can be used provided you know the width in metres you want to zoom to.

JavaScript

You can zoom to a scale or zoom level using the OpenLayer map object window.astun.mapWrapper.map and manipulate it directly.

 


Code Block
titleJavaScript - Zoom to Scale
astun.mapWrapper.map.zoomToScale()

and

Code Block
titleJavaScript Zoom To
astun.mapWrapper.map.zoomTo()
See full list of methods at: http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Map-js.htmldocs/index/General.html.
Note

This method of access to the map is deprecated and may be removed in future versions - but only once we provide alternative methods of getting to the map object.


Anchor
addlayers
addlayers
Add or Remove Layers from the Map

A full list of available layers can be found in your map configuration in iShare Studio; the layers are under Map Sources. The layer names are case-sensitive.

JQuery

Code Block
titleJQuery Example
jQuery('#atMap').trigger('showLayer',[layer_name]) jQuery('#atMap').trigger('hideLayer',[layer_name]) jQuery('#atMap').trigger('toggleLayer',[layer_name])

Only one layer can be specified at a time.

JavaScript

Code Block
titleJavaScript Example
window.astun.mapWrapper.addISMLayer(layer_name); window.astun.mapWrapper.removeISMLayer(layer_name); window.astun.mapWrapper.setISMLayers(layer_names);

layer_names in the last method are a comma separated list and replace the existing set of layers on the map. You can get the current set of layers too:

Code Block
titleGet Current set of Layers
window.astun.mapWrapper.getISMLayers();

URL

Code Block
titleURL Example
?l=layer_names

or

Code Block
titleURL Example
?layers=layer_names

These are equivalent, layer_names are a comma separated list.