Created
November 10, 2014 10:41
-
-
Save klokan/9ebdbff5f874ec2c77dc to your computer and use it in GitHub Desktop.
svg polygon to html image map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
print """<map id ="map" name="map">""" | |
for s in sys.stdin: | |
x, y = 0, 0 | |
out = "" | |
for i,j in [ map(float, r.split(',')) for r in s.split() ]: | |
x += i | |
y += j | |
out += "%d,%d," % (x,y) | |
if out: | |
print """<area shape="poly" coords="%s" href="" alt="" />""" % out[:-1] | |
print """</map>""" | |
print """<img src="mapa-mollova-sbirka.png" usemap="#map" alt="">""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment