map shared datasource

4 posts, 0 answers
  1. Joe
    Joe avatar
    2 posts
    Member since:
    Jul 2013

    Posted 30 Sep 2014 Link to this post

    Does some one have a  code example of a map (or multiple maps) using a shared datasource with the map widget?
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 02 Oct 2014 Link to this post

    Hi Joe,

    Here is a simple example illustrating how a single DataSource could be used by multiple Map widgets.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Joe
    Joe avatar
    2 posts
    Member since:
    Jul 2013

    Posted 02 Oct 2014 in reply to Alexander Popov Link to this post

    Hi Alexander,

    Thank you for the reply and the example.  I see that the example works, but I'm still having issues with the map widget.  I'm calling a webapi controller to get geojson for a map layer.  It works with the html helper, but I want to use the javascript widget.  Please see the attached file that contains javascript, webapi, and sample data.  Would you please see what I'm doing wrong?

    Thank you!
  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 06 Oct 2014 Link to this post

    Hello again Joe,

    I reviewed the attached code snippets and I noticed that the DataSource object is used as and additional data parameter for the Map's DataSource. I would recommend specifying the type of the separate DataSource instance and refer it in the Map's layer options. For example:
    var ds = new kendo.data.DataSource({
        type: "geojson",
        transport: {
            read: {
                url: "/api/ReportData/GetMoStateMap",
                ...
            }
        }
    });
     
    $("#map2").kendoMap({
        layers: [..
               {
                   type: "shape",
                   dataSource: ds
     
               }
        ],
     

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready