question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The radius of the circle is not accurate

See original GitHub issue

I’ve set a radius of my geofence to 2500 meters. I have a point that its distance to the center of this geofence is 2332.84 meters. So it should be inside the geofence. Here it is in Bokeh: screen shot 2018-06-06 at 4 39 16 pm You can clearly see the point is outside the geofence, however when I verify the distance with Google Maps you can see it’s the same as the one I’ve calculated: screen shot 2018-06-06 at 4 40 27 pm

This is the line of the code:

circle = Circle(x="longitude_deg", y="latitude_deg", radius=2500, fill_color="#ffbdaf", fill_alpha=0.4, line_color="#2471A3")

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, Jan 31, 2020

@arashgmn Because the amount of space taken up by the bottom axis is not the same as the amount of space taken up by the left axis. Therefore the central area in the plot frame is not square, even though the HTML canvas is. Therefore: the pixel aspect ratio and the data aspect ratio do not match.

To demonstrate this, note that setting a large min_border:

plot = figure(x_range=(-10,10), y_range=(-10,10), min_border=100)

will force the interior plot frame to actually be square, and you will see your observed effect go away.

ScreenFlow

Edit:

To be clear, this:

should be of concern whenever the range/scale of the axes are different scales/ranges, unlike my example.

is not the underlying concern. There concern is more generally that the pixel aspect ratio of the plot frame, and the aspect ratio of the data ranges do not match, which can happen with any values of the ranges (yes, even when they are set identical). depending on the pixel dimensions of the frame.

1reaction
bryevdvcommented, Feb 19, 2019

If I’ve asked for radius 10, it should touch my gridlines.

@birdsarah Only if the aspect ratios line up is this true. In your case you should be setting match_aspect=True to force the ranges to adjust so that the screen aspect and data aspect ratios to match. That is the only way to ensure circles are circles in data space (since canvas will always draw circles in pixel space)

I am still unfortunately not sure what is the issue in the gmap case, or what to do about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Circles and Accuracy - Alias workbench
Accurate: Consistent radius value at every point on the circle. ... However it is difficult to get accurate circles with Non-Rational.
Read more >
If the value of pi cannot be determined accurately does that ...
Not accurate. To have an accurate area of the circle, it would mandatory to have an accurate measurement of the radius. This means...
Read more >
Diameter, Radius, & Circumference of Circles (Video & Practice)
This tutorial video and set of practice questions describes the diameter, radius, and circumference of circles. Test your knowledge!
Read more >
Radius, diameter, & circumference | Circles (article)
Learn the relationship between the radius, diameter, and circumference of a circle.
Read more >
Cannot get circle radius correct in OpenLayers - Stack Overflow
You need to one of the above, not both. Try to create the layer without specifying projection , it would use the default...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found