Map Methods
Map Methods Quick Reference:
- fitBounds: Pans and zooms the map to contain its visible area within the specified geographical bounds. This function will also reset the map's bearing to 0 if bearing is nonzero.
mappls.fitBounds()
fitBounds = new mappls.fitBounds({
map:map,
cType:0, bounds:[[76.324462,27.024695],[77.215820,28.971891],[77.225820,28.273891]],
options:{
padding: 120,
duration:1000
}
});
- getBounds: Returns the lat/lng bounds of the current viewport.
mapObject.getBounds();
- getCenter: Returns the position displayed at the center of the map.
mapObject.getCenter();
- setCenter: Sets the map's geographical centerpoint.
mapObject.setCenter({lat: lat,lng: lng});
- getDiv
mapObject.getDiv();
- getHeading: Returns the compass heading of aerial imagery.
mapObject.getHeading();
- getZoom: Returns the current zoom level.
mapObject.getZoom();
- panBy: Changes the center of the map by the given distance in pixels. If the distance is less than both the width and height of the map, the transition will be smoothly animated.
map.panBy(array of points([x,y]));
- panTo: Changes the center of the map to the given LatLng.
map_object.panTo({lat: lat,lng: lng});
- setheading: Sets the compass heading for aerial imagery measured in degrees from cardinal direction North.
map_object.setHeading(100);
- setZoom: Sets the Zoom level of the current Map.
map_object.setZoom(12);
- setTilt: Controls the automatic switching behavior for the angle of incidence of the map. The only allowed values are 0 to 60. setTilt(0) causes the map to always use a 0° overhead view regardless of the zoom level and viewport. setTilt(60) causes the tilt angle to automatically switch to 60 whenever 60° imagery is available for the current zoom level and viewport, and switch back to 0 whenever 60° imagery is not available (this is the default behavior).
map_object.setTilt(45);
- getTilt: Returns the current angle of incidence of the map, in degrees from the viewport plane to the map plane. The result will be 0 for imagery taken directly overhead or 60 for 60° imagery.
map_object.getTilt();
- isMoving: Returns true if the map is panning, zooming, rotating, or pitching due to a camera animation or user gesture.
map.isMoving();
- isRotating: Returns true if the map is rotating due to a camera animation or user gesture.
map.isRotating();
- addLayer: A layer defines how data from a specified source will be styled. The JSON of layer to be passed in the addLayer.
map.addLayer(layer);
- removeLayer: It removes the layer of the particular layerId you want to remove.
map.removeLayer();
- getLayer: Returns the layer with the specified ID in the map's style.
map.getLayer();
- moveLayer: Moves a layer to a different z-position.
map.moveLayer();
- indoor floor: In case of indoor callback.
map.floor_show({map: mapobj,floor:any floor no});
- loaded: Returns a Boolean indicating whether the map is fully loaded.
Returns
false
if the style is not yet fully loaded, or if there has been a change to the sources or style that has not yet fully loaded.
map.loaded();
- setToken: Returns a Boolean indicating whether the token set or not.
Returns
false
if the token is not valid else return true.
map.setToken('newToken');
For any queries and support, please contact:
Email us at apisupport@mappls.com