codeforgermany / click_that_hood

A game where users must identify a city's neighborhoods as fast as possible
http://click-that-hood.com
MIT License
449 stars 639 forks source link

Some islands are hard to click. #159

Closed mwichary closed 10 years ago

mwichary commented 10 years ago

Cape Verde is hard to click in Africa. The bounding box is big enough, but it consists of three small islands – it’s hard to see when it shows the right answer, too.

davidbauer commented 10 years ago

maybe just take it out of the geojson-file?

mwichary commented 10 years ago

We’re seeing this problem again in the upcoming Oceania islands. I have some ideas on how to fix this. /cc @ahhrrr

davidbauer commented 10 years ago

Just wondering: Why isn't it recognised automatically as too small too click?

mwichary commented 10 years ago

Because the bounding box is actually pretty big, but there is a lot of dead space inside.

davidbauer commented 10 years ago

Is that due to its geography or could the data in the geojson be better?

mwichary commented 10 years ago

Just geography.

mwichary commented 10 years ago

Note: Also an issue for Oceania.

mwichary commented 10 years ago

TL; DR: We now have good clickable support for islands, and Oceania is live at http://click-that-hood.com/?location=oceania.

Details:

  1. I found an algorithm and modified it to calculate an actual area of a neighborhood. (As opposed to the area of a bounding box, which you get for free.)
  2. For every neighbourhood/country/item that is a) less than 100px in area and b) the ratio of actual area to bounding box area is <10%, we assume it’s islands.
  3. For those, we create a separate element that’s underneath it, with a thicker stroke that serves as a catch for clicks and also green/red illumination.

I tested all locations and of those, those have islandy-looking things: · http://click-that-hood.com/?location=oceania – many islands · http://click-that-hood.com/?location=africa – Cape Verde to the West · http://click-that-hood.com/?location=alaska-ipla – Naukan to the West · http://click-that-hood.com/?location=united-kingdom – Southend-on-Sea and Torbay (not technically islands, but it helps) · http://click-that-hood.com/?location=minneapolis-cities – Chanhassen (Hennepin Co. part) (small split neighborhood)

Let me know. I’m pretty happy with it, although visually it could be tweaked.

@ycombinator, remember when we were talking about padding small neighborhoods all those months ago? That’s kind of a version of this.