I'm trying to get the details for a landmark or an existing location when clicking on it in google maps. It's easier to explain if I show a picture:
This is the map contained in my angular(Ionic) app. It is going through the javascript api. In this example when I click on the "Empire State Building" I get the popup shown, is there a way using the api to get the geocode information for the landmark you have just clicked? E.g the name, the latitude and longitude in an array and then add it to the scope?
The reason I want to do it is I want to set up events at existing location on the map that the user can select. As in: User told to select location -> User clicks Empire State Building on the map -> Empire state building enters in to the database as the location for the event.
Any help or points in the right direction would be greatly appreciated. Thank you
What you can do is retrieve the Lat/Lng during a click event then use that coordinate information to Reverse Geocode the location. With that you should be able to get address information. You should also consider using the Places API as an alternative, as that may return more useful information.
If you want to set up events at existing locations and you already know those locations, I think it would be better if you simple created markers onto those locations. You can add infowindows containing whatever other information you may want to show the user too. You can just use the marker click event to handle "entering the location into the database."