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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:29:16+00:00 2026-06-13T10:29:16+00:00

I have a loop statement that displays my annotations on the mapView from an

  • 0

I have a loop statement that displays my annotations on the mapView from an array. How do I check to see if any of the coordinates in the array are 0,0, and if so, remove/dont plot them?

Thanks.

Code:

        CLLocationCoordinate2D maxCoord = {45.60250f,-122.39181f};
        CLLocationCoordinate2D minCoord = {45.35697f,-123.12789f};

        NSArray *callsArray = [xmlParser calls];

        for (JointCAD *call in callsArray) {
            NSString *callnumber = [call.callnumber stringByAppendingFormat:@". "];
            NSString *callandnumber = [callnumber stringByAppendingString:call.currentCallType];
            CLLocationCoordinate2D newCoord = { [call.latitude doubleValue], [call.longitude doubleValue]};

            if ([call.longitude doubleValue] > maxCoord.longitude)
            {
                maxCoord.longitude = [call.longitude doubleValue];
            }
            if ([call.latitude doubleValue] > maxCoord.latitude)
            {
                maxCoord.latitude = [call.latitude doubleValue];
            }
            if ([call.longitude doubleValue] < minCoord.longitude)
            {
                minCoord.longitude = [call.longitude doubleValue];
            }
            if ([call.latitude doubleValue] < minCoord.latitude)
            {
                minCoord.latitude = [call.latitude doubleValue];
            }

            Annotation *ann = [[Annotation alloc] init];
            ann.title = callandnumber;
            ann.subtitle = [call location];
            ann.coordinate = newCoord;
            [mapView addAnnotation:ann];
        }

        MKCoordinateRegion region = {{0.0f, 0.0f}, {0.0f, 0.0f}};

        region.center.longitude = (minCoord.longitude + maxCoord.longitude) / 2.0;
        region.center.latitude = (minCoord.latitude + maxCoord.latitude) / 2.0;

        region.span.longitudeDelta = (maxCoord.longitude - minCoord.longitude) * 1.1;
        region.span.latitudeDelta = (maxCoord.latitude - minCoord.latitude) * 1.1;

        [mapView regionThatFits:region];
        [self.mapView setRegion:region animated:YES];

        [self setRefreshState:@"Finished"];
  • 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-13T10:29:17+00:00Added an answer on June 13, 2026 at 10:29 am

    Hm why don’t you just add a continue in your for loop when the coordinates are equal 0?

    Before creating the Annotation object just add a simple

    if(newCoord.latitude == 0 && newCoord.longitude == 0) continue;
    

    continue simply skips to the next iteration of a loop.

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

Sidebar

Related Questions

I have this foreach statement that is supposed to cycle through an array, but
I have a piece of code that has a loop within a try statement.
I have an If statement that runs within a 'for' loop to create markers
I have a command that creates a loop: foreach($cart as $line=>$item). When it displays,
I have a simple for loop followed by a simple if statement: for airport
How to loop through a select statement results to have a formatted text? for
I have a problem with a continue statement in my C# Foreach loop. I
Suppose, I have a if statement inside a for loop: for( ; ; )
I have an echo statement that is supposed to run a specific amount of
I have a process that gets a files from a directory and puts them

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.