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!

| improve this question | | | | |
$\endgroup$
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

| improve this answer | | | | |
$\endgroup$
  • $\begingroup$ Thanks, that was the function I was trying to find $\endgroup$ – Reedinationer Feb 19 '19 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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