This is a migrated thread and some comments may be shown as answers.
GeoJSON Map
4 Answers 86 Views
Map
This is a migrated thread and some comments may be shown as answers.
Negin
Top achievements
Rank 1
Negin asked on 27 Apr 2015, 05:41 PM

Hi,

 In my project I need to dynamically zoom in or out on a region or country.

e.g. I select a country or some countries of a region, and it gets a close-up of that country or region.

And when I deselect the countries, it zooms out. (Preferably animated).

I was wondering if you could let me know if Kendo GeoJSON Map has this functionality.

Thanks

4 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 29 Apr 2015, 03:29 PM
Hello,

This is possible by using the extent method albeit without the animated transition.
Also, check out the Authoring Maps help article for some general info on working with GeoJSON maps.

I hope this helps.

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
Negin
Top achievements
Rank 1
answered on 17 Jul 2015, 08:25 PM

Thanks for your reply T.

Unfortunately, in my case, in order to use "Extent" or "Map Center Point", I need to get the location of the shapes dynamically.

I need to get the location of the shapes while they are being created. So I can keep them in the json, and by selecting my countries somewhere else on the page (like some checkboxes), it can zoom in to the countries' shapes.

I tried this in Shape Create Event Handler, and assigned that to the center of the map, but it didn't work. It zoomed in to somewhere else.

    var bbox = e.shape.bbox();

     var center = bbox.center();

 

The only thing that worked for me to get the location, was Map, itself, Click Event:

click: function(e) { var location = e.location ​}

But it's not what I need.

 

Was wondering if you could help me.

 

Thanks

0
Accepted
Daniel
Telerik team
answered on 22 Jul 2015, 01:19 PM
Hello,

The location can be found from the bbox center by using the viewToLocation method. You will also need to take account the current surface offset. I created an example that demonstrates centering the map based on a dropdownlist selection.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Negin
Top achievements
Rank 1
answered on 22 Jul 2015, 07:39 PM

Thanks a lot Daniel!

It was really helpful.

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