3
$\begingroup$

I am trying to plot text on a GeoGraphic[] at a certain distance from a defined point (located at Interpreter["Airport"]["KEWR"] for instance). I have tried to do this as such:

Text["New York",
    GeoPosition[Interpreter["Airport"]["KEWR"] +
    GeoDisplacement[Quantity[50, "NauticalMiles"], Quantity[0, "AngularDegrees"]]]]    

Thinking this would write "New York" 50 nautical miles away from the airport of KEWR by first locating KEWR and then adding a displacement distance in the direction defined. Yet this fails with

LatitudeLongitude: GeoPosition[Interpreter["Airport"]["KEWR"] + GeoDisplacement[50 nmi, 0°]] is not a valide location specification

As well I have tried to wrap my Interpreter in a GeoPosition[] function such as:

Text["New York",
    GeoPosition[GeoPosition[Interpreter["Airport"]["KEWR"]] +
    GeoDisplacement[Quantity[50, "NauticalMiles"], Quantity[0, "AngularDegrees"]]]]

But that just changes the error to

LatitudeLongitude: GeoPosition[GeoPosition[{40.6925, -74.7687}] + GeoDisplacement[50 nmi, 0°]] is not a valide location specification

I'm sure there has to be a better way to accomplish this, but I can't seem to find the appropriate function within the documentation. Thanks for your help and time!

$\endgroup$

1 Answer 1

5
$\begingroup$

Use GeoDestination, which takes a location and vector as arguments.

kewr = Interpreter["Airport"]["KEWR"];
textloc = GeoDestination[kewr, GeoDisplacement[{Quantity[50, "NauticalMiles"], Quantity[0, "AngularDegrees"]}]];

GeoGraphics[{
  GeoMarker[kewr],
  Text[
    Style[Framed["New York", Background -> GrayLevel[.4, .3], FrameMargins -> 0, FrameStyle -> None, RoundingRadius -> 5], Bold, 20, ColorData[112, 1]], 
    textloc
  ]
 },
 GeoRangePadding -> Quantity[100, "Miles"]
]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks, that was the function I was trying to find $\endgroup$ Feb 19, 2019 at 18:56

Your Answer

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

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