OpenSpace Ordnance Survey Mapping API JavaScript Library Version 0.7.2 OpenSpace Map |
OpenSpace.MapThis class sets up a map window containing an Open Space data layer, a vector layer and a marker layer. InheritsExampleThe following example shows how to add a default map and set the map center: var osMap; Summary
OpenSpace.MapConstructor for a new OpenSpace.Map instance. Parameters
Examples// create a map with default options in an element with the id "map1" createMarker
A convenience method to create a marker, optionally with an associated popup info window. The marker is added to the default markers layer on the map. Parameters
ReturnsExample// Add a default marker // Add a marker with custom icon and a popup info window removeMarker
A convenience method to remove a marker. The marker is removed from the default markers layer on the map. Parameters
addFeatures
A convenience method to add features to the map. The features are added to the default vector layer on the map. Parameters
removeFeatures
A convenience method to remove features from the map. The features are removed from the default vector layer on the map. Parameters
openInfoWindow
A convenience method to open a popup info window. Parameters
setCenter
Parameters
getMapPointFromViewPortPx
Gets the coordinates of a point on the map given the position of a point on the map window Parameters
Returns{OpenSpace.MapPoint} An OpenSpace.MapPoint which is the passed-in view port OpenLayers.Pixel, translated into British National Grid by the current base layer. getViewPortPxFromMapPoint
Parameters
Returns{OpenLayers.Pixel} An OpenLayers.Pixel which is the passed-in OpenSpace.MapPoint, translated into view port pixels by the current base layer. getMapPointFromPixel
Parameters
Returns{OpenSpace.MapPoint} An OpenSpace.MapPoint corresponding to the given OpenLayers.Pixel, translated into British National Grid by the current base layer getPixelFromMapPoint
Parameters
Returns{OpenLayers.Pixel} An OpenLayers.Pixel corresponding to the OpenSpace.MapPoint translated into view port pixels by the current base layer. getLayerPxFromMapPoint
Parameters
Returns{OpenLayers.Pixel} An OpenLayers.Pixel which is the passed-in OpenSpace.MapPoint, translated into layer pixels by the current base layer |
A convenience method to return a reference to the default marker layer.
getMarkerLayer: function()
A convenience method to return a reference to the default vector layer.
getVectorLayer: function()
A convenience method to return a reference to the info window.
getInfoWindow: function()
A convenience method to create a marker, optionally with an associated popup info window.
createMarker: function( pos, icon, html, size )
A convenience method to remove a marker.
removeMarker: function( marker )
A convenience method to remove all markers.
clearMarkers: function()
A convenience method to add features to the map.
addFeatures: function( features )
A convenience method to remove features from the map.
removeFeatures: function( features )
A convenience method to remove all features from the map.
destroyFeatures: function()
A convenience method to open a popup info window.
openInfoWindow: function( icon, pos, html, size )
A convenience method to close a popup info window.
closeInfoWindow: function()
{OpenSpace.MapPoint}
getCenter: function ()
setCenter: function ( mapPoint, zoom, dragging, forceZoomChange )
This function should be called by any external code which dynamically changes the size of the map div (because mozilla wont let us catch the “onresize” for an element)
updateSize: function()
Gets the coordinates of a point on the map given the position of a point on the map window
getMapPointFromViewPortPx: function ( viewPortPx )
getViewPortPxFromMapPoint: function ( mapPoint )
getMapPointFromPixel: function ( px )
getPixelFromMapPoint: function ( mapPoint )
getMapPointFromLayerPx: function ( px )
getLayerPxFromMapPoint: function ( mapPoint )