Global Positioning System Reference
In-Depth Information
additional effort is needed to fi lter only the PoIs of the “drugstore” type
from the PoIs returned by the method.
The GeoPipeFlow object type (line 17 of Fig. 17) consists of methods for
interacting with the results of queries through the GeoPipeLine object. This
type of object provides methods such as getGeometry() (that returns the
spatial geometry) and getProperties() (that returns the set of metadata).
It is worth pointing out that the start NearestNeighborLatLonSearch()
method performs the search for a neighborhood in each centroid point at
a time, i.e., individually for each hospital. Thus, to obtain the drugstores
located within the radius of one km from all hospitals, it is necessary to use
a loop to invoke this method for each hospital.
An excerpt of an algorithm to answer Q3 (list the number of gas stations
along Route 66) in Neo4j Spatial is presented in Fig. 18. Similarly to the
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
Layer layer = spatialService.getLayer("POIS");
Search searchQuery = new SearchCQL(layer,
"type = 'hospital");
...
List<SpatialDatabaseRecord> hospitals =
searchQuery.getResults();
for (int x=0; x<hospitals.size(); x++) {
GeoPipeline pipe =
GeoPipeline. startNearestNeighborLatLonSearch (
layer,hospitals.get(x).getGeometry(),1.0)
.sort("OrthodromicDistance")
.getMin("OrthodromicDistance");
List<GeoPipeFlow> poisClosests = pipe.toList();
...
// the result list needs to be filtered to drugstores
}
...
Fig. 17. An excerpt of the algorithm that performs Q2 in Neo4j Spatial.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
...
Layer layer1 = spatialService.getLayer("POIS");
Layer layer2 = spatialService.getLayer("HIGHWAYS");
Search searchQuery = new SearchCQL(layer2,
"name = 'Route66'");
...
List<SpatialDatabaseRecord> route66 =
searchQuery.getResults();
GeoPipeline pipe = GeoPipeline. startContainSearch (layer1,
route66.get(0).getGeometry());
List<GeoPipeFlow> poisContained = pipe.toList();
...
// the result list needs to be filtered to gas stations
...
Fig. 18. An excerpt of the algorithm to answer Q3 in Neo4j Spatial.
Search WWH ::




Custom Search