Nico Schlömer
Nico Schlömer

Reputation: 58791

Geospatial database for Android app

I plan to write an Android app that allows the users to share little pieces of information about a place, e.g., a bar, restaurant or the like. I'm now looking into what is the best way to store such data. I'm particularly concerned about retrieval: When showing a (Google) Map, I'd like to overlay it with said information, so I'll need to be able to make geospatial queries to the database.

Is this possible with the Google Cloud Datastore, for example? What are the alternatives?

Upvotes: 0

Views: 949

Answers (3)

CoryatJohn
CoryatJohn

Reputation: 324

You might want to look at Postgresql and even PostGIS for storing geo data. They are fairly efficient, scalable and fast. I've used Postgresql with geodata for many years and on very busy websites and Android apps. If all you need is to locate things near other things, Postgresql works great. If you want to find things within polygons or do more complex queries, PostGIS has a lot of great functions.

Postgresql and PostGIS are both open source and free.

If you want amazing performance, use an SSD and a machine with enough memory to hold the entire database. You'll be amazed at how fast that setup is.

Upvotes: 1

Cybercartel
Cybercartel

Reputation: 12592

You can try a quadkey. Its similar to a geohash or a geocell. Translate the points to a binary and interleave it and treat it as base-4 number. It comes it looks like a space filling curve and it has the same properties. Here is a good article about quadkeys:https://msdn.microsoft.com/en-us/library/bb259689.aspx.

Upvotes: 1

Jose L Ugia
Jose L Ugia

Reputation: 6250

Datastore does not have support for geospatial properties per se, but you can easily create a convenience class to work with it. In App Engine, there is a property GeoPt just for this purpose both in the Java and Python libraries.

If you are interested in geo queries there is not much that Datastore can do for you, but there is an interesting lib in Python to deal with that, geomodel. The problems are still on performance and costs. The operations performed there, although optimized, are heavy.

There's one last alternative. Search API allows you to perform geo queries. The only drawback of this are costs and limited free tier.

Upvotes: 1

Related Questions