Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7843681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:37:40+00:00 2026-06-02T16:37:40+00:00

I am trying to draw route between two location. For that i have Two

  • 0

I am trying to draw route between two location. For that i have Two CLLocation (startPoint ,endPoint). After MKReverseGeocoder of this two location I got out put like this.

- (void)findAddress{       
    geoCoder1 = [[MKReverseGeocoder alloc] initWithCoordinate:startPoint.coordinate];  
    geoCoder1.delegate = self;   
    [geoCoder1 start];         
    geoCoder2 = [[MKReverseGeocoder alloc] initWithCoordinate:endPoint.coordinate];      
    geoCoder2.delegate = self;
    [geoCoder2 start];    
}   
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
    if(geocoder==geoCoder1){
           NSMutableDictionary *cplace1=[[[NSMutableDictionary alloc]initWithDictionary:[placemark addressDictionary]] autorelease];
          NSLog(@"The MKReverseGeocoder Start Point Address %@", cplace1 );

       }else{
            NSMutableDictionary *cplace2=[[[NSMutableDictionary alloc]initWithDictionary:[placemark addressDictionary]] autorelease];             
           NSLog(@"The MKReverseGeocoder End Point Address %@", cplace2 );
       } 
}

Out put:-

The MKReverseGeocoder Start Point Address {
    City = Bangalore;
    Country = India;
    CountryCode = IN;
    FormattedAddressLines =     (
        "Grant Rd, Sampangi Rama Nagar",
        "Bangalore, Karnataka",
        India
    );
    State = Karnataka;
    Street = "Grant Rd";
    SubAdministrativeArea = "Bengaluru Rural";
    SubLocality = "Sampangi Rama Nagar";
    Thoroughfare = "Grant Rd";
}

The MKReverseGeocoder End Point Address {
    Country = India;
    CountryCode = IN;
    FormattedAddressLines =     (
        "NH47 Bi - Rd",
        "Ernakulam, Kerala",
        India
    );
    State = Kerala;
    Street = "NH47 Bi - Rd";
    SubAdministrativeArea = Ernakulam;
    Thoroughfare = "NH47 Bi - Rd";
}

Now i want to retrieve route points between this two location, For that i sent NSURLRequest like this.

 - (void)updateRoute {
         NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:
@"http://maps.googleapis.com/maps/api/directions/json?origin=%@&destination=%@&mode=%@&sensor=false", startLocation,endLocation,routeMode] ]];

        [[NSURLConnection alloc] initWithRequest:request delegate:self];    
      }  

The problem was i want to pass startLocation and endLocation to NSURLRequest. So which values i should assign startLocation, and endLocation from MKReverseGeocoder delegate return(cplace1 and cplace2)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:37:43+00:00Added an answer on June 2, 2026 at 4:37 pm

    It looks like you already have the start and end locations as CLLocation objects, so use the values for coordinate (which is a CLLocationCoordinate2D) in those to pass to Google.

    The startPoint and endPoint’s CLLocationCoordinate2D both contain a latitude and longitude, which are in CLLocationDegrees types. CLLocationDegrees is really a double, so you can put it into a formatted string with %f

    NSString *googleURL = [NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/directions/json?origin=%f,%f&destination=%f,%f&mode=%@&sensor=false", 
        startPoint.coordinate.latitude,startPoint.coordinate.longitude,
        endPoint.coordinate.latitude,endPoint.coordinate.longitude,
        routeMode];
    
    NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:googleURL]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying draw route between two location.For that i have two instance of
I am trying two draw route between two location,For that I Fetch all the
I'm trying to draw a route in a mapView from the current location (got
I used this function to draw a path between two points. I get the
I'm trying to draw a route onto my MapView. I've extended Overlay and implemented
basically i am trying to draw the path i.e road path. for that i
I'm trying to draw items that end of them is an * character in
I'm trying to plot lines between two or more addresses in Google Maps. The
I am trying to draw a bus route as a simple sequence of lines.
I am trying to calculate the distance between two map point using Google Map

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.