SymbolixAU / googleway

R Package for accessing and plotting Google Maps
http://symbolixau.github.io/googleway/
Other
234 stars 46 forks source link

google_map search_box result #212

Open chrisvwn opened 5 years ago

chrisvwn commented 5 years ago

When using the search_box in google_map clicking on the result "marker" does not trigger the input$mapId_map_click observe event. Screenshot from 2019-11-27 15-01-57

Clicking on other place markers not searched for do trigger the observer. Screenshot from 2019-11-27 15-03-09

Also, is it possible to access the result from the search rather than just the coordinates? Possibly the location and address data of the result?

SymbolixAU commented 5 years ago

Also, is it possible to access the result from the search rather than just the coordinates? Possibly the location and address data of the result?

You should be able to observe input$map_place_search

Which returns

eventInfo = {
   address_components: place.address_components,
   lat: place.geometry.location.lat(),
   lon: place.geometry.location.lng(),
   name: place.name,
   address: place.formatted_address,
   place_id: place.place_id,
   vicinity: place.vicinity,
   randomValue: Math.random()
 };
SymbolixAU commented 5 years ago

Clicking on other place markers not searched for do trigger the observer.

By 'other place markers', do you mean the icons you see already loaded on the map? If so, these are considered part of the 'map', and not markers, which is why they would trigger the input$mapId_map_click event.

The markers placed after a search are custom, temporary markers and are not considered part of the map.

chrisvwn commented 5 years ago

Yes, I meant the icons already loaded on the map. Noted that these are part of the map while the search result markers are temporary.

However, seems like this actually blocks out that part of the map now so that even underlying parts of the map and icons cannot be clicked. I wonder if it would be possible to either make this custom marker clickable possibly returning the same data as the search? Or maybe allow clicking through to the map?