Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating regions on a 2D map

Tags:

algorithm

2d

Are there any good approaches to generating regions for a 2D map? Suppose you have a world map and would like to create country or province borders with a somewhat realistic look.

like image 293
awdz9nld Avatar asked Sep 26 '10 19:09

awdz9nld


4 Answers

I found this blog post (and its two successors) recently, and I think it's quite close to what you're looking for.

http://simblob.blogspot.com/2010/09/polygon-map-generation-part-1.html

He's using his methods to create realistic landscapes but hopefully you can see ways to use the same techniques to group areas into believable regions.

like image 165
Kylotan Avatar answered Nov 18 '22 17:11

Kylotan


Tessellation using a Voroni diagram is one approach, and whilst the shapes can be made quite irregular, it is not very realistic.

like image 34
awdz9nld Avatar answered Nov 18 '22 18:11

awdz9nld


Martin Källman's idea seems the best way to do it since you don't have natural terrain to define some of the borders. Generate random points within your borders and then Voronoi them into country borders. I would probably take it one step further and make more points than desired countries, and then merge several adjacent cells to make some of the resulting areas concave. You could use an algorithm similar to a randomized Kruskal to perform the merging (take all the countries, merge two adjacent countries, repeat until you have the desired total). I can't get to Kylotan's link, but it may describe a better way to merge the cells generated by the Voronoi.

like image 2
McBeth Avatar answered Nov 18 '22 18:11

McBeth


I'd use a scriptable/programmable CAD or Vector illustration package to draw the shapes by hand, then process the data with a custom script into custom data files or directly into source code. In fact I have done this a number of times in the past (usually to generate VB.NET code for creating GraphicsPath objects from CAD line drawings).

Could you be more specific? What kind of format do these regions need to have? What kind of data do you already have?

like image 1
David Rutten Avatar answered Nov 18 '22 16:11

David Rutten