Linden Lab Official:Map API Reference

From Second Life Wiki
(Redirected from Map API Reference)
Jump to navigation Jump to search
NOTE: This is an official Second Life API provided and documented by Linden Lab. Its use is subject to the API Terms of Use.

NOTE: See the Release Notes for information on new features and known issues.

Global functions

Function Return Value Description

SLMap( HTMLElement element)

Map Creates a new map inside the specified DOM element.

gotoSLURL( x Number, y Number, Map lmap)

None Pans the map to display the specified inworld location.



This class is the Leaflet class that represents the map. For more information, see the Leaflet Map reference.


Map SLMap(HTMLElement container)

Creates a Leaflet map configured to display a map of Second Life.

The map is generated with a click event handler that calls gotoSLURL() to display a popup with a “Visit this location” link.

Useful Methods

For other methods, see the Leaflet Map methods reference.

Method Return Value Description

setView( LatLng center, Number zoom)

Map Centers and zooms the map to the specified location. Argument zoom must be an integer value. Note that a LatLng is a (Y, X) coordinate, so coordinates passed as center should be in (Y, X) order.

Utility URLs

These map helper functions are available from the caps server. The JSON-like results return text that Javascript could eval(), but scripts coming from outside should parse them the "hard" way for safety.

Region name from global coordinates

  • var is arbitrary, for output formatting.
  • grid_x is the region's global x coordinate as an integer.
  • grid_y is the region's global y coordinate as an integer.

var region='Da Boom';

Global coordinates from region name

  • var is arbitrary, for output formatting.
  • sim_name is a region on the Second Life map.

var coords = {'x' : 1000, 'y' : 1000 };