Global Positioning System Reference
In-Depth Information
When executing a query using a bounding box (bbox), GeoCouch
returns the smallest bounding or enclosing box (rectangle) that contains
the geometries that satisfy the query criteria. In the example described in
Fig. 6, the function returns the smallest rectangle that involves the PoIs in
New York City. It is important to mention that because we are using bbox,
some points inside the bbox but outside the NY geometry may return. These
points would be false positives.
A major problem of CouchDB and the GeoCouch extension is the
lack of a multi-dimensional index. It is not possible to add fi lters based
on spatial and non-spatial criteria in the same query. Therefore, query Q2
must be broken in parts and some fi lters must be executed in memory using
a programming language. Figure 7 illustrates an example of solution to
perform query Q2 using a pseudo-code.
The implementation of the buffer function (), used in the sixth line of
Fig. 7, would make a HTTP request as illustrated in Fig. 8.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
hospitals = getAllHospitals(); //Retrieve all hospitals
pois_near_hospitals = []
for each hospital in hospitals:
pois_near_hospitals.append(buffer(hospital)) // one km
buffer
in each
hospital
drugstores_near_hospitals = []
for each poi in pois_near_hospitals:
if poi.type == "drugstore":
drugstores_near_hospital.append(poi)
Fig. 7. Pseudo-code to perform query Q2.
1
2
http://localhost:5984/pois/_design/geo/_spatiallist/radius/poi
nts? bbox=x1,y1,x2,y2&radius=1000
Fig. 8. URL that performs a buffer for query Q2 in CouchDB.
MongoDB
Since MongoDB only provides spatial operators to verify inclusion
($geoWithin), intersection ($geoIntersects), and proximity ($near), only the
queries Q1, Q2 and Q3 were implemented.
MongoDB provides no internal tool to perform the loading of ESRI
Shapefi les or other spatial data sources. However, the og2ogr GDAL
application can be used to convert the shapefi le into the GeoJSON format.
Figure 9 presents an example of uploading a set of Points of Interest (PoIs)
into the shapefi le format.
Search WWH ::




Custom Search