Skip to content

Instantly share code, notes, and snippets.

@aeden
Created September 22, 2010 13:14
Show Gist options
  • Select an option

  • Save aeden/591634 to your computer and use it in GitHub Desktop.

Select an option

Save aeden/591634 to your computer and use it in GitHub Desktop.
ruby-1.8.7-p249 > Geokit::Bounds.from_point_and_radius([53.91848,-122.776584], 4993)
=> #<Geokit::Bounds:0x1050e7580 @ne=#<Geokit::LatLng:0x1050e8e08 @lat=53.897792470202, @lng=-43.4942376451051>, @sw=#<Geokit::LatLng:0x1050e8e58 @lat=-18.265247529798, @lng=-202.058930354895>>
ruby-1.8.7-p249 > Geokit::Bounds.from_point_and_radius([53.91848,-122.776584], 4997)
=> #<Geokit::Bounds:0x1050dee08 @ne=#<Geokit::LatLng:0x1050e0690 @lat=53.8399645290606, @lng=-43.4579700787395>, @sw=#<Geokit::LatLng:0x1050e06e0 @lat=-18.3230754709394, @lng=-202.09519792126>>
@rubyredrick
Copy link

Yep, I'm sure that's the problem.

As I pointed out the diameter either of those circles should be around 90 degrees in latitude, at 40 degrees north each degree of latitude is only 85 km, and at 54 north even less, so the diameter in longitude is greater than 120 degrees

@kmayer
Copy link

kmayer commented Sep 23, 2010

Generalized spherical geometry for navigation has a singularity at each pole. Things get really wonky near the arctic circles, too. 54deg North is pretty "up there" I'd try shrinking your radius to 10km and then increase it again until you see things break.

Also, it depends on which algorithm GeoKit is using. There's a simplified formula which doesn't account for sign changes; it works fine for small ranges and is much faster; it just won't cross poles or the international dateline. In addition, like I said, these formulae start to break down as you get near the poles -- somewhere sine(theta) is approaching 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment