ASP.NET Pack Programmer's Guide
MapView.load Method
See Also
 





Loads all layers.

Namespace: MindFusion.Mapping
Package: MapView.js

 Syntax

JavaScript  Copy Code

function load (center, [zoomLevel])

 Parameters

center

LatLong. A LatLong instance representing the geographical center of the map.

zoomLevel
Optional.

Number. The zoom level of the map.

 Remarks

The load method should always be called after you've finished customizing the map. It reads the data for all layers.

 Example

The following example creates a data array with locations and a new MapView using a <DIV> element called "mapview" that we've declared in the HTML code of the page. Then it adds a MapLayer with map tiles and loads the first location with a zoom factor of 8:

JavaScript  Copy Code

// create a list with possible locations
var dataList = [
 { location: new m.LatLong(-22.951916, -43.210487), text: "Rio de Janeiro, Brazil" },
 { location: new m.LatLong(41.89021, 12.492231), text: "Rome, Italy" },
 { location: new m.LatLong(29.979235, 31.134202), text: "Giza, Egypt" },
 { location: new m.LatLong(40.6892746, -74.04455589999998), text: "New York, USA" },
 { location: new m.LatLong(-33.856536, 151.214996), text: "Sydney, Australia"}]


// create a new instance of the mapView
var view = new m.MapView(document.getElementById("mapView"));
view.theme = "light";

// create a map layer
var l = new m.MapLayer("Map");
l.urlTemplate = "http://d.tile.stamen.com/terrain/{z}/{x}/{y}.png";
l.attribution = 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.';
view.layers.add(l);

// load the map
view.load(dataList[0].location, 8);

 See Also

MapView Members
MapView Class
MindFusion.Mapping Namespace