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

[Solved] How to center the map to a specific shape?

1 Answer 77 Views
Map for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin
Top achievements
Rank 1
Kevin asked on 19 Feb 2014, 07:00 PM
I don't know if this is possible at all... I set a datacontext to a layer in a map, and when it changes I'm matching the data to each shape in the MapShapeCollection of the layer. And when the match is found, I want to center the map to that shape. Is this possible?

1 Answer, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 21 Feb 2014, 09:54 AM
Hello Kevin,

Thank you for contacting us.

The RadMap control has a SetView(...) method that specifies the rectangle area that will be displayed by the map. Although the map shapes do not support functionality that gets the shape bounding rectangle out of the box, you have access to the shape points through the IMap2DShape.Locations property and therefore you can easily find the bounding rectangle and use it in the RadMap.SetView(...) method. For your convenience I have created a sample project that demonstrates how you can center the map at a specific country.

I hope this was useful.

Regards,
Rositsa Topchiyska
Telerik
Tags
Map for XAML
Asked by
Kevin
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Share this question
or