New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Defines the fluent API for configuring the MapLayer settings.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class MapLayerBuilder

Inheritance: objectMapLayerBuilder

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

C#
public MapLayerBuilder(MapLayer settings)
Parameters:settingsMapLayer

Methods

Defines the attribution for the layer. Accepts valid HTML.

C#
public MapLayerBuilder Attribution(string value)
Parameters:valuestring

The value that configures the attribution.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =>
{
layers.Add()
.Type(MapLayerType.Tile)
.UrlTemplate("https://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png")
.Attribution("<a href='https://osm.org/copyright'>OpenStreetMap contributors</a>");
})
)

If set to "false", the layer will not bind to the DataSource during the initialization. In this case, the data binding will occur when the Change event of the DataSource fires. By default, the Map will bind to its DataSource.

C#
public MapLayerBuilder AutoBind(bool value)
Parameters:valuebool

The value that configures the AutoBind option.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =>
{
layers.Add()
.Type(MapLayerType.Marker)
.AutoBind(false)
.DataSource(dataSource => dataSource.Read(read => read.Action("_StoreLocations", "Map")))
);
})
)

Defines the culture for the Bing map tiles.

C#
public MapLayerBuilder Culture(string value)
Parameters:valuestring

The value that configures the culture.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =>
{
layers.Add()
.Type(MapLayerType.Bing)
.Culture("de-DE");
})
)

Defines the DataSource of the Map layer.

C#
public MapLayerBuilder DataSource(Action<MapLayerDataSourceBuilder> configurator)
Parameters:configuratorAction<MapLayerDataSourceBuilder>

The action that configures of the DataSource settings.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Marker)
.DataSource(dataSource =&gt; dataSource.Read(read =&gt; read.Action("_StoreLocations", "Map")))
);
})
)

Specifies the extent of the region covered by the layer. The layer will be hidden when the specified area is out of view. Accepts a four-element array that specifies the extent covered by this the: North-West latitude, longitude, South-East latitude, longitude. If not specified, the layer is always visible.

C#
public MapLayerBuilder Extent(params double[] value)
Parameters:valuedouble[]

The value that configures the extent option.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.Extent(new double[]{43.4350, 22.2556, 42.2265, 27.4850});
})
)

Sets the type of tiles in the Bing Map.

C#
public MapLayerBuilder ImagerySet(MapLayersImagerySet value)
Parameters:valueMapLayersImagerySet

The value that configures the type of the Bing map tiles.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add().Type(MapLayerType.Bing).ImagerySet(MapLayersImagerySet.AerialWithLabels);
})
)

Sets the API key for the layer. Currently, the option is supported only for Bing (tm) tile layers.

C#
public MapLayerBuilder Key(string value)
Parameters:valuestring

The value that configures the API key.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Bing)
.Key("API key value");
})
)

Defines the data item field that contains the marker (symbol) location. The field must be an array with two numbers - latitude and longitude in decimal degrees. It is required to define a DataSource for the layer. The option is applicable only to Marker and Bubble layers.

C#
public MapLayerBuilder LocationField(string value)
Parameters:valuestring

The value that configures the location field.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Marker)
.LocationField("LatLng")
.DataSource(dataSource =&gt; dataSource.Read(read =&gt; read.Action("_StoreLocations", "Map")))
);
})
)

Sets the maximum symbol size for Bubble layer symbols.

C#
public MapLayerBuilder MaxSize(double value)
Parameters:valuedouble

The value that configures the maximum symbol size.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Bubble)
.MaxSize(50)
.DataSource(dataSource =&gt; dataSource.Read(read =&gt; read.Action("_UrbanAreas", "Map")))
);
})
)

Sets the maximum zoom level at which to show the layer.

C#
public MapLayerBuilder MaxZoom(double value)
Parameters:valuedouble

The value that configures the maximum zoom level.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.MaxZoom(13);
})
)

Sets the minimum symbol size for the Bubble layer symbols.

C#
public MapLayerBuilder MinSize(double value)
Parameters:valuedouble

The value that configures the minimum symbol size.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Bubble)
.MinSize(10)
.DataSource(dataSource =&gt; dataSource.Read(read =&gt; read.Action("_UrbanAreas", "Map")))
);
})
)

Sets the minimum zoom level at which to show the layer.

C#
public MapLayerBuilder MinZoom(double value)
Parameters:valuedouble

The value that configures the minimum zoom level.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.MinZoom(14);
})
)

Defines the opacity for the layer.

C#
public MapLayerBuilder Opacity(double value)
Parameters:valuedouble

The value that configures the opacity.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.Opacity(1);
})
)

Sets the marker shape. The available shapes are "Pin" and "PinTarget".

C#
public MapLayerBuilder Shape(MapMarkersShape value)
Parameters:valueMapMarkersShape

The enum value that configures the shape.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add().Shape(MapMarkersShape.PinTarget);
})
)

Sets the marker shape. The available shapes are "pin" and "pinTarget".

C#
public MapLayerBuilder Shape(string name)
Parameters:namestring

The name of the marker shape.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add().Shape("pin");
})
)

Configures the default style for shapes.

C#
public MapLayerBuilder Style(Action<MapLayerStyleSettingsBuilder> configurator)
Parameters:configuratorAction<MapLayerStyleSettingsBuilder>

