Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Not showing annotations in Australia region #6

Open
kapilgoyal12 opened this issue Jan 6, 2015 · 8 comments
Open

Not showing annotations in Australia region #6

kapilgoyal12 opened this issue Jan 6, 2015 · 8 comments

Comments

@kapilgoyal12
Copy link

Hi,

Your demo is very good. but it is working only USA region.
Please could you tell me how it will works for other region.

I read a function in your code

  • (void)buildTree
    {
    @autoreleasepool {
    NSString *data = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"USA-HotelMotel" ofType:@"csv"] encoding:NSASCIIStringEncoding error:nil];
    NSArray *lines = [data componentsSeparatedByString:@"\n"];

    NSInteger count = lines.count-1;
    
    TBQuadTreeNodeData *dataArray = malloc(sizeof(TBQuadTreeNodeData) * count);
    for (NSInteger i = 0; i < count; i++)
    {
        dataArray[i] = TBDataFromLine(lines[i]);
    }
    
    TBBoundingBox world = TBBoundingBoxMake(19, -166, 72, -53);
    _root = TBQuadTreeBuildWithData(dataArray, count, world, 4);
    

    }
    }

    "TBBoundingBox world = TBBoundingBoxMake(19, -166, 72, -53);"
    

How did you define " TBBoundingBoxMake(19, -166, 72, -53) " this. because all values in TBBoundingBoxMake are static. if i change these values then annotations will not show in USA region.

Please help me.
Thanks.

@crystaldonut
Copy link

Having the same issue, im trying to display items in GUAM myself

@ZoebHusainSheikh
Copy link

@crystaldonut @kapilgoyal12 have you able to sort out this issue?

@buh
Copy link

buh commented Feb 9, 2015

Hi,
I rewrite this library in objective-c only for my project to clear how its work and add some features. If you interesting how its work, I just released my project named Cheapshot. In my plan share code on github, but I need time to preprare library for cocoa pods (extract code, create demo). If you need raw code, I can give you by email.

@crystaldonut
Copy link

The problem seems to be related to the bounding box areas,

By redefining the bounding box using different coordinates you can get international points; i've haven't had the time to make the next step; which is to react to mapview coordinate changes and use different bounding boxes; basically i will unload map data when moving to another bounding area.

The solution is not the best for everybody since they are bounding boxes and you might get missing countries or regions (for example USA, covers north canada, hawaii but not Alaska); but since i need only specific world regions its good enough for my needs before a rewrite is required.

@kapilgoyal12
Copy link
Author

Hi

I solved this issue. there was a problem in bounding box area. i got the bounded box area from these function when user will move,scroll,zoom in and out the map.

-(CLLocationCoordinate2D)getNECoordinate:(MKMapRect)mRect
{
return [self getCoordinateFromMapRectanglePoint:MKMapRectGetMaxX(mRect) y:mRect.origin.y];
}

-(CLLocationCoordinate2D)getNWCoordinate:(MKMapRect)mRect
{
return [self getCoordinateFromMapRectanglePoint:MKMapRectGetMinX(mRect) y:mRect.origin.y];
}

-(CLLocationCoordinate2D)getSECoordinate:(MKMapRect)mRect
{
return [self getCoordinateFromMapRectanglePoint:MKMapRectGetMaxX(mRect) y:MKMapRectGetMaxY(mRect)];
}

-(CLLocationCoordinate2D)getSWCoordinate:(MKMapRect)mRect
{
return [self getCoordinateFromMapRectanglePoint:mRect.origin.x y:MKMapRectGetMaxY(mRect)];
}

-(CLLocationCoordinate2D)getCoordinateFromMapRectanglePoint:(double)x y:(double)y
{
MKMapPoint swMapPoint = MKMapPointMake(x, y);
return MKCoordinateForMapPoint(swMapPoint);
}

-(NSArray *)getBoundingBox:(MKMapRect)mRect
{
CLLocationCoordinate2D bottomLeft = [self getSWCoordinate:mRect];
CLLocationCoordinate2D topRight = [self getNECoordinate:mRect];
return @[[NSNumber numberWithDouble:bottomLeft.latitude ],
[NSNumber numberWithDouble:bottomLeft.longitude],
[NSNumber numberWithDouble:topRight.latitude],
[NSNumber numberWithDouble:topRight.longitude]];
}

Thanks

@vishnurkaimal
Copy link

I have the same issue , how can i solve this?

@ZoebHusainSheikh
Copy link

@vishnurkaimal
Just pass "self.mapView.visibleMapRect"
Like:
TBBoundingBox world = TBBoundingBoxForMapRect(self.mapView.visibleMapRect);

@ippily
Copy link

ippily commented Mar 27, 2015

I changed the area of the bounding box to:
TBBoundingBox world = TBBoundingBoxMake(51, -1, 52, 0);

This is an area around London showing some clusters. The first two numbers are the co-ordinates of the top left corner and the second two numbers are the co-ordinates of the bottom right corner of the bounding box you want to make. (i.e. the numbers before the lat + lon decimal point)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants