MKRoadWidthAtZoomScale in iOS 6?

From the docs for MKRoadWidthAtZoomScale :

You should not use this function to extract the road width in iOS 6 and later.

Is there another feature that can be used instead, or is it just missing in iOS 6?

It is odd that the function was not deprecated if you should not use it.

+6
source share
2 answers

I would venture to suggest that it was not deprecated, because the functionality will be added back at some point. The function still works in iOS 6, since it does not cause a crash when called, even if the output is not useful.

If you look at the (Apple) Maps application, you will see that when scaling the path, the path of the path width increases with the maximum zoom level. The width of the road increases at high zoom levels. Obviously, Apple has an internal way of knowing how expensive it is to scale. It may not have been fully tested for general release.

Just in case, someone thinks that you can still use this function, here the suggested road widths begin with full increase (MKZoomScale = 1) and scaling.

code:

 for (float zoomScale=1; zoomScale>0.00001; zoomScale /= 2) { NSLog(@"zoomScale: %f Road Width: %f", zoomScale, MKRoadWidthAtZoomScale(zoomScale)); } 

Results:

 zoomScale: 1.000000 Road Width: 21.000000 zoomScale: 0.500000 Road Width: 32.000000 zoomScale: 0.250000 Road Width: 60.000000 zoomScale: 0.125000 Road Width: 96.000000 zoomScale: 0.062500 Road Width: 176.000000 zoomScale: 0.031250 Road Width: 288.000000 zoomScale: 0.015625 Road Width: 448.000000 zoomScale: 0.007812 Road Width: 768.000000 zoomScale: 0.003906 Road Width: 1536.000000 zoomScale: 0.001953 Road Width: 2048.000000 ... 

Regarding the replace function, I would suggest just creating some values ​​that work well for the highest zoom levels of 2 or 3 and using a constant value below that.

Here Apple displays route overlays at low and high scales. You can see that the alternative route does not take into account the large width of the road, but the main width of the route is in place. Changing the route does not affect the alternative width of the route.

enter image description here

+3
source

Starting with iOS 7.1, there are no more warnings in the MKRoadWidthAtZoomScale documentation. It is defined in MKOverlayRenderer.h , which was introduced in iOS 7.0.

0
source

All Articles