google-maps-react icon indicating copy to clipboard operation
google-maps-react copied to clipboard

Google Places wrong results location

Open strataga opened this issue 10 years ago • 2 comments

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

strataga avatar Sep 14 '16 05:09 strataga

I am having the same problem. No matter what coordinates I pass into initialCenter, the map always centers on San Francisco.

brybrophy avatar Dec 28 '16 21:12 brybrophy

Check the 'centerAroundCurrentLocation' property of the Map component.

tzerb avatar Dec 30 '16 16:12 tzerb