Message Boards Message Boards

Combine GeoGraphics to see US borders on ReliefMap

Posted 10 years ago

I am trying to produce a GeoGraphic showing the horizon view from a rocket at the edge of space. On top of the horizon I am trying to overlay the outline of state and province boundaries to provide some reference.

The horizon view I am looking for is a circular shaped relief map of the visible horizon. Using the following code I am able to produce the horizon view I am looking for except it is missing the state boundaries:

horizon = GeoGraphics[{GeoStyling["ReliefMap"], EdgeForm[Black], 
GeoVisibleRegion[{44.0519, -123.0867,  Quantity[100, "Kilometers"]}]}, 
GeoBackground -> None]

I am able to produce the outline of the state boundaries I desire and my horizon view, but I am unable to remove, or cut away, the unnecessary geography with this code:

states={I am using the administrative entity value for the western states};

GeoGraphics[
 {GeoStyling["ReliefMap"], EdgeForm[Black], Polygon[states], 
  GeoVisibleRegionBoundary[{44.0519, -123.0867, 
    Quantity[100, "Kilometers"]}]}]

An altternate attempt:

GeoGraphics[{GeoStyling["ReliefMap"], EdgeForm[Black],
  GeoVisibleRegion[{44.0519, -123.0867, Quantity[100, "Kilometers"]}],
  EdgeForm[Black], Polygon[states] }, GeoBackground -> None ]

Any suggestions?

POSTED BY: Jon Rogers
3 Replies

Try this:

visible = GeoVisibleRegion[{44.0519, -123.0867, Quantity[100, "Kilometers"]}];

states = GeoEntities[visible, "AdministrativeDivision1"];

geographics = GeoGraphics[{EdgeForm[Black], FaceForm[], Polygon[states]}, 
GeoBackground -> "ReliefMap", GeoRange -> visible, GeoProjection -> "Equirectangular"];

image = Rasterize[First[geographics], "Image", RasterSize -> 1000];

GeoGraphics[{GeoStyling[{"GeoImage", image}], EdgeForm[Black], visible}, GeoBackground -> None]

enter image description here

Posted 10 years ago

Thank you. That was exactly what I was looking for. I am going to have to reverse engineer your code to fully understand how to repeat this in the future.

POSTED BY: Jon Rogers

The basic idea is using GeoGraphics twice. This basically allows you to put any part of a map inside any geo polygon of another map.

The first GeoGraphics produces a rectangular map (in lat-lon coordinates; note the use of GeoProjection->"Equirectangular") with the exact lat-lon ranges corresponding to the region your are interested in (note the use of GeoRange->visible). The result is given as a GeoGraphics[Graphics[...], ...] object. We take the Graphics[...] and rasterize it as an Image with enough resolution.

Finally, with the second GeoGraphics, we take the resulting Image and place it inside the geo visible region using GeoStyling[{"GeoImage", image}]. Note the use of "GeoImage" (instead of the alternative "Image"); this is to project that image to the geo projection chosen by the second GeoGraphics.

If you have questions about the process, do not hesitate to ask.

Jose.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract