Hacker News new | ask | show | jobs
by at_a_remove 2219 days ago
It's funny this came up. I've been doing webstuff and getting paid for it since about 1996 or 1997; imagemaps were a pretty big deal back then. Recently, I found myself thinking, "How do they do that these days?" I have gotten out of the webbish stuff and even before that, I tended to stick to the tried and true.

I don't think the need for something very much like imagemaps will ever go away. The lure of arbitrary polygons and paths cut from an image needing to be clickable is high, and I think the ability to join up a bunch of polygonal (or worse) images and have them well-aligned is far off. It's easier to cut up than to re-align.

2 comments

The answer is usually to use SVG. You see this in most maps and charts with clickable or interactive areas. For cases where you need a raster image to have clickable regions, like showing plots of land or property boundaries on a real estate website, you might see a mix of a raster image below a semitransparent SVG overlay or just a <canvas> element instead, which would have to manually reimplement handling clicks and hover events on the various regions.
the modern web just doesn’t do that, though. I don’t think I’ve seen a clickable polygon in the last 15 years
I saw a site not too long ago that had a map of U.S. states with state changes on hover and click. It was just a bunch of SVG's in an <ul>. So it's possible, but it takes some braining.
My city's COVID-19 map breaks it down by clickable zip code regions.
Arbitrary polygons are, after all, not that easy to click in general.
the most obvious modern use case that comes to mind is maps or more generally geospatial visualization tools