I have a list (NSMutableArray) of latlong surrounding the Dhaka City region. Now want want to determine a provided lat long is in the Dhaka City Region.
My code is provided below:
+(NSMutableArray*)getAvailableAddress {
NSMutableArray* dhakaAvailableAreas=[[NSMutableArray alloc]init];
NSDictionary *latLongDict = @{@"lat" : @(23.665217), @"long":@(90.456556)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.710108), @"long":@(90.400022)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.707796), @"long":@(90.366647)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.744056), @"long":@(90.345334)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.751866), @"long":@(90.333149)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.768038), @"long":@(23.768038)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.774732), @"long":@(90.336199)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.796483), @"long":@(90.338031)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.833850), @"long":@(90.339256)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.853928), @"long":@(90.342309)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.867869), @"long":@(90.351460)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.887389), @"long":@(90.358176)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.899096), @"long":@(90.380142)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.882914), @"long":@(90.394773)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.886806), @"long":@(90.417956)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.899729), @"long":@(90.440122)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.895324), @"long":@(90.456267)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.861075), @"long":@(90.475134)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.840659), @"long":@(90.473056)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.828086), @"long":@(90.486782)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.793225), @"long":@(90.480572)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.782239), @"long":@(90.470264)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.770608), @"long":@(90.482614)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.753955), @"long":@(90.488093)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.747045), @"long":@(90.486714)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.742954), @"long":@(90.494262)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.732360), @"long":@(90.493535)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.717059), @"long":@(90.500136)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.710997), @"long":@(90.508137)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.710997), @"long":@(90.508137)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.693175), @"long":@(90.480623)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.672433), @"long":@(90.468799)};
[dhakaAvailableAreas addObject:latLongDict];
latLongDict = @{@"lat" : @(23.667661), @"long":@(90.458352)};
[dhakaAvailableAreas addObject:latLongDict];
return dhakaAvailableAreas;
}
Now if I provide a lat long for example lat=23.665219 and long=90400023 How can I determine the lat long is in the Dhaka City Region
Thanks in advance.
Finally I get a sollution using GMSGeometryContainsLocation, and it works more accurately and fine.
if (GMSGeometryContainsLocation(locationPoint, polygonPath, YES)) {
NSLog(@"locationPoint is in polygonPath.");
} else {
NSLog(@"locationPoint is NOT in polygonPath.");
}