For this feature all map pixels are hashed into a color hash map (the hashing is a dimension reduction in HSL that brings similar colors together).
To generate the color palette, averages for the largest color hashes are computed.
Finally a merging algorithm combines very close ones to one color entry (see image below).
The regions are pixels that have neighbors (+/-X and +/-Y ) with the same color.
It is a classic flood fill
algorithm, slightly modified
for optimization. Hovering regions will draw an overlay over the related map.
Matching the icons is done fuzzily and is more in an "alpha" state.
Hovering icon symbols will draw their positions on the map.
The basic algorithm compares sections of the map images with sampled icons and
renders the similarity into a result image.
Transparent parts in the icon images do not count.
In mathematically terms (simplified):
With values for icons computed as:
Then a pixel's amount in the map is:
The icon matching has some problems, that were (partially) solved by iterating (match parameters) and observing the data.
The main tradeoffs were made for performance reasons
by balancing false positives for less execution time.
As example: instead of using more than 25 icon matchers for one of the OSM POIs categories,
synthetic ones were generated (by hand in GIMP) that would match less accurate, but magnitudes faster.
Also Google Maps' icons vary per zoom level.
They have 30x30 pixels at level 17 but shrink to 12x12 at level 13.
The change of the icons is not trivial, since they are not just scaled versions.
Nevertheless, the icon matching uses scaled versions from level 17 to match at all other zoom levels (with accuracy penalties).
Since the labels are the most complex feature -
they involve recognition and classifying their category -
they were excluded (more in the summary).
First: Color Palette Generation (Pixels > Hashes > Merged),
Second: Icon Matching (Map > Regions > Filter > POIs)
Further technical information and algorithms can be found in the appendix section
→ Feature Detection Details