Message Boards Message Boards

0
|
8694 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Combining Geo Polygons?

Posted 10 years ago

I've been playing around with some of the Geo* features in Mathematica 10, and I've come across something that seems like it should be simple to do, but I can't quite see how.

If you want to see a map of all the countries in the European Union, it's straightforward:

GeoListPlot[EntityClass["Country", "EuropeanUnion"]]

This will produce a nice map of all the countries in the EU:

EU Map

However, I'd like to see a map with the polygons joined anywhere they touch. That is, most of continental Europe should be one large polygon, no visible border between Sweden and Finland, etc etc. Is there a simple way to accomplish this, or am I doomed to have internal borders?

POSTED BY: Ben Hammerslag
4 Replies

I've found a solution to my issue, though I'm ashamed to say I didn't find it sooner. It's not an obvious solution, but it is provided under "Possible Issues" in the GeoGraphics Mathematica 10 documentation. To combine polygons:

multipoly = Polygon[GeoPosition[
Join @@ (EntityValue[EntityClass["Country", "Europe"], 
    "Polygon"] /. Polygon[GeoPosition[x_]] :> x)]];

Glad to see a previously-unsolved issue is now a one-liner in the documentation.

POSTED BY: Ben Hammerslag
Posted 10 years ago

Do you have example code with output? The snippet doesn't get to the goal.

POSTED BY: Douglas Kubler
Posted 10 years ago

No matter what you plot the underlying image has borders. You can suppress the edges and hype up the color to obscure the underlying map. Your taste may vary.

GeoListPlot[EntityClass["Country", "EuropeanUnion"],  PlotStyle -> Directive[EdgeForm[], Opacity[.9]]]

I could add an overall edge if I had documentation on how to add my own "country".

enter image description here

POSTED BY: Douglas Kubler
Posted 10 years ago

I'd look into GeoGroup.

Otherwise you can form a union (sic) of any two polygon regions with a common vertex and delete all common edges.

POSTED BY: Douglas Kubler
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