Click here to Skip to main content
15,897,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please take a look on this link

http://www.daftlogic.com/projects-google-maps-area-calculator-tool.htm.

where the use taps on some locations and that forms a polygon.you can see the area covered by the polygon in output. I want same thing to be achieved in iOS through map kit. currently i am using the following simple code to get touched coordinates on map view . I am unable to get much idea to that. please provide any sample links or code

Objective-C
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    if (!self.isDrawingPolygon)
        return;

    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInView:self.mapView];
    CLLocationCoordinate2D coordinate = [self.mapView convertPoint:location toCoordinateFromView:self.mapView];

    [self addCoordinate:coordinate replaceLastObject:YES];
}
Posted

1 solution

The area of a polygon can easily calculated by Polygon triangulation. It means, that the area gets divided into triangles created by the points of the polygon.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900