I have dowloaded the sample code from
https://developer.apple.com/library/prerelease/ios/samplecode/footprint/Introduction/Intro.html
and was able to use it for my purpose. The question I cannot resolve is how to make the inverse of MKMapPointFromPDFPoint (AAPLCoordinateConverter).
tried diferent approachs and none of them give consistent results
The code base takes the touch in mapview to get a mkmappoint and tries to translate it to pdf points. Any help would be great!
// getting the touch
UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleGesture2:)];
tgr.numberOfTapsRequired = 1;
tgr.numberOfTouchesRequired = 1;
[self.mapView addGestureRecognizer:tgr];
- (void)handleGesture2:(UIGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.state != UIGestureRecognizerStateEnded)
return;
CGPoint touchPoint = [gestureRecognizer locationInView:self.mapView];
CLLocationCoordinate2D touchMapCoordinate = [self.mapView convertPoint:touchPoint toCoordinateFromView:self.mapView];
AAPLGeoAnchorPair anchorPair = {
.fromAnchor = self.anchor1,
.toAnchor = self.anchor2
};
AAPLCoordinateConverter * converter = [[AAPLCoordinateConverter alloc] initWithAnchorPair:anchorPair];
CGPoint pointOnPdf = [converter PDFPointFromMKMapPoint:touchMapCoordinate]; <-- pretended function