🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API Reference / API Parameters / aroundLatLng
Type: string
Engine default: null
Parameter syntax
'aroundLatLng' => 'latitude, longitude' // 2 floats

Can be used in these methods:

About this parameter

Search for entries around a central location, enabling a geographical search within a circular area.

A circle around the central location is automatically computed based on the density of records near that point. The radius will be small if many hits are close to the central location. The less hits near the center, the larger the radius will be.

Only records that fall within the bounds of this circle are returned. Records are ranked according to their distance from the central location. If you set getRankingInfo to true, each result will include the distance from the central location.

You can adjust the minimum and maximum radius:

Usage notes

This parameter is ignored if used with insideBoundingBox or insidePolygon.

To base the central location on the user’s IP address, use aroundLatLngViaIP instead.

Examples

Search around a position

1
2
3
$results = $index->search('query', [
  'aroundLatLng' => '40.71, -74.01'
]);
Did you find this page helpful?