# GeoGraphics Day/Night way off

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:

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

• Could you specify what you mean by "the desired results"? Jan 10, 2021 at 22:16
• 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. Jan 10, 2021 at 22:26
• @CarlLange The side where the sun doesn't shine is a circle. Jan 10, 2021 at 22:44
• Do you get the expected results if you use an equirectangular projection? Jan 10, 2021 at 23:00
• Entering the center coordinate in GeoProjection instead of GeoCenter results in a smoother shape: GeoProjection -> {"Orthographic", "Centering" ->GeoPosition[{60, 0}]}. Jan 11, 2021 at 0:32

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 GeoGraphicsGeoEvaluate, and then to a fine union of triangles with DiscretizeRegion.

tris = DiscretizeRegion[
GeoGraphicsGeoEvaluate[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]]}]


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