This question already has an answer here:

I'm planing to create an online map component with which the user can create/draw polygons based on underlying raster data.

Is there some library / tool / procedure existing which enables the creation of polygons based on the colors of the raster data (or map data) - something like the 'select by color' in photoshop? Example: the user clicks in the center of a lake and the tool creates a polygon which covers the complete lake at the coastline.

marked as duplicate by PolyGeo May 1 '18 at 7:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.