Distance measures on a map of a game

enter image description here

Both tasks you outlined could be fused into a single app - screenshot is above. I assume that because this is a game the corrections due to geodetic model (flat map from non-flat planet surface) do not really matter (this was not mentioned in the project description). Here is a quite simple code to get you started that you can modify and upgrade.

i = Import["https://i.stack.imgur.com/TVsMy.jpg"];

Manipulate[
    Column[{
    Style["Advantures will take you "<>
        ToString[Round[.7595 RegionMeasure[N[Line[pt]]],.01]]
        <>" miles",20,FontFamily->"Herculanum"],
    HighlightImage[i,{Thickness[.003],Dashing[.01],
        Line[pt],
        Circle[pt[[1]],EuclideanDistance@@pt[[;;2]]]},
    ImageSize->800]
    },Alignment->Center],
{{pt,{{1610,100},{2005,100}}},Locator,LocatorAutoCreate->True}]

A few things to take a note:

  • In addition to the distance between 2 points you can build a whole path and measure its length.

  • Add or remove more path points with CMD(ALT)+CLICK on Mac (Win).

  • Decreasing image size will make your app faster

  • Scaling factor in front of RegionMeasure can be adjusted to match map scale. It is done by simply running app for the firs time when in initial stage the path is equal to the map scale length (see next image below). Then adjust the scaling factor so number in the title is equal to the number on the map scale.

  • In the initial state there are only 2 points and a circle centered at 1st and passing through 2nd. Dragging locators around and see how number in the title changes effectively solves your second task. Place 1st point at a needed location and then drag 2nd to measure needed radius that is indicated in the plot title and you get the circle you need.

enter image description here


I have some advice, but it is just that, and not a solution to your problem.

  • Decide on a geodetic model for the world you are mapping. I recommend picking one of the geodetic models of planet Earth that Mathematica recognizes.
  • Decide on what the projection from a sphere to your map grid will be.
  • Use the built-in functions GeoGridPosition and GeoPosition to transform coordinates between the grid (map) and the model (sphere).
  • Look at GeoProjectionData to learn about Mathematica knows about projections.

Note: depending on the projection you choose, a circle about a point on sphere may not appear as a circle on your map.

BTW, nice looking map.