1 Replies - 3892 Views - Last Post: 22 August 2012 - 07:02 PM

#1 cammyj3  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 12-June 12

Geotagging/Plotting MapKit Corelocation

Posted 16 August 2012 - 08:51 AM

I have created an app that simply shows the user's current position on a google map using the MapKit.

However I would now like to go a bit further and add a bit more functionality to the app by allowing the user to plot points on the map themselves.

I somehow believe using CoreLocation will accomplish this by receiving and saving coordinates of where the user selects on the map.

Am I right in saying this? and any ideas on how I would implement this? Links or tutorials would be helpful too, and also any personal experience/ideas in the matter would be great.

I have created an app that implements coreLocation before this app, compiled/ran perfectly.. just didnt update user location and latitude/longitude. the code is shown below for that app:

This is only in the AppDelegate.m which is what does all the work basically.

#import "AppDelegate.h"
#import "ViewController.h"

@implementation AppDelegate

@synthesize window;
@synthesize viewController;
@synthesize locationManager;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    return YES;
}
							
- (void)applicationWillResignActive:(UIApplication *)application
{
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    self.locationManager = [[CLLocationManager alloc]init];
    if ([CLLocationManager locationServicesEnabled]) {
        self.locationManager.delegate = self;
        self.locationManager.distanceFilter = 100;
        [self.locationManager startUpdatingLocation];
    }
}

- (void)applicationWillTerminate:(UIApplication *)application
{
}

#pragma mark CLLocationManagerDelegate Methods

-(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
    MKCoordinateSpan span;
    span.latitudeDelta = 0.2;
    span.longitudeDelta = 0.2;
    
    MKCoordinateRegion region;
    region.span = span;
    region.center = newLocation.coordinate;
    
    [viewController.mapView setRegion:region animated:YES];
    viewController.mapView.showsUserLocation = YES;
    
    viewController.latitude.text = [NSString stringWithFormat:@"%f", newLocation.coordinate.latitude];
    viewController.latitude.text = [NSString stringWithFormat:@"%f", newLocation.coordinate.longitude];

}

@end


Is This A Good Question/Topic? 0
  • +

Replies To: Geotagging/Plotting MapKit Corelocation

#2 erewnoh  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 71
  • Joined: 01-March 09

Re: Geotagging/Plotting MapKit Corelocation

Posted 22 August 2012 - 07:02 PM

I realize this is two week sold, but if you haven't gotten a satisfactory answer, or for anyone else, I think looking at the documentation for MKAnnotation might help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1