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 6362227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:52:55+00:00 2026-05-24T23:52:55+00:00

I was just curious what the correct way to draw a simple route line

  • 0

I was just curious what the correct way to draw a simple route line between a set of points was? I currently have an array of coordinates and when I pass it to polylineWithCoordinates and do all the other necessary things, it draws a big web of lines that interconnect all of the points to one another. I’ve looked at a few samples but none of them seem to do anything special to account for this, even when they use more than two points.

- (void)viewDidLoad
{
    [super viewDidLoad];

    ...

    //Add drawing of route line
    CLLocationCoordinate2D coordinates[[myCheckpoints count]];

    int i = 0;
    for (Checkpoint *ckpt in myCheckpoints)
    {
        coordinates[i] = CLLocationCoordinate2DMake([ckpt.lat floatValue] , [ckpt.lon floatValue]);
        i++;
    }

    MKPolyline *route = [MKPolyline polylineWithCoordinates: coordinates count: [myCheckpoints count]];
    [mapView addOverlay:route];

}

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay {

    MKPolylineView *polylineView = [[[MKPolylineView alloc] initWithPolyline:overlay] autorelease];
    polylineView.strokeColor = [UIColor greenColor];
    polylineView.lineWidth = 5.0;

    return polylineView;

}

This is the code in my mapViewController that is responsible for the drawing, just in case somebody sees what I’m doing, or not doing.
Here is what the result looks like

Now that I look at everything much closer, is actually not connecting adjacent coordinates to each other. Each point only has 2 lines stemming from it connecting that point to 2 more points but I cant figure out the pattern its connecting them in.

  • 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-05-24T23:52:56+00:00Added an answer on May 24, 2026 at 11:52 pm

    Make sure the coordinates in myCheckpoints are in the order that you want the lines drawn in.

    It will draw the lines in the order the coordinates are provided.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just curious with regards to the correct way to create a view
I was just curious about the correct way to go about accessing a property
Just curious if I'm creating a shared memory array on Windows platform like so:
Just curious what is the best practice for solving the following issue. I have
Just curious how you would comment this line of code: string customerNm = customerNm.EndsWith(s)
I'm just curious if my way of thinking is incorrect. Would my way of
I am just curious about @model dynamic in mvc 3. Correct me if I
Just curious, what actually happens if I define a zero-length array int array[0]; in
Is this the correct way to pop objects off the front of an array.
I have the following if, else if, else construct and I am just curious

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.