Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Locations in iPhone ARKit overlapping at one place

I am using ARKit for one of my Augmented Reality app. But problem I am facing is that Locations in camera is overlapping each other.

When I tried it using hardcoded data, I was able to show data at different locations. Now I am fetching data from a server and displaying them on ARKit. This shows all the locations overlapped on each other.

Here is my code:

for (NSDictionary *drop in drops)
{
    CLLocation *tempLocation = [[CLLocation alloc] initWithLatitude:[[[drop objectForKey:@"latitude"] objectForKey:@"text"] floatValue] longitude:[[[drop objectForKey:@"longitude"] objectForKey:@"text"] floatValue]];
    tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
    tempCoordinate.inclination = M_PI/30;
    tempCoordinate.title = [[drop objectForKey:@"DropText"] objectForKey:@"text"];
    tempCoordinate.subtitle = [[drop objectForKey:@"DropPlace"] objectForKey:@"text"];
    tempCoordinate.type=[[[drop objectForKey:@"DropType"] objectForKey:@"text"] intValue];
    [tempLocationArray addObject:tempCoordinate];
    [tempLocation release];

}
[viewController addCoordinates:tempLocationArray];
[viewController startListening];

This shows all the drops overlapped. I need solution on how to fix this issue or what I am doing wrong here that showing locations one over another. Please note that all the drops in my case has different latitude and longitude. I have tested that.

like image 469
Dipak Mishra Avatar asked Nov 13 '22 21:11

Dipak Mishra


1 Answers

There were no issue in my code, the issue was in server and it was giving me all the data for same geo location. Once I started getting data with different geo locations, my problem was solved.

like image 58
Dipak Mishra Avatar answered Nov 15 '22 11:11

Dipak Mishra