On Fri, 19 Aug 2022 11:27:59 -0700 (PDT), Nesvarbu Nereikia wrote:
> Thank you Sandro, got it.
> What about using spatialite for reverse geocoding? Basically you give
> it a coordinate - it returns location info (country/city/district
> etc...)
> Is there a DB I can clone/ or prepare for such a service?
> There is a nominatim service self host option. But it is PostgreSQL
> based and "heavy" to host.
>
Hi,
both SQLite/Spatialite and Postgres/PostGIS are Spatial DBMS
and roughly speacking they are in the same class.
1) first you need to get all the data you need (map layers,
admin boundaries and so on).
using the one or the other makes no difference, the
difficulties are exactly the same.
2) then you have to design an appropriate data model
in terms of tables, primary keys / foreign keys
relationships, related indices and spatial indices.
once again using the one or the other makes a very
little difference; PostgreSQL is a little bit
harder because you have to handle users and their
permissions.
3) at this point you'll be ready for populating your
DB: this usually implies importing data from
Shapefiles, CSV files and alike.
all these activities are ususlly simpler on
SpatiaLite, most notably if you learn to
use the GUI tool.
4) it's now time to write, test and optimize
all the SQL queryies required by your app.
once again using the one or the other makes
a very little difference, difficulties are
more or less the same on both DBMS.
taking full profit from the Spatial Index
is surely harder on SpatiaLite.
5) last final step: deploying the DBMS and the
app on a remote web server.
here SpatiaLite wins hands down for its
simplicity and easyness.
but it's only the final step of a longer
process.
conclusion: maybe I'm wrong, but it seems to me
that you are underestimating the real problems:
A. get all the basic data you need; it might
be a lot harder than you think.
B. inventing a good algorithm for reverse geocoding
and translate it into SQL terms; not necessarily
a simple task.
choosing between PostgreSQL and SpatiaLite is not
the most pressing of your priorities: the real problem
seems to be finding solutions for A. and B. (and
SpatiaLite has nothing to do with them).
bue Sandro