Geocoding limit results by a drawn area

Limit geocode control search results to the bounding box of the drawn area. Draw a polygon on the map to filter the search results to the polygon bounding box. See all geocoding control options in the geocoding control reference documentation.

In this example we use the mapbox-gl-draw-rectangle-restrict-area plugin to draw rectangles.

Click outside the rectangle when you draw the final vertex to complete the polygon.

An extension of MapLibre GL JS