9
$\begingroup$

I evaluated this.

{lon1, lat1} = {-76.4408, 38.0825};
{lon2, lat2} = {-76.5054, 38.1413};
{lon3, lat3} = {-76.3546, 38.2446};
{lon4, lat4} = {-76.2900, 38.18582};
dir12 = GeoDirection[{lat1, lon1}, {lat2, lon2}];
dir23 = GeoDirection[{lat2, lon2}, {lat3, lon3}];
dir34 = GeoDirection[{lat3, lon3}, {lat4, lon4}];
dir41 = GeoDirection[{lat4, lon4}, {lat1, lon1}];
{dir12 - dir41,
  dir41 - dir34 + Quantity[360, "AngularDegrees"],
  dir23 - dir12,
  dir34 - dir23
}

Right angles

So each corner is approximately 90 degrees. However, below it looks like the corners at the top and bottom are about 98 degrees and the corners on the left and right look to be about 82 degrees.

GeoGraphics[{
   Polygon[{{lon1,lat1},{lon2,lat2},{lon3,lat3},{lon4,lat4}}]},
   GeoRange->{{38.073,38.255},{-76.515,-76.28}}
]

GeoGraphics

I have macOS v10.15.7 (Catalina) and...

$Version
12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)

How can I make the rectangle in this GeoGraphics look like a rectangle?

$\endgroup$

2 Answers 2

12
$\begingroup$

Mathematica is defaulting to a non-conformal projection. (A "conformal" projection is one for which angles on the map are equal to angles on the Earth's surface.) The reason, and the solution, are buried deep in the GeoProjection documentation:

When one or more non-geographic primitives appear and no projection is explicitly requested, the equirectangular projection is always used. [The equirectangular projection is non-conformal—ed.] Use GeoDisk, Line[{GeoPosition[…], …}], etc. to place correctly projected primitives on the map:

GeoGraphics[Polygon[
   {GeoPosition[{lat1, lon1}], GeoPosition[{lat2, lon2}], 
    GeoPosition[{lat3, lon3}], GeoPosition[{lat4, lon4}]}]]

enter image description here

I should note that trying to explicitly specify the projection using the option GeoProjection -> "LambertAzimuthal" or the like does not seem to work.1

Finally, note that v12.2 includes GeoPolygon, use of which makes the above code a bit less cumbersome.


1 Note to pedants: Yes, I know that the Lambert azimuthal projection isn't conformal either, but it's pretty darn close at the center of the projection, and this map is small enough that it doesn't really matter.

$\endgroup$
1
  • 3
    $\begingroup$ The conformal projections are given by GeoProjectionData["Conformal"] $\endgroup$
    – Bob Hanlon
    Oct 29, 2021 at 4:27
2
$\begingroup$

A more concise version of what Michael Seifert provided works.

GeoGraphics[Polygon[GeoPosition@{
  {{lat1,lon1},{lat2,lon2},{lat3,lon3},{lat4,lon4}}
}]]

enter image description here

$\endgroup$

Your Answer

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

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