TransWikia.com

How can I plot various points on a world map and compare distances?

Mathematica Asked by DeathPunch on January 20, 2021

How can I plot various points on a world map and compare distances?
For example, the distance between Jerusalem and Westford, MA compared to the distance between Westford, MA and Recife, Brasil? Then for a triangulation of the three points and measure the difference of distance between the three points?

One Answer

Entering Cities as Entities

For the cities, the following can be used

wes = Entity["City", {"Westford", "Massachusetts", "UnitedStates"}]
jer = Entity["City", {"Jerusalem", "Jerusalem", "Israel"}]
rec = Entity["City", {"Recife", "Pernambuco", "Brazil"}]

These input forms can be discovered by evaluating, for example, InputForm @ Ctrl= Recife, where Ctrl= means the control key + equal sign.

Plotting with GeoMarkers

Use GeoMarkers for plotting the city locations. Use GeoPath for the paths. See the documentation for the various path options.

GeoGraphics[{GeoMarker /@ {wes, jer, rec},
  GeoPath /@ Subsets[{rec, jer, wes}, 2]}]

enter image description here

Check the documentation on GeoGraphics and GeoRange for how to zoom out.

Distance

Use GeoDistance for the distance between the cities.

GeoDistance[wes, jer]   (*  Quantity[5526.35, "Miles"]  *)

Answered by LouisB on January 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP