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

  • Home
  • SEARCH
  • 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 8047075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:59:31+00:00 2026-06-05T05:59:31+00:00

I have setup a CLLocation object, I am adding MKCircle overlay. I want the

  • 0

I have setup a CLLocation object, I am adding MKCircle overlay. I want the radius variable of the MKCircle to be relative to two this:

  1. The size of the Map View
  2. The size of the location

So, how can I retrieve some sort of size value from a CLLocation? And even better, would it automatically scale once I interact/zoom in out with the map view? Here is an overview of my objective:

Add an overlay to the map view. The overlay will be at a CLLocation CLLocationCoordinate2D variable, but I want that overlay to fit the size of that location and then resize once I zoom in and out with the map, which I am pretty sure it should do automatically. I know that I need to define the MKCircle‘s radius variable, but then how should I set it? So, do you guys know how I can do this?

Thanks!

UPDATE:

CLLocation *org = [[CLLocation alloc] initWithLatitude:coordO.latitude longitude:coordO.longitude];
CLLocation *des = [[CLLocation alloc] initWithLatitude:coordD.latitude longitude:coordD.longitude];

MKCircle *myCircle = [MKCircle circleWithCenterCoordinate:coordO radius:org.horizontalAccuracy];
MKCircle *myCircle2 = [MKCircle circleWithCenterCoordinate:coordD radius:des.horizontalAccuracy];

if (myCircle2 && myCircle) {

    NSLog(@"destination and origin both valid");
}

[mapView addOverlays: [NSArray arrayWithObjects:myCircle, myCircle2, nil]];

[myCircle setTitle:@"Placeholder"];
[myCircle2 setTitle:@"Placeholder"];

[localOverlays addObjectsFromArray: [NSArray arrayWithObjects:myCircle, myCircle2, nil]];

This is all the code I use to add an overlay to the map view, although it does not work, the overlay (MKCircle which I presume is a circle) is not there/visible. I took a look at the HazardMap Apple Sample Code and it looks like they have created a few other classes for setup. Is this necessary, what is wrong with my code. Thanks!

  • 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-05T05:59:34+00:00Added an answer on June 5, 2026 at 5:59 am

    The radius of a MKCircle is a CLLocationDistance, which represents a distance measurement in meters.
    The horizontal accuracy of a CLLocation is CLLocationAccuracy which represents the accuracy of a coordinate value in meters.

    So, all you need to do is:

    MKCircle *circle = [MKCircle circleWithCenterCoordinate:location.coordinate
                                                     radius:location.horizontalAccuracy];
    

    UPDATE: The overlays are not visible because you created the locations manually, so their horizontal accuracy is zero. You can create a CLLocation with a custom horizontal accuracy using the method -[CLLocation initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:]. Or you may define a minimum radius for the circles (for example 10 meters):

    CLLocationDistance radius = MAX(10, location.horizontalAccuracy);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup file of winform. but i want to change my icon how
I have setup my windows in a certain way. How do I save this
Let's say I have this Hello.scala. object HelloWorld { def main(args: Array[String]) { println(Hello,
I have setup .htaccess to redirect me.example.com to example.com/fun/index.php. This index.php has a session.
I have setup a linked server pointing to an Oracle DB. I want to
I have setup a simple Google Chart by following the example on this page:
This one is driving me batty. I have setup ORM. When I run ORMReload()
I have setup htaccess but i want increase the length of the rule so
I have setup svnserve and for now now I am testing a repository with
I have setup multiple SQL Service Broker Queues in a database but have not

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.