Home > Software engineering >  Why nearbySearch function got a outter-range result than what I set?
Why nearbySearch function got a outter-range result than what I set?

Time:10-19

I got a question when I used nearby search function of google maps in my project.

I did a nearby search with setting the radius equals 1000 meters, my assumpotions is, the distance between any of search result and the target location will less than 1km. But the truth is Googlemaps gives me a stange response whose results may further than 1km (like 1.3km).

I want to know is this normal?

Search ResultCalculate Distance

CodePudding user response:

The Nearby Search radius parameter does not restrict the results to be within the circle.

Here's what the docs says:

"You may bias results to a specified circle by passing a location and a radius parameter. Doing so instructs the Places service to prefer showing results within that circle; results outside of the defined area may still be displayed."

Thus, the Nearby Search is working as intended if it gives you results a little bit beyond your search biasing using the radius parameter.

  • Related