I have a travel website where user can click on countries or states from the US to indicate where they have vistied. The counries or states then turn colors. The site is here: [
wherehaveibeen.info ].
I would now like to generalize my methods so I can quickly get up and running maps and their repsective imagemaps of other countries like India, China, Canada and Mexico so users can also indicate in these countries which states or provinces they have visited.
I am using Wikipdia's PNG grey maps from here: [
en.wikipedia.org ]. I can get black and white versions of these maps using edge detection and changing the map color to 2 colors as well as a couple of other steps using Irfan View. I can then also feed these two color outline only maps into an ASCII art generator program and get the outlines of the countries and states and provinces mostly replaced with say the # sign ASCII character and everything else, like water or state/province interiors left blank.
The question then is how do I find the X and Y pixel location of all the polygon borders? So I need first to identify the polygons in the ASCII art, in other words those section represented by the ASCII space character, and then find the X and Y location of the borders of the polygon as represented in the image grid location by the # character borders. Two polygons might obviously have some common border # character locations.
I know this can probably be done in Excel or other spreadsheet. Is there a way to do all of this say in Perl, PHP, Javascript or Python? I could start a Sourceforge project for a web service that would allow users then to automatically get a start at an imagemap by:
1. Uploading the images.
2. Using an edge detection say via IrfanView's commandline application, PHP GD or ImageMagic operation.
3. Decrease the color depth of the image to just two colors, black and white maybe with IrfanView's command line tool.
4. Allow editing of the image to thicken lines.
5. Convert this image two two character ASCII art.
6. Detect all the polygons and give the X,Y locations of all the polygon border pixels.
6. Autogenerate the imagemap skeleton code with each of the pixel locations of the polygon borders specified.