Child pages
  • Geospatial queries
Skip to end of metadata
Go to start of metadata

Using geospatial data

Using Apstrata, developers can persist their data into key/value pairs structures called documents that are saved in their application store. The values that are associated to documents fields can be of type string, text, numeric, file or geospatial. A geospatial field has a value that is expressed in terms of latitude and longitude, with a precision of 10 meters (4 digits), e.g: myLocation=51.1234,1.1234

Saving a document that contains geospatial fields is no different from saving any other document and is done using the SaveDocument API. As you would expect it, querying documents that contain geospatial field also does not differ from querying any other document and is done using the Query API.

Back to the map 

Example 1: save the player's location

You are implementing a cool mobile game and you would like to save the current location of your players, in order for example to customize the game, suggest contextual information, or inform them of an event related to your application that is taking place near them. Once it retrieves the player's location from their mobile device, the client-side part of your application can pass it along with other values to create or update a document on your Apstrata back-end.

Navitabs License Error

The number of licensed users is incompatible with the number of licensed users of Confluence. Please contact your system administrator.

License Details
Try it!

Example 2: find the players around me, sorted by ascending distance

Let us now assume that you would like your players to be able to locate other players around them (within a distance of 200 meters max), allowing them for example to build up a team in a multiplayer location-based configuration of your game (e.g. territory control). Using Apstrata Query API, this is very simple to do, as demonstrated in the below example

Navitabs License Error

The number of licensed users is incompatible with the number of licensed users of Confluence. Please contact your system administrator.

License Details
Try it!

Dig deeper

Related tutorials