Search within a Radius (ELLQL)
-
To get all the points around a certain point:
#distance(point_field, lat/x, long/y, distanceInMeters) .
-
To also retrieve the distance of each point from the center:
#distance{name=pointQuery}(point_field, lat/x, long/y, distanceInMeters)
-
Then use
@pointQuery.distance in a virtual field.
Search within a Polygon (ELLQL)
To get all the points within a polygon:
#within(point_field, (X1, Y1; X2, Y2; X3, Y3; ...))
where Xn Yn are corners of your polygon in the same coordinate
format as your points.
For example:
#within(gps, (0.0, 0.0; 1.0,0.0; 1.0,1.0; 0.0, 1.0))
Returns all the points within the square (0.0, 0.0) - (1.0, 1.0).
#within(gps, [(0.0, 0.0; 2.0, 0.0; 2.0, 2.0; 0.0, 2.0) (1.0, 1.0; 3.0, 1.0; 3.0, 3.0; 1.0, 3.0)]
Returns all the points within the square (0.0, 0.0) - (2.0, 2.0) OR (1.0, 1.0) -
(3.0, 3.0) but not in both.
Search with a Radius or Polygon (UQL)
In UQl, you can use the following operands with a Geographic prefix handler
( geo: ).
Operand
|
Example
|
within(lat1,lng1; lat2, lng2; lat3, lng3;)
searches all the locations within the specified polygon
|
geo:WITHIN(48.33, 2.51; 45.65, 1.34; 24.54, -4.54; 12.34,
-6.65)
|
distance(lat, lng, distance_in_meters)
retrieves all the documents where the geographic field is located
distance_in_meters from the specified lat,
lng
|
geo:DISTANCE(48.33, 2.51, 250000)
|
Use UQL with ELLQL for Geographical Search
You can mix UQL queries with ELLQL, for example:
eq=#and(#distance(gps, 3.4, 4.3, 100) #uql("query in uql OR file_size<100"))
|