Search results to map markers
Permalink
I have a property search site. When someone searches by city or zipcode, an array of results is returned. The normal list results are fine. However, there is Map results option. I am able to get the lat/long to return but need that to create markers on a Google map. Has anyone done this before? I tried to use the Pagelist Google Map plugin but that didn't suit the searching needs. Below is what I'm using to return the lat/long.
I hope someone can help!
I hope someone can help!
Adding this should work - make sure to put your API Key in where it says YOUR_API_KEY
Viewing 15 lines of 45 lines. View entire code block.
Thanks for the reply Hutman. I am getting this error now...
"You have included Google Maps API multiple times on this page. This may cause unexpected errors."
Looking at the source code I don't see it more than once. am i missing something?
"You have included Google Maps API multiple times on this page. This may cause unexpected errors."
Looking at the source code I don't see it more than once. am i missing something?
Can you provide a link to the page? I have no way to know this without seeing the rest of the page content.
And actually the code I pasted has it twice, remove the first one.
Tried removing the first one but no luck. I think you might have been involved in this site. There is a package called Hutman that is part of this, unless it was something they purchased from the community. Here's the linkhttp://aptlivingguide.com/index.php/property-search-results/map...
Looking at that page I can see that this line of code is still there, it has not been removed
<script type="text/javascript" src="https://maps-api-ssl.google.com/maps/api/js?v=3&sensor=false"></script>
I put it back because it didn't fix the issue. I took it out now again.
Try moving the Google Maps API line below the other javascript, it looks like the callback is failing because it's not finding the initialize function.
Tried that, and moving it to the header element, and the footer element. Same issues regardless. Frustrating, seems like it should be working.
There is a missing comma after title: item.title
YAY! It's loading the markers now. Just need to get it to zoom to the group and link to the property URL. Any guidance there? You are so much help, THANK YOU!
Not really, you can try following what is done here -https://stackoverflow.com/questions/15719951/google-maps-api-v3-auto...