I am trying to create a function that takes in a parameter of meters and returns a pixel width for an MKMapView.
How can I correctly determine from the current zoom of the map, how many pixels represent the correct amount of meters?
So an example is let's say I have a zone radius of 78 meters, and the current distance across the map is 6000 meters. How can I represent those 78 meters as a scaled proportional UIView on the map?
My plan was to first calculate how many meters across the map are currently being represented. So here is what I have for that. But I am getting stuck on trying to figure out how to convert the amount of meters into the correct pixel widths. I already have the correct zone radiuses as well.
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
MKMapRect currentRect = mapView.visibleMapRect;
MKMapPoint farEastPoint = MKMapPointMake(MKMapRectGetMinX(currentRect), MKMapRectGetMidY(currentRect));
MKMapPoint farWestPoint = MKMapPointMake(MKMapRectGetMaxX(currentRect), MKMapRectGetMidY(currentRect));
double currentDis =MKMetersBetweenMapPoints(farEastPoint, farWestPoint);
}