Group Abstract Group Abstract

Message Boards Message Boards

2
|
5.6K Views
|
2 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Calculating a polygon and its center coordinate from an Ellipsoid Arc

Posted 6 years ago
POSTED BY: cray co
2 Replies
Posted 6 years ago

Hi cray co,

This uses the centroid of the sector rather than the mean angle/radius used in @Henrik Schachner 's solution. As expected, the two results are slightly different. The "right" answer depends on your requirements.

center = GeoPosition[{45.530060, -73.547783}];
innerRadius = 245; uncertaintyRadius = 190;
angleRange = {268, (268 + 22)};
outer = GeoDisk[center, innerRadius + uncertaintyRadius, angleRange];
inner = GeoDisk[center, innerRadius, angleRange];

{innerPoints, outerPoints} = 
  Cases[GeoGraphics[#], _Polygon, Infinity] & /* Last /* Last /@ {inner, outer};

{innerPoints, outerPoints} = (GeoPosition[
       GeoGridPosition[#, "Mercator", "ITRF00"]])[[1]] & /@ {innerPoints, outerPoints};

{innerRegion, outerRegion} = 
  DiscretizeGraphics /@ {Polygon@innerPoints, Polygon@outerPoints};

sector = RegionDifference[outerRegion, innerRegion];
centroid = RegionCentroid@sector;

GeoGraphics[{outer, inner, GeoMarker@GeoPosition@centroid}, ImageSize -> 700]

enter image description here

POSTED BY: Rohit Namjoshi

Here comes a first guess how this could be done - easily - in Wolfram Language:

pos = GeoPosition[{45.530060, -73.547783}];
rInner = Quantity[245, "Meters"];
rOuter = Quantity[245 + 190, "Meters"];
\[Phi]1 = 268 ;
\[Phi]2 = (268 + 22) ;
center = GeoDestination[pos, 
   GeoDisplacement[{Mean[{rInner, rOuter}], 
     Mean[{\[Phi]1, \[Phi]2}]}]];
GeoGraphics[{Thick, Red,
  GeoCircle[pos, rOuter, {\[Phi]1, \[Phi]2}],
  GeoCircle[pos, rInner, {\[Phi]2, \[Phi]1}],
  GeoPath[{GeoDestination[pos, GeoDisplacement[{rInner, \[Phi]1}]], 
    GeoDestination[pos, GeoDisplacement[{rOuter, \[Phi]1}]]}], 
  GeoPath[{GeoDestination[pos, GeoDisplacement[{rInner, \[Phi]2}]], 
    GeoDestination[pos, GeoDisplacement[{rOuter, \[Phi]2}]]}], 
  GeoMarker[center], pos}, ImageSize -> 700]

enter image description here

Isn't Mathematica just great ?!

POSTED BY: Henrik Schachner