Skip to content

Comment on Where'd The Water Go? Google Maps Water Pixel Detection With Canvas

Comments

I don't see the need to treat water different from earlier placed markers.

Here's how I would hack this: whenever you place an icon, draw a slighty larger circular 'lake' on top of that hidden canvas. That added lake prevents you from placing another icon in the neighborhood of that icon.

There is a performance hit for this. Rendering the 40 markers in the provided demo takes roughly 7ms on my machine vs 25ms for the fake lake method.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.