The action that configures the style settings.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Shape)
.Style(style =&gt; style.Fill(fill =&gt; fill.Opacity(0.7)));
})
)

Defines a list of subdomains to use for loading tiles. Alternating between different subdomains allows more requests to be executed in parallel.

C#
public MapLayerBuilder Subdomains(params string[] subdomains)
Parameters:subdomainsstring[]

The array of subdomains

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.UrlTemplate("https://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png")
.Subdomains("a", "b", "c");
})
)

Defines the Bubble layer symbol type. The possible values are "Circle" and "Square".

C#
public MapLayerBuilder Symbol(MapSymbol value)
Parameters:valueMapSymbol

The enum value that configures the symbol.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Bubble)
.Symbol(MapSymbol.Square);
})
)

Defines the Bubble layer symbol type. The possible values are "circle" and "square".

C#
public MapLayerBuilder Symbol(string symbol)
Parameters:symbolstring

The value that configures the symbol type.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Bubble)
.Symbol("square");
})
)

Sets a client-side function that will draw the Bubble layer symbol type.

C#
public MapLayerBuilder SymbolHandler(string handler)
Parameters:handlerstring

The name of the JavaScript function that will draw the symbol.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Bubble)
.SymbolHandler("getSymbolType");
})
)
&lt;script&gt;
function getSymbolType(data) {
...//return kendo.drawing.Shape
}
&lt;/script&gt;

Sets the size of the image tile in pixels.

C#
public MapLayerBuilder TileSize(double value)
Parameters:valuedouble

The value that configures the tile size.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.TileSize(200);
})
)

Defines the data item field that contains the marker title. It is required to define a DataSource for the layer.

C#
public MapLayerBuilder TitleField(string value)
Parameters:valuestring

The value that configures the title field.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Marker)
.TitleField("Name")
.DataSource(dataSource =&gt; dataSource.Read(read =&gt; read.Action("_StoreLocations", "Map")))
);
})
)

Configures the Tooltip component options for data-bound markers.

C#
public MapLayerBuilder Tooltip(Action<MapMarkerTooltipBuilder> configurator)
Parameters:configuratorAction<MapMarkerTooltipBuilder>

The action that configures the tooltip settings.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Marker)
.Tooltip(tooltip =&gt; tooltip.Content("City X"));
})
)

Defines the layer type.

C#
public MapLayerBuilder Type(MapLayerType value)
Parameters:valueMapLayerType

The enum value that configures the type of the layer.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add().Type(MapLayerType.Tile);
})
)

Defines the URL template for tile layers. The template variables are: x - X coordinate of the tile; y - Y coordinate of the tile; zoom - zoom level or subdomain - Subdomain for this tile.

C#
public MapLayerBuilder UrlTemplate(string value)
Parameters:valuestring

The value that configures the tile layer URL template.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.UrlTemplate("https://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png");
})
)

Defines the URL template for tile layers. The template variables are: x - X coordinate of the tile; y - Y coordinate of the tile; zoom - zoom level or subdomain - Subdomain for this tile.

C#
public MapLayerBuilder UrlTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the urltemplate.

Returns:

MapLayerBuilder

Defines the URL template for tile layers. The template variables are: x - X coordinate of the tile; y - Y coordinate of the tile; zoom - zoom level or subdomain - Subdomain for this tile.

C#
public MapLayerBuilder UrlTemplateHandler(string value)
Parameters:valuestring

The value that configures the tile layer URL template.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.UrlTemplateHandler("getUrlTemplate");
})
)
&lt;script&gt;
function getUrlTemplate(data) {
return `http://${data.subdomain}.tile.openstreetmap.org/${data.zoom}/${data.x}/${data.y}.png`;
}
&lt;/script&gt;

Defines the URL template for tile layers. The template variables are: x - X coordinate of the tile; y - Y coordinate of the tile; zoom - zoom level or subdomain - Subdomain for this tile.

C#
public MapLayerBuilder UrlTemplateId(string value)
Parameters:valuestring

The value that configures the tile layer URL template.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.UrlTemplateId("urlMapTemplate");
})
)
&lt;script id="urlMapTemplate" type="text/x-kendo-template"&gt;
http://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png
&lt;/script&gt;

Defines the URL template for tile layers. The template variables are: x - X coordinate of the tile; y - Y coordinate of the tile; zoom - zoom level or subdomain - Subdomain for this tile.

C#
public MapLayerBuilder UrlTemplateView(MvcHtmlString value)
Parameters:valueMvcHtmlString

The value that configures the tile layer URL template.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.UrlTemplateView(Html.Partial("MapUrlTemplateView"));
})
)

Defines the value field for Bubble layer symbols. The data item field must be a number.

C#
public MapLayerBuilder ValueField(string value)
Parameters:valuestring

The value that configures the value field.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Bubble)
.ValueField("Val")
.DataSource(dataSource =&gt; dataSource.Read(read =&gt; read.Action("_UrbanAreas", "Map")))
);
})
)

Defines the z-index for the layer. The layers are normally stacked in a declaration order (the last one is on top).

C#
public MapLayerBuilder ZIndex(double value)
Parameters:valuedouble

The value that configures the z-index of the layer.

Returns:

MapLayerBuilder

Example:
C#
@(Html.Kendo().Map()
.Name("map")
.Layers(layers =&gt;
{
layers.Add()
.Type(MapLayerType.Tile)
.ZIndex(1);
})
)