googleway icon indicating copy to clipboard operation
googleway copied to clipboard

google_map search_box result

Open chrisvwn opened this issue 5 years ago • 3 comments

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?

chrisvwn avatar Nov 27 '19 11:11 chrisvwn

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 avatar Nov 27 '19 21:11 SymbolixAU

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.

SymbolixAU avatar Nov 27 '19 21:11 SymbolixAU

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?

chrisvwn avatar Nov 28 '19 07:11 chrisvwn