Skip to main content

Map Methods

Live Demo

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.


    fitBounds = new mappls.fitBounds({
cType:0, bounds:[[76.324462,27.024695],[77.215820,28.971891],[77.225820,28.273891]],
padding: 120,
  • getBounds: Returns the lat/lng bounds of the current viewport.
  • getCenter: Returns the position displayed at the center of the map.
  • setCenter: Sets the map's geographical centerpoint.
    mapObject.setCenter({lat: lat,lng: lng});
  • getDiv
  • getHeading: Returns the compass heading of aerial imagery.
  • getZoom: Returns the current zoom level.
  • 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.
  • setZoom: Sets the Zoom level of the current Map.
  • 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).
  • 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.
  • isMoving: Returns true if the map is panning, zooming, rotating, or pitching due to a camera animation or user gesture.
  • isRotating: Returns true if the map is rotating due to a camera animation or user gesture.
  • addLayer: A layer defines how data from a specified source will be styled. The JSON of layer to be passed in the addLayer.
  • removeLayer: It removes the layer of the particular layerId you want to remove.
  • getLayer: Returns the layer with the specified ID in the map's style.
  • moveLayer: Moves a layer to a different z-position.
  • 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.
  • setToken: Returns a Boolean indicating whether the token set or not. Returns false if the token is not valid else return true.

For any queries and support, please contact:

Email us at