Global Positioning System Reference
In-Depth Information
geometries and a maximum distance in meters. A list with the coordinates
of all hospitals must also be provided in the fi fth line.
The algorithm that performs query Q3 (list the number of gas stations
that exist along Route 66) is presented in Fig. 14.
Similarly to the query Q1, two steps are needed: (1) fi lter the element of
interest (fi rst line), in this case the Route 66; (2) search for PoIs which have
a spatial relationship (Intersects) with the element obtained in the previous
step, fi ltered by type (between the third and eighth lines). The number of
PoIs that meet the query criteria is counted in the eighth line of Fig. 14.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
gisdb.pois.find( { "geometry.coordinates" :
{ "$near" :
{ $geometry :
{ type : "Point" ,
Coordinates : [ <longitude> , <latitude> ]
/*In above line should be informed an array with
thecoordinates of all hospitals */
}
},
$maxDistance : 1000
},
"type" : "Drugstore"
} );
Fig. 13. Algorithm that performs Q2 on MongoDB.
1
2
3
4
5
6
7
8
var highway = gisdb.highways.find({ "name" : "Route 66" });
gisdb.pois.find( { "geometry.coordinates" :
{ "$geoIntersects" :
{ $geometry" :
highway
} },
"type" : "Gas Station" } ).count();
Fig. 14. Algorithm that performs Q3 on MongoDB.
Neo4j
The Neo4j Spatial offers a Shapefi leImporter class which is responsible for
converting shapefi les into a Neo4j database. Figure 15 shows some examples
of conversion from shapefi les to Neo4j.
The importFile method of the Shapefi leImporter class (between the
ninth and thirteenth lines of Fig. 15) is responsible for converting shapefi les.
This method has an optional attribute that enables an explicit specifi cation
of the charset from the input fi le.
An excerpt of the algorithm implemented to answer query Q1 (retrieve
all restaurants in New York) is presented in Fig. 16.
Search WWH ::




Custom Search