This is a migrated thread and some comments may be shown as answers.

map shared datasource

3 Answers 136 Views
Map
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 01 Oct 2014, 01:59 AM
Does some one have a  code example of a map (or multiple maps) using a shared datasource with the map widget?

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 02 Oct 2014, 12:53 PM
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!
 
0
Joe
Top achievements
Rank 1
answered on 02 Oct 2014, 02:10 PM
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!
0
Alexander Popov
Telerik team
answered on 06 Oct 2014, 07:12 AM
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!
 
Tags
Map
Asked by
Joe
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Joe
Top achievements
Rank 1
Share this question
or