Hi,
I display the world map on the xamMap. Upon clicking a particular country, the map element of the country will be zoom in. I change the value of WindowZoomMaximum property. The thing is that whether I chose small or big country the zoom level is the same.
I wanna find out the zoom level based on the country size or area and also wanna make sure the element is shown at the center of screen.
How could i calculate the zoom level based on country size?
Thanks.
NNT
Hi NNT
They are interchangeable, I would recommend using only one of them.
WindowZoomMaximum gets or sets the maximum possible zoom for the map and it's not needed in the above code snippet. I have tested with the countries you have mentioned and only Russia and USA are not centered well, because of their shapes. As a workaround I would suggest to specify WindowScale and WindowCenter manually for those countries.
Regards,
Ivan Kotev
Hi Ivan,
I'd like to ask two questions.
1. What's the difference between WindowZoom and WindowScale. How could i use them for centering a particular element?
2. Here is my current approach to try to get an element to the center of the map.
void Map_ElementClick(object sender, MapElementClickEventArgs e){ MainMap.WindowZoomMaximum = 8; MainMap.WindowFit(e.Element); }
The above code works perfect when a small country is selected. But when big countries like USA, Canada, Rusis, China are selected, they go out of the boundary. So What i 'd like to know is how to adjust zoom based on the country i selected.
Thanks a lot.
XamMap's WindowZoomMaximum gets or sets the maximum possible zoom for the map. I assume that you want to use WindowZoom or WindowScale instead.
To show element at the center of the screen you can use XamMap's WindowFit method.
Please let me know if you have more questions.