Functionality functions
You can use functionality functions in filter clauses to define filter conditions. Functionality functions that return numeric values can be used in sort clauses for sorting.
The fields that you reference in the parameters of functionality functions must be configured as index or attribute fields based on the description of each function.
in_query_polygon: judges whether a specific geographical location is in specific polygon-shaped areas
1. Syntax
in_query_polygon(polygon_key, doc_point)
2. Parameters
polygon_key: the key defined in the kvpairs clause. The coordinates of polygon vertices are stored in the value of the key. The field must be of the DOUBLE_ARRAY type. The field values are ordered x-coordinates and y-coordinates that form polygons. A pair of coordinates is in the [x,y] format. The coordinates of vertices must follow the order of vertices in the clockwise or anticlockwise direction. Separate multiple coordinates with commas (,). Example: xA,yA,xB,Yb. Separate multiple polygons with semicolons (;).
doc_point: the geographical location to be judged. This field must be of the DOUBLE_ARRAY type. This field can contain only two values, which are an x-coordinate and a y-coordinate.
3. Return value
The return value is of the INT type and indicates the subscript of the first matched polygon. If no polygon is matched, 0 is returned. For example, 1 is returned if the first polygon is matched, and 2 is returned if the second polygon is matched.
4. Scenarios
Scenario 1:
Search for KFCs in the specific shopping area (xA,yA,xB,Yb,xC,Yc;xD,yD,xE,yE,xF,yF,xG,yG). The point field is used to store the geographic locations of KFCs.
query=default: 'KFC'&&filter=in_query_polygon ("polygons", point)>0&&kvpairs=polygons:xA\,yA\,xB\,Yb\,xC\,Yc;xD\,yD\,xE\,yE\,xF\,yF\,xG\,yG
5. Usage notes
The fields that you reference in the parameters of the function must be configured as attribute fields.