API Reference / API Parameters / aroundLatLng
Type: string
Engine default: null
Parameter syntax
'aroundLatLng' => 'latitude, longitude' // A single pair of floats

Can be used in these methods:

About this parameter

Enable geographic search within a circular area using a central location specified as a single pair of comma-separated latitude and longitude values.

Results are limited to records within a specified radius of the central location. Records closest to the central location will appear first in the results.

Usage notes

The circle’s maximum radius is determined by aroundRadius. The circle’s minimum radius is determined by minimumAroundRadius The circle’s actual size is automatically computed based on the density of records near that point. The radius is small if many hits are close to the central location. The fewer hits near the center, the larger the radius.

If you set getRankingInfo to true, each result will include the distance from the center.

This parameter is ignored if you also specify 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?