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}}]
One way is to convert the regions to polygons and then use RegionUnion. See this post for an example.
@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]
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?
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
I finally understand the meaning of the list of coordinates!
Thank you so much~~ Unravel the fog in my heart!