3
$\begingroup$

I am trying to plot mountains' elevation on a map. Right now, I have a 2D image generated using the code as shown below. I hope to create a 3D plot, on which, at z=0 is the map, and at each coordinate where there is a mountain, the elevation of that mountain is represented as a bar(or thin line) whose height is the mountain elevation.

mnh = {Entity["Mountain", "BarrettMountain::3kp8s"], 
   Entity["Mountain", "BartlettHaystack::38c83"], 
   Entity["Mountain", "BayleMountain::pxgy3"], 
   Entity["Mountain", "BearMountain::5r473"], 
   Entity["Mountain", "BelknapMountain::2c52p"], 
   Entity["Mountain", "BlackCap::stw8t"], 
   Entity["Mountain", "BlackCrescentMountain::9kv2y"], 
   Entity["Mountain", "BlueJob::7k6mc"], 
   Entity["Mountain", "Bondcliff"], 
   Entity["Mountain", "BoottSpur::cn623"], 
   Entity["Mountain", "CannonMountain::ctp49"], 
   Entity["Mountain", "CarterDome"], 
   Entity["Mountain", "CrotchedMountain::34sd3"], 
   Entity["Mountain", "EastmanMountain::72n76"], 
   Entity["Mountain", "EastPeak::mq29m"], 
   Entity["Mountain", "GaleheadMountain::4sm7n"], 
   Entity["Mountain", "GapMountain::pdxy9"], 
   Entity["Mountain", "GunstockMountain::m3drm"], 
   Entity["Mountain", "ImpMountain::xq742"], 
   Entity["Mountain", "KearsargeNorth::48k2t"], 
   Entity["Mountain", "KidderMountain::6n368"], 
   Entity["Mountain", "LarcomMountain::229k6"], 
   Entity["Mountain", "LittleHaystackMountain::pb363"], 
   Entity["Mountain", "LittleMonadnockMountain::79k9k"], 
   Entity["Mountain", "LoonMountain::pz4tf"], 
   Entity["Mountain", "LovewellMountain::hdrr3"], 
   Entity["Mountain", "MiddleCarterMountain::xry6p"], 
   Entity["Mountain", "MiddleMoriahMountain::t4g69"], 
   Entity["Mountain", "MineHill::8jh85"], 
   Entity["Mountain", "MooseMountain::628t9"], 
   Entity["Mountain", "MountArfield"], 
   Entity["Mountain", "MountAvalon::2q623"], 
   Entity["Mountain", "MountBlue::7584f"], 
   Entity["Mountain", "MountBond"], 
   Entity["Mountain", "MountCabot::pd355"], 
   Entity["Mountain", "MountCardigan::jfn3z"], 
   Entity["Mountain", "MountCarrigain"], 
   Entity["Mountain", "MountChocorua"], 
   Entity["Mountain", "MountClay::68jcg"], 
   Entity["Mountain", "MountCrescent::5323x"], 
   Entity["Mountain", "MountDavis::3gy56"], 
   Entity["Mountain", "MountDoublehead::7v4c8"], 
   Entity["Mountain", "MountEisenhower::w8t5t"], 
   Entity["Mountain", "MountField::8x8xp"], 
   Entity["Mountain", "MountFlume::2f974"], 
   Entity["Mountain", "MountFranklin::6bwfh"], 
   Entity["Mountain", "MountGuyot::skb7j"], 
   Entity["Mountain", "MountHale::x2s5c"], 
   Entity["Mountain", "MountHight::6252v"], 
   Entity["Mountain", "MountIsolation"]};
GeoGraphics[{Red, PointSize[0.01], Point[mnh]}, ImageSize -> 500]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ What have you tried so far? What are you having trouble with? $\endgroup$ Commented Oct 9, 2020 at 4:10

1 Answer 1

3
$\begingroup$

This needs some hacking.

First, we get the list of entities and call it: mnh.

Second we create the image using GeoGraphics and call it: im. Then we transform this 2D image to a 3D image and call it: im3,

Next we want to get the vertical lines for the heights. Here we meet a problem. The positions of the mountains are given in Lat/Long, but the image coordinates are given in pixels. therefore we need a function to transform the coordinates, call it: trans. With it we can calculate the image coordinates of the mountains. With the use of this functions, we can assemble the lines depicting the mountain elevations. The coordinates and elevations of the mountain we get from the properties: "Coordinates" and "Elevation" of the Entities. Here is the code, you may different parameters to adapt it to your needs:

mnh = {Entity["Mountain", "BarrettMountain::3kp8s"], 
   Entity["Mountain", "BartlettHaystack::38c83"], 
   Entity["Mountain", "BayleMountain::pxgy3"], 
   Entity["Mountain", "BearMountain::5r473"], 
   Entity["Mountain", "BelknapMountain::2c52p"], 
   Entity["Mountain", "BlackCap::stw8t"], 
   Entity["Mountain", "BlackCrescentMountain::9kv2y"], 
   Entity["Mountain", "BlueJob::7k6mc"], 
   Entity["Mountain", "Bondcliff"], 
   Entity["Mountain", "BoottSpur::cn623"], 
   Entity["Mountain", "CannonMountain::ctp49"], 
   Entity["Mountain", "CarterDome"], 
   Entity["Mountain", "CrotchedMountain::34sd3"], 
   Entity["Mountain", "EastmanMountain::72n76"], 
   Entity["Mountain", "EastPeak::mq29m"], 
   Entity["Mountain", "GaleheadMountain::4sm7n"], 
   Entity["Mountain", "GapMountain::pdxy9"], 
   Entity["Mountain", "GunstockMountain::m3drm"], 
   Entity["Mountain", "ImpMountain::xq742"], 
   Entity["Mountain", "KearsargeNorth::48k2t"], 
   Entity["Mountain", "KidderMountain::6n368"], 
   Entity["Mountain", "LarcomMountain::229k6"], 
   Entity["Mountain", "LittleHaystackMountain::pb363"], 
   Entity["Mountain", "LittleMonadnockMountain::79k9k"], 
   Entity["Mountain", "LoonMountain::pz4tf"], 
   Entity["Mountain", "LovewellMountain::hdrr3"], 
   Entity["Mountain", "MiddleCarterMountain::xry6p"], 
   Entity["Mountain", "MiddleMoriahMountain::t4g69"], 
   Entity["Mountain", "MineHill::8jh85"], 
   Entity["Mountain", "MooseMountain::628t9"], 
   Entity["Mountain", "MountArfield"], 
   Entity["Mountain", "MountAvalon::2q623"], 
   Entity["Mountain", "MountBlue::7584f"], 
   Entity["Mountain", "MountBond"], 
   Entity["Mountain", "MountCabot::pd355"], 
   Entity["Mountain", "MountCardigan::jfn3z"], 
   Entity["Mountain", "MountCarrigain"], 
   Entity["Mountain", "MountChocorua"], 
   Entity["Mountain", "MountClay::68jcg"], 
   Entity["Mountain", "MountCrescent::5323x"], 
   Entity["Mountain", "MountDavis::3gy56"], 
   Entity["Mountain", "MountDoublehead::7v4c8"], 
   Entity["Mountain", "MountEisenhower::w8t5t"], 
   Entity["Mountain", "MountField::8x8xp"], 
   Entity["Mountain", "MountFlume::2f974"], 
   Entity["Mountain", "MountFranklin::6bwfh"], 
   Entity["Mountain", "MountGuyot::skb7j"], 
   Entity["Mountain", "MountHale::x2s5c"], 
   Entity["Mountain", "MountHight::6252v"], 
   Entity["Mountain", "MountIsolation"]};
GeoGraphics[{Red, PointSize[0.01], Point[mnh]}, ImageSize -> 500];

im = GeoGraphics[{Red, PointSize[0.01], Point[mnh]}, ImageSize -> 500];
im3 = Image3D[{Image[im]}];

trans = RescalingTransform[
   im[[15, 2, 2, 2]], {0, #} & /@ Most@ImageDimensions[im3]];
lines = Line[{Append[t = trans[Reverse[#["Coordinates"]]], 0], 
      Append[t, #["Elevation"][[1]]]}] & /@ mnh;
Show[{im3, Graphics3D[{Blue, lines}]}, BoxRatios -> {1, 1, 1}, 
 SphericalRegion -> True, PlotRange -> All, ImageSize -> 600]

enter image description here

$\endgroup$
2
  • $\begingroup$ Wow, thank you Daniel, this looks great. I am thinking of putting this function onto the Functional Repository. I can help you to do it and make sure the credits goes to you. $\endgroup$ Commented Oct 9, 2020 at 13:16
  • $\begingroup$ Thank,s, but try it out first. Usually a lot of new ideas pop up. And you can certainly put it on the repository, I do not need any credits. And only to mention it, this is a quick and dirty fix not a full grown program. $\endgroup$ Commented Oct 9, 2020 at 16:00

Your Answer

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

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