开发者

json vs xml annotations for mapkit

开发者 https://www.devze.com 2023-02-27 13:49 出处:网络
I have been working on a maps application (iphone) originally I had my annotations set up to pull XML from google using their Places API. I\'m having 3 issues.

I have been working on a maps application (iphone) originally I had my annotations set up to pull XML from google using their Places API. I'm having 3 issues.

  1. For my annotation info, I was going off of an example from Zen (http://www.zen-sign.com/finding-business-listings-and-displaying-with-mapkit-part-1/ ) and he has it set up to do it by keyword, which wasn't really necessary for me ( but I used it anyway just to get a feel for getting the annotations) in the parser header he has:

    -(void) 开发者_Python百科getBusinessListingsByKeyword:(NSString*)keyword atLat:(float)lat atLng:(float)lng;
    

    and in the the viewdidload of his view controller

    [locationsMap findLocationsByKeyword:@"Apple" ];
    

    I'm not sure how to move from the keyword parse version used in zen to something that just does it automatically (in the parser object- without the viewdidload in a different view controller if possible).

    Any advice on what to read/watch or sample code much appreciated

  2. For places information Google isn't the only kid on the block and XML I hear comes in second to JSON. So I wanted to know what the best practice was for map annotations made from business information: JSON or XML?

  3. The other issue I was having was only getting 10 annotations (I want to get 50 or more). So on top of your advice on using XML or JSON. How to I increase the amount of annotations I'm getting.

Sorry for making this 3 parts but again any tutorials (text of video) would be very helpful. (So far I've watched hegarty from Stanford, Larson from MATC)


First

Don't know what you mean by automaticaly. But if you want to launch the map on users current location here you have two methods you can use:

-(IBAction)goToCurrentLocation{
    CLLocation *location = [[CLLocation alloc] 
                            initWithLatitude:myMap.userLocation.coordinate.latitude
                            longitude:myMap.userLocation.coordinate.longitude];
    [self setCurrentLocation:location];
}

- (void)setCurrentLocation:(CLLocation *)location {
    MKCoordinateRegion region = {{0.0f, 0.0f}, {0.0f, 0.0f}};
    region.center = location.coordinate;
    region.span.longitudeDelta = 0.15f;
    region.span.latitudeDelta = 0.15f;
    [self.myMap setRegion:region animated:YES];
}

Second. I don't know what are the best practicies but I used json with this jeson parser for my app ijustmadelove

Three. There is no problem in getting more then 10 annotations on the map. You have to have an error or a limitation in your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消