I have 2 (or more) locations (example lat - 58, lon - 56 and lat - 54, lon - 38). How can I calculate center map and ZoomLevel that this points (locations) was inside map?
1 Answer, 1 is accepted
answered on 20 Jul 2010, 04:05 PM
Hi Pavel Ruslanovich Kovyev,
You can use the LocationRect class. It has Center property and ZoomLevel property that contains optimal zoom level for the rectangle.
The sample code of the SetBestView method is below. It specifies Center and ZoomLevel properties of the map control according to collection of locations.
LocationRect rect = newLocationRect(location1, location2);
rect.MapControl = this.radMap;
this.radMap.ZoomLevel = rect.ZoomLevel;
this.radMap.Center = rect.Center;
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items