I am using Google Maps v3 and I need to add border lines for different areas to my map. For example, in Google Maps all the US State borders are shown automatically. I need
I found it difficult to find border/boundary data on Internet - even for well-known boundaries like Canadian provinces. Try using Google Maps Engine. Draw your borders on the map as closed polygons. Next click folder and do "export to KML". The format is long, lat, altitude (with multiple points). This can easily be converted to other formats.
For example, I used a simple perl script to convert from KML to the format I wanted.
while (<>) {
chop;
if (//) {
s///g;
s/<\/name>//g;
s/^\s+//; # strip whitespace
s/\s+$//; # strip whitespace
print "\n";
}
if (///;
s/<\/coordinates>//;
s/,0.0\s*/,/g;
@array = split(",");
for ($i = 0; $i < @array; $i = $i + 2) {
if ($array[$i+1] && $array[$i]) {
$array[$i+1] =~ s/^\s+//; # strip whitespace
$array[$i+1] =~ s/\s+$//; # strip whitespace
$array[$i] =~ s/^\s+//; # strip whitespace
$array[$i] =~ s/\s+$//; # strip whitespace
print " \n";
}
}
print " \n";
}