Message Boards Message Boards

How to combine multiple geographic regions into one?

I don't know how to combine multiple geographic regions into one? I have tried RegionUnion and GeoGroup, but they still seem to be separate regions.

GeoGraphics@
 GeoGroup@ParallelMap[
   GeoDisk[#, Quantity[10, "Kilometers"]] &, {GeoPosition@
     ToExpression@{40.6, -73.9}, 
    GeoPosition@ToExpression@{40.7, -73.9}}]

GeoGraphics@
 RegionUnion@
  ParallelMap[
   GeoDisk[#, Quantity[10, "Kilometers"]] &, {GeoPosition@
     ToExpression@{40.6, -73.9}, 
    GeoPosition@ToExpression@{40.7, -73.9}}]
POSTED BY: Tsai Ming-Chou
5 Replies
Posted 4 years ago

Look at the result of evaluating

RegionUnion[p1, p2]

It is of the form

RegionUnion[Polygon[{GeoPosition[{40.6901, -73.9}], GeoPosition[{40.69, -73.8979}],...]

Polygon requires a list of coordinates, the replacement rule /. GeoPosition -> Identity removes the GeoPosition

GeoPosition[{40.6901, -73.9}] /. GeoPosition -> Identity
(* {40.6901, -73.9} *)

So the final result is the union of the polygons. Another way to do it

RegionUnion[p1, p2] /. GeoPosition[x_] :> x
POSTED BY: Rohit Namjoshi

I finally understand the meaning of the list of coordinates! Thank you so much~~ Unravel the fog in my heart!

POSTED BY: Tsai Ming-Chou

Thanks to Henrik Schachner. Now, I can apply it to more complex situations. But I still can't understand the purpose of GeoPosition -> Identity, can it be explained briefly?

POSTED BY: Tsai Ming-Chou

@Rohit Namjoshi: Thank you for this interesting link! According to this my solution would read like so:

{p1, p2} = 
  Polygon[Table[GeoDestination[GeoPosition@#, GeoDisplacement[{Quantity[10, "Kilometers"], b}]], {b, 0, 360, 1}]] & /@ {{40.6, -73.9}, {40.7, -73.9}};
reg = RegionUnion[p1, p2] /. GeoPosition -> Identity;
geoReg = Map[GeoPosition, reg, {2}];
GeoGraphics[geoReg]

enter image description here

POSTED BY: Henrik Schachner
Posted 4 years ago

One way is to convert the regions to polygons and then use RegionUnion. See this post for an example.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract