Map - Cross-Layer Integration

A Walking Tour in Rome

Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

This example demonstrates how to combine all three MapLayer types available in RadMap: Tile, Shape and Marker, to create a complex scenario.

The Shape and Marker layers are data-bound to RadClientDataSource controls by setting the ClientDataSourceID property of the MapLayer. In this example, the RadClientDataSource controls retrieve the data from JSON files - one for the markers and one with a GeoJSON structure for the shapes. You can download the files from the following links:

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • Scripts.js
  • styles.css
<%@ Page Language="C#"  CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Map.CrossLayerIntegration.DefaultCS" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="Styles.css" rel="stylesheet" type="text/css" />
    <script src="scripts.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
        <DataSource>
            <WebServiceDataSourceSettings ServiceType="GeoJSON">
                <Select Url="Content/routes.json" DataType="JSON" />
            </WebServiceDataSourceSettings>
        </DataSource>
    </telerik:RadClientDataSource>
    <telerik:RadClientDataSource runat="server" ID="RadClientDataSource2">
        <DataSource>
            <WebServiceDataSourceSettings ServiceType="GeoJSON">
                <Select Url="Content/markers.json" DataType="JSON" />
            </WebServiceDataSourceSettings>
        </DataSource>
    </telerik:RadClientDataSource>
    <div class="demo-container no-bg size-auto">
        <div id="radMapWrapper" class="radMapWrapper">
            <h2 class="mapTitle">A Walking Tour in Rome</h2>
            <telerik:RadMap RenderMode="Lightweight" runat="server" ID="RadMap1" Zoom="14" Height="600px" BackColor="#E6F5F8" MinZoom="2" Skin="Glow">
                <LayersCollection>
                    <telerik:MapLayer></telerik:MapLayer>
                    <telerik:MapLayer Type="Shape" ClientDataSourceID="RadClientDataSource1" Opacity="0.7">                    
                        <StyleSettings>
                            <StrokeSettings Color="#ffffff" Width="10" />
                        </StyleSettings>
                    </telerik:MapLayer>
                    <telerik:MapLayer Key="Markers"  ClientDataSourceID="RadClientDataSource2" Type="Marker" Opacity="1">
                        <TooltipSettings Position="Bottom"
                            Template="<div class='markers'>#= getImage(marker.dataItem) #<div class='title'>#= marker.dataItem.Name #</div><hr><div class='details'>Coordinates: #= marker.dataItem.location[0] + ' / ' + marker.dataItem.location[1] #</div></div>">
                        </TooltipSettings>
                    </telerik:MapLayer>
                </LayersCollection>
                <CenterSettings  Latitude="41.9015604"  Longitude="12.4754047"/>
            </telerik:RadMap>
        </div>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?