ASP.NET Pack Programmer's Guide
MapView.mapLayers Property
See Also
 





Gets the collection of MapLayer-s.

Namespace: MindFusion.Mapping
Package: MapView.js

 Syntax

JavaScript  Copy Code

Object.defineProperty(MapView.prototype, "mapLayers", { value: ObservableCollection });

 Property Value

ObservableCollection. A collection of MapLayer instances.

 Example

The following code creates a new MapView using a <DIV> element called "mapview" that we've declared in the HTML code of the page. It checks if there are any MapLayer-s added to the view and if there are none - adds one:

JavaScript  Copy Code

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

if(view.mapLayers.count() == 0)
{
   // 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);
}

 See Also

MapView Members
MapView Class
MindFusion.Mapping Namespace