6
$\begingroup$

I've been struggling to figure out the correct GeoGraphics options to get the desired results. Here's what I have so far and the results that I'm getting:

 g = Show[ Graphics[{}, ImageSize -> {Automatic, 1000}], GeoGraphics[GeoRange -> "World", GeoCenter -> {60, 0}, GeoProjection -> "Orthographic", GeoGridLines -> Quantity[20, "AngularDegrees"], GeoGridLinesStyle -> {AbsoluteThickness[1], AbsoluteThickness[1]}, GeoBackground -> {"CountryBorders", "Land" -> LightGray, "Ocean" -> White, "Border" -> Black} ], GeoGraphics[{GeoStyling[Opacity[0.1]], EdgeForm[{Black, AbsoluteThickness[7]}], DayHemisphere[{2020, 01, 01, 15}]}] ]; Magnify[g, 0.5] 

And here's the result:

orthographically projected map

Rather than being the expected hemisphere, it's a wacky shape.

$\endgroup$
8
  • $\begingroup$ Could you specify what you mean by "the desired results"? $\endgroup$ Commented Jan 10, 2021 at 22:16
  • $\begingroup$ Off the top of my head my guess is that the "globe" there has no opacity and you're seeing the part of the disk that you'd expect to be occluded as well as the side you expect to see. $\endgroup$ Commented Jan 10, 2021 at 22:26
  • $\begingroup$ @CarlLange The side where the sun doesn't shine is a circle. $\endgroup$ Commented Jan 10, 2021 at 22:44
  • $\begingroup$ Do you get the expected results if you use an equirectangular projection? $\endgroup$ Commented Jan 10, 2021 at 23:00
  • 1
    $\begingroup$ Entering the center coordinate in GeoProjection instead of GeoCenter results in a smoother shape: GeoProjection -> {"Orthographic", "Centering" ->GeoPosition[{60, 0}]}. $\endgroup$ Commented Jan 11, 2021 at 0:32

1 Answer 1

10
$\begingroup$

I think what's causing the issue is that the hemisphere polygon boundary is being folded over itself. One such workaround is to triangulate this polygon.

We can convert DayHemisphere to Polygon by going under the hood with GeoGraphics`GeoEvaluate, and then to a fine union of triangles with DiscretizeRegion.

tris = DiscretizeRegion[ GeoGraphics`GeoEvaluate[DayHemisphere[{2020, 01, 01, 15}]], MaxCellMeasure -> 10]; MeshCellCount[tris] 
{4168, 11275, 7108} 
p = MeshPrimitives[tris, 2][[All, 1]]; gp = Apply[{Mod[#1, 180, -90], Mod[#2, 360, -180]} &, Reverse[p, {3}], {2}]; GeoGraphics[{GeoStyling[{Red, Opacity[0.5]}], {EdgeForm[], Polygon[GeoPosition[gp]]}, {AbsoluteThickness[7], DayNightTerminator[{2020, 01, 01, 15}]}}, GeoRange -> "World", GeoProjection -> "Orthographic", GeoCenter -> {60, 0}, GeoGridLines -> Quantity[20, "AngularDegrees"], GeoGridLinesStyle -> {AbsoluteThickness[.5], AbsoluteThickness[.5]}, GeoBackground -> {"CountryBorders", "Land" -> LightGray, "Ocean" -> White, "Border" -> Directive[Black, AbsoluteThickness[.15]]}] 

$\endgroup$
7
  • $\begingroup$ Very promising. One remaining issue is how to find the triangle edges and, at the same time, show the boundary, $\endgroup$ Commented Jan 11, 2021 at 2:01
  • 1
    $\begingroup$ What do you mean by boundary? That's what the DayNightTerminator is for. $\endgroup$ Commented Jan 11, 2021 at 2:07
  • 1
    $\begingroup$ I mean in terms of formatting. How do I make it thick as in my example? $\endgroup$ Commented Jan 11, 2021 at 2:36
  • $\begingroup$ Ah, I forgot to add that part. See my edit. $\endgroup$ Commented Jan 11, 2021 at 2:45
  • $\begingroup$ Thanks! For me, the edges disappear only when I do EdgeForm[Opacity[0]] $\endgroup$ Commented Jan 11, 2021 at 3:14

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.