Google Maps API V3: search markers

13,298

You would be best served by maintaining your own dataset of pins that have been pulled from the database and handling the searching of them in your own code. To implement you would need to save the reference to the pin you are creating for each location in that dataset. So get the locations from the DB, save locally, add them to the map, update the local datastore with the reference to the created pin, then hook your search to your dataset, and finally center or whatever you want to happen on the map pin reference you have saved for that result.

This google walkthrough is a good overview of this type of solution. https://developers.google.com/maps/articles/phpsqlsearch_v3?csw=1#creating-the-table

Share:
13,298
Admin
Author by

Admin

Updated on June 15, 2022

Comments

  • Admin
    Admin almost 2 years

    I am building a google map for a client and they want to be able to search for the markers that I have already added to the map.

    I have already built the V3 API map that takes the markers from a MySQL table and pushes them into a marker array, but I am struggling to set up a search box that will list out any matches to the search query.

    Anyone had any experience of this or able to help me?

  • Tim Davies
    Tim Davies about 10 years
    The question is in relation to pins added to the map by the developer. Not searching places or POIs from Google.