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

Binding Map to local GeoJSON data

2 Answers 139 Views
Map
This is a migrated thread and some comments may be shown as answers.
arno
Top achievements
Rank 1
arno asked on 17 Aug 2015, 08:21 AM

Hi,

Is it possible to bind the kendo map to local geojson data with the same format as the remote source? 

For example this data is exactly the format I feed it: http://demos.telerik.com/kendo-ui/content/dataviz/map/countries-users.geo.json
but then stored in a local variable like "mapData" in the following example.

  $("#participantMap").kendoMap({
            center: [51.5000,0.11],
            zoom: 6,
            layers: [{
                    type: "shape",
                    dataSource: {
                        type: "geojson",
                        data: mapData
                    },
                    style: {
                        fill: {
                            opacity: 0.7
                        }
                    }
                }]
        }); 

 

Ideally it would work with the AngularJS directive but I don't find a working example of it using local geojson data.

Has anyone tried this before?

thanks,

Arno

 

 

 

2 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 17 Aug 2015, 12:20 PM
Hi,

Binding to local data currently requires simulating a transport.
Sample code:
          dataSource: {
            type: "geojson",
            transport: {
              read: function(e) {
                e.success(mapData);
              }
            }
          }

I'll check if we can fix this in the data source definition.
Apologies for the caused inconvenience.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
arno
Top achievements
Rank 1
answered on 19 Aug 2015, 08:16 AM

Thank you,

I'll try this approach then.

Arno

Tags
Map
Asked by
arno
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
arno
Top achievements
Rank 1
Share this question
or