Binding radmap shapes layer from javascript

2 posts, 0 answers
  1. Matthew
    Matthew avatar
    7 posts
    Member since:
    Oct 2014

    Posted 24 May 2015 Link to this post

    Hi

     I'm trying to bind a RadMap to some JSON returned from an ASPX page.

     

    <script>
        function TestGetMap()
        {
            var shapeData = "";
            $.ajax({
                 type: "GET",
                url: "/Data/GetJsonTrip.aspx",
                data: "{}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    shapeData = JSON.stringify(msg);
                    var ds = new kendo.data.DataSource(shapeData);
                    var kendoMap = $telerik.$("#<%=tripMap.ClientID %>").data("kendoMap");
                    kendoMap.layers[1].dataSource = ds;
                }
            });
        }
    </script>

    I've tried setting the datasource to msg instead of the string version, tried different layers, etc.

    My map looks like this

    <telerik:RadMap runat="server" ID="tripMap">
        <LayersCollection>
            <telerik:MapLayer></telerik:MapLayer>
            <telerik:MapLayer Type="Shape"  Opacity="0.7">                   
                <StyleSettings>
                    <StrokeSettings Color="#ffffff" Width="10" />
                </StyleSettings>
            </telerik:MapLayer>
        </LayersCollection>
        <CenterSettings  Latitude="-32.962926"  Longitude="151.699727"/>
    </telerik:RadMap>

     I'm setting the first map layer in code to bing

    MapLayer mapLayer = tripMap.LayersCollection[0];
    mapLayer.Type = Telerik.Web.UI.Map.LayerType.Bing;
    mapLayer.ImagerySet = "AerialWithLabels";

    I confirmed that I'm getting back valid geojson from the aspx page.

    I'm not getting any javascript errors in the console.

    What I don't understand is: How in a click event in javascript can I set the dataource for a shapes layer of a radmap?

     

    Thanks
    Matt

     

     

     

     

     

     

     

     

     

  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 25 May 2015 Link to this post

    Hi Matthew,

    The described situation have already been discussed in a ticket thread opened to us (ID 938403). Let us continue the conversation there.

    For anyone interested on that matter. The suggestions are to use RadDataSource control for the data-binding scenario. Also, the layer to be bound, should be initially configured with a Type property set to Shape.

    Additional materials:


    Regards,

    Ianko
    Telerik
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top