5
$\begingroup$

Good afternoon! I am trying to draw a shaded ring on a map.

The first step I tried was a simple disk. I achieved this with the following:

GeoGraphics[GeoDisk[Here, Quantity[10,"Miles"]]]

This uses a single GeoDisk. I thought I could use a RegionDifference to get an annulus (as I believe it's called). However, this seems to only be for Disk symbols (not GeoDisk).

GeoGraphics[
  RegionDifference[
    GeoDisk[Here, Quantity[10.5,"Miles"]],
    GeoDisk[Here, Quantity[11.5,"Miles"]]]]

This fails with "...is not a correctly specified region."

Then I thought I might use a GeoCircle, setting the thickness to 1 mile, but it seems you can only specify something like "Thick", not a geographical distance.

I don't have much experience with Wolfram Language, but this is what I've tried so far. I've also found the GeoGraphics tutorial and the Maps & Cartography guide related and useful. So, am I missing something to achieve what I want [a 10-mile radius shaded ring with a thickness of 1 mile]?

$\endgroup$
10
$\begingroup$

You can use something like this:

p = Entity["City", {"NewYork", "NewYork", "UnitedStates"}];
rOut = Quantity[2000, "Miles"];
rIn = Quantity[1000, "Miles"];

GeoGraphics[FilledCurve[{{GeoCircle[p, rOut]}, {GeoCircle[p, rIn]}}], GeoGridLines -> True]

enter image description here This solution will also be valid with any projection.

$\endgroup$
  • $\begingroup$ Very nice, I am surprised FilledCurve works with GeoGraphics primitives, it is not documented ... and you can even fill it with texture ! $\endgroup$ – SquareOne Sep 21 '17 at 8:13
  • 2
    $\begingroup$ GeoGraphics is basically an extension of Graphics, and it inherits the Graphics capabilities. You can see GeoGraphics as Graphics on the projected map space, with the added ability of pre-converting anything on the surface of the Earth to the flat map space using the geoprojection. $\endgroup$ – jose Sep 21 '17 at 13:04
  • $\begingroup$ FilledCurve, perfect! Thank you for your answer. $\endgroup$ – seth10 Sep 21 '17 at 15:09
  • $\begingroup$ Jose, here's an off topic report: GeoGraphics[{AbsolutePointSize@12, Point[{-149., 63.}]}, GeoRange -> Entity["Country", "Mexico"]] $\endgroup$ – Kuba Oct 20 '17 at 22:14
  • 1
    $\begingroup$ Do you mean GeoGraphics[{AbsolutePointSize@12, Point[GeoPosition[{63., -149.}]]}, GeoRange -> Entity["Country", "Mexico"]] ? GeoRange determines which part of the Earth is shown. PlotRange determines which part of the map is shown. The default of GeoRange is Automatic. The default of PlotRange is All. Point[{x, y}] is a point on the map, and will be included by default. GeoPosition[{lat, lon}] is a point on the Earth, and will be included if it is included in the GeoRange value. $\endgroup$ – jose Oct 22 '17 at 4:57
2
$\begingroup$
GeoGraphics[{Red, Thickness[.2], 
  GeoCircle[Here, Quantity[10, "Miles"]]}, 
 GeoRange -> Quantity[25, "Kilometers"]]

Then you can find me. :)

$\endgroup$
  • $\begingroup$ Thank you for your response! What units are used in Thickness? I'm looking for a 1 mile thickness. Is the .2 in kilometers? $\endgroup$ – seth10 Sep 20 '17 at 19:17
  • 1
    $\begingroup$ The range is 25km,the 0.2 is 20% of 25km $\endgroup$ – yode Sep 20 '17 at 19:20
  • 1
    $\begingroup$ You are in 上海!wow,close to me😂 $\endgroup$ – partida Sep 21 '17 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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