5. Geospatial queries

This chapter shows geospatial queries on the migrated pages from WordPress to MongoDB.

In order to allow geospatial queries, was added the custom field Coordenadas in WordPress to store the latitude and longitude of the page subject.

For example, when the subject of the page is a building, such as a church or a monument, the coordinates of a single point are usually given, and the Coordenadas field is used only once.

When the subject of the page is a street, for example, the field can be used twice, containing the coordinates of the beginning and end of the street, or even several times, containing the coordinates of all intersections of this street.

In the case of subjects occupying an area, such as parks, squares and gardens, various points of its outline may be specified as required.

There are documents whose subject covers more than one object, such as the Imperial Palace, which are two: one in the Quinze de Novembro Square, in Downtown, and the other in Quinta da Boa Vista in the neighborhood of São Cristóvão. In these cases one Coordenadas field is used for each object, indicating its location.

There are also pages where it does not make sense to specify geographic coordinates and then in these pages the custom field Coordenadas is not used.


Integration of MongoDB with WordPress