Skip to content
Advertisement

How to get Lat and Lng from StandaloneSearchBox?

I use the react-google-maps StandaloneSearchBox and query the locations of my points of interest. This works as far as it goes. However, I get back functions for the location and not the actual value. How do I actually get the lat and lng values similar to the viewport.

JavaScript

Advertisement

Answer

You can just call the lat and lng functions to get the values.

  • geometry.location.lat() -> latitude value
  • geometry.location.lng() -> longitude value
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement