google-maps-react
google-maps-react copied to clipboard
Google Places wrong results location
I cannot figure this out...
The results coming back from Google Places search is always in California, but the location I am giving it is in Texas.
37.774929, -122.41941600000001
Anybody now how to fix this?
const google = window.google
const service = new google.maps.places.PlacesService(map)
const location = new google.maps.LatLng(center.lat(), center.lng())
const request = {
location,
radius: '500',
type: ['food']
}
service.nearbySearch(request, (results, status, pagination) => {
if (status == google.maps.places.PlacesServiceStatus.OK) {
this.setState({
places: results
})
}
})
ref: https://github.com/fullstackreact/google-maps-react/blob/master/examples/components/places.js
I am having the same problem. No matter what coordinates I pass into initialCenter, the map always centers on San Francisco.
Check the 'centerAroundCurrentLocation' property of the Map component.