I have a search page setup. It's pretty standard and "works"
What I want to do is both centre the map and have a marker on the location the user sets.
This is easy if they press "use my location".
But what I don't get, is what if the actually type in the location instead? What if the want to see records 5km from their mum's house? They would type that in - but then how does that field get displayed as a marker? And, get centred?
When a user enters their location in a search, e.g. they type in their mum's address, what happens is the search is performed (retrieve posts within 5km of said address), and let's say that returns 3 results. Those 3 results are then displayed on the map, and the map is centred on those results. So, clearly the map will be close to their mum's address, but it won't be centred on it, it will be centred on the results. And if all of the results were give-or-take-a-few-metres 4.9km to the east of their mum's house, then the map would be centred 4.9km of that address.
When a user submits a distance search then a several URL parameters gets added, including toolset_maps_distance_center, which is the address entered for the search.
So we can use that to add a marker at that address, e.g.
Thank you Nigel! That is perfect.
I think it's logical that if the person uses an alternate address other than ":use my location" you should be able to show that and you did it for me! Thanks!