To get the polygon boundary, I would go back to whatever created the map.
You can get boundaries from ImageMagick, eg (Windows BAT syntax):
Code: Select all
convert ^
huge.png ^
h.png ^
-compose Difference -composite ^
-fill White +opaque Black ^
-morphology EdgeIn disk:1 ^
-transparent Black ^
sparse-color:edge.txt
This finds the difference between the original and one filled area (from my first script), makes the area white, finds the edge, and lists all the pixels in the edge. [EDIT: I incorrectly said that this is a polygon.] The coordinates would need processing to change the order into a polygon.
You might use potrace to convert the area to vectors, and simplify the vectors, but that is more difficult.