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?
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.
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]}]
Check the documentation on GeoGraphics
and GeoRange
for how to zoom out.
Use GeoDistance
for the distance between the cities.
GeoDistance[wes, jer] (* Quantity[5526.35, "Miles"] *)
Answered by LouisB on January 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP