@Api @Component @Transactional(readOnly=true, rollbackFor=java.lang.Exception.class) public class SearchByLocationCommand extends Object implements Command<SearchByLocationRequest,SearchByLocationResponse>
Execute a search for features by location. The location can be any type of geometry. Although this will mostly be a coordinate, it is possible to search using a Polygon or LineString as location. The command only expects the location to be described using the map's coordinate system. Also, if a buffer is specified, this buffer will be added to the location geometry before executing the search.
In addition to the location, it is also possible to describe what kind of geometric query to use (supported are: intersects, contains, touches and within) and in case of the "intersects" query, it is even possible to describe what ratio of intersection is required (number between 0 and 1). The default query will also be an intersection. For example, if queryType = 1 (intersects) and ratio = 0.7, then only features whose geometry lies 70% within the given location will be accepted.
Last but not least, it is required that at least one layer-ID is given to search in. If multiple layers are given, an extra parameter comes into play: searchType. This searchType specifies whether to search features in all given layers, to to start searching from the first layer, and stop once features are found (can be in the first layer, or in the second, ...).
It will go over all given layers (provided they're vector layers), and fetch the features, using the location geometry and the query type. In case the query type is "intersects", the overlapping ratio is also checked. The resulting list of features is added to the command result so it can be send back to the client.
| Constructor and Description |
|---|
SearchByLocationCommand() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(SearchByLocationRequest request,
SearchByLocationResponse response)
The command's execution method.
|
SearchByLocationResponse |
getEmptyCommandResponse() |
public void execute(SearchByLocationRequest request, SearchByLocationResponse response) throws Exception
execute in interface Command<SearchByLocationRequest,SearchByLocationResponse>Exceptionpublic SearchByLocationResponse getEmptyCommandResponse()
getEmptyCommandResponse in interface Command<SearchByLocationRequest,SearchByLocationResponse>Copyright © 2013 Geosparc. All Rights Reserved.