Connect to the PostGIS database

I am trying to create an application that will allow the user to view the OSM map hosted on my own tile server and also be able to edit it.

I currently have a tile server that delivers map fragments (png images) to my Android application, which is displayed using OSMDroid.

I also have a PostGIS database that stores OSM data.

What I'm going to do is display the OSMDroid map as a base, which allows the user to see the fully displayed map, but then the application will load the OSM data from the PostGIS database and draw road lines as an overlay on top of the MapView so that the user can manipulate these in rows, and then send them back to the database. It will be similar to how Vespucci does it.

Does that sound like a good way to do this? Also, does anyone know how I can connect Android to PostGIS DB and download this data?

thanks

+4
source share
1 answer

If Android clients connect directly to your database, this is not a good idea. Creating a web service (like REST services), as you mentioned in your comment, is the way to go.

There are several reasons to take this approach:

  • Providing your online database is bad from a security point of view
  • Tightly connecting your application to the database is bad from a design point of view. With a separate service level, you can:
    • Make changes to the data layer without updating the application.
    • Add Caching
    • Add capacity at each level if necessary.
+4
source

Source: https://habr.com/ru/post/1443632/


All Articles