14
$\begingroup$

I'm having a small problem with GeoDistance.

I've chosen a target city – San Francisco – and I've computed distances from SF to five other cities. Then I draw circles around each city, with radius equal to the distance to San Francisco. The circles should all intersect at the same point. However, zooming in, we see that they're off by several hundred feet:

sf = SemanticInterpretation["SF"];
names = {"NYC", "Paris", "Buenos Aires", "Mumbai", "Moscow"};
cities = SemanticInterpretation /@ names;

GeoGraphics[
 Table[
  GeoCircle[c, GeoDistance[sf, c, DistanceFunction -> "Center"]],
  {c, cities}
  ]
 ]
Show[%, GeoCenter -> sf, GeoRange -> Quantity[100, "Miles"]]
Show[%, GeoCenter -> sf, GeoRange -> Quantity[1, "Miles"]]

enter image description here

enter image description here

enter image description here

Is it possible to make them intersect better? Possibly by forcing GeoDistance to use a spherical Earth model, or some other option magic?

The closest previous post I could find was this one.

$\endgroup$

1 Answer 1

8
$\begingroup$

The problem here is that the geo circle is being resolved into a line as if you were drawing the full primitive, with insufficient resolution for very low scales. To alleviate that, use segments of the geo circle. Let me use the geo positions defined for the entities:

sfpos = GeoPosition[sf];
citiespos = GeoPosition /@ cities;

These are the primitives to draw, for a given angular aperture ap:

prims[ap_] := {GeoMarker[sfpos], 
 Table[
  GeoCircle[c, GeoDistance[sfpos, c], GeoDirection[c, sfpos] + {-ap, ap}], 
  {c, citiespos}]};

This was your example:

GeoGraphics[{GeoMarker[sfpos], prims[Quantity[0.1, "AngularDegrees"]]},    
 GeoRange -> Quantity[1, "Miles"], 
 GeoCenter -> sfpos, 
 GeoScaleBar -> "Imperial"]

enter image description here

And now at a much lower scale:

GeoGraphics[{GeoMarker[sfpos], prims[Quantity[0.0001, "AngularDegrees"]]}, 
 GeoRange -> Quantity[10, "Feet"], 
 GeoCenter -> sfpos, 
 GeoScaleBar -> "Imperial"]

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Thanks. It's a bit alarming that GeoCircles with identical centers and radii but different arc lengths don't display on top of each other, e.g., p = {10, -110}; r = 3*^6; GeoGraphics[{GeoCircle[p, r, {0, 10}], GeoCircle[p, r, {0, 200}]}, GeoCenter -> {37.08, -109.43}, GeoRange -> 1600] $\endgroup$ Nov 1, 2016 at 16:33
  • $\begingroup$ We will improve the rendering of geo circles and geo disks to make them have a more appropriate resolution automatically. Thanks for your post! $\endgroup$
    – jose
    Nov 1, 2016 at 17:50
  • 2
    $\begingroup$ You are awesome @jose! Btw, here is the video I was making that features your clever workaround. $\endgroup$ Nov 1, 2016 at 18:55
  • $\begingroup$ Nice video! Thanks for letting us know about it. $\endgroup$
    – jose
    Nov 1, 2016 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.