mapkit js map.setRegionAnimated Not Working

Hello,


Maybe I'm missing something but for some reason the map is setting the coorindatespan to twice the requested delta values and I can't figure out why. The version is 5.10.2.


For example, this code:


reg = new mapkit.CoordinateRegion(idx_map_apple.center, reg);


console.log('requested: dlat ' + reg.span.latitudeDelta + ', dlon ' + reg.span.longitudeDelta );


idx_map_apple.setRegionAnimated(reg);


window.setTimeout(function(){

console.log('got: dlat ' + idx_map_apple.region.span.latitudeDelta + ', dlon after: ' + idx_map_apple.region.span.longitudeDelta );

}, 3000);


Produces this output:


requested: dlat 0.065068, dlon 0.109691

got: dlat 0.1300831962679112, dlon 0.21938323974609375


This happens even without the timeout delay.


The documentation seems pretty clear that the span is for the whole coordinate span and not deltas from the center.


Any ideas what is going on?

Replies

Indeed, the latitude and longitude delta represent the whole span and not half of it. When setting a region on the map, the aspect ratio of the map view needs to be taken into consideration, so the span may be larger than the requested one in either latitude or longitude, but not in both. (Unless you are at the maximum zoom level, but this does not seem to be the case here.)


There is not enough information here to answer this puzzle, but you should consider filing a bug report at https://bugreport.apple.com with a more complete test case that shows the issue (you can get more info at https://developer.apple.com/bug-reporting/), then paste the report number here so we don’t miss it.


Hope this helps.