There are many different ways you can set up filtering of markers on a Leaflet or Google Map based on the markers' attributes. This page demonstrates four possibilities: a form, a drop-down menu, radio buttons, and plain text links.
All the filter examples use the GV_Filter_Markers_With_Text() function, whose two named parameters are "field" and "pattern".
If you don't specify a field, both the name and the description are searched. So a very simple use of this function would look like this:
If you know how to create "regular expression" patterns, you can use them.
For example, the following function would select only markers whose name began with the letters A through F:
There's also a "zoom" option available, which will cause the map to pan and zoom to fit the area described by the markers that are visible:
This map was created using GPS Visualizer's do-it-yourself geographic utilities.
Please wait while the map data loads...
You may have noticed that this map has one more trick up its sleeve: in the bottom right corner, there's a "Find a marker" box. This uses the GV_Center_On_Marker() function, with the following options: GV_Center_On_Marker({ pattern:document.getElementById('marker_search_text').value, partial_match:true, open_info_window:true, zoom:13}). (The box into which the pattern is typed has an id attribute of "marker_search_text. The search box itself has an id of "gv_infobox2" and was included in the map with a GV_Build_And_Place_Draggable_Box() function; view the source of this page to see the details.)