1, the database of internal support GIS (Geographic information System)
MySQL: Currently only the MyISAM engine supports GIS, and InnoDB supports spatial indexing in version 5.7. MyISAM this engine.
Transactions, foreign keys, and table locks are not supported. Suitable for read-oriented, not suitable for writing operations. And if you build a single table, it's always
Existing table union queries return the location of the tag, and the efficiency is somewhat affected, and it is not certain whether Django supports InnoDB and MyISAM
Engine union query. (currently used InnoDB engine)
Other databases: MongoDB and PostgreSQL support GIS, the former is not studied carefully, the latter is very strong in GIS,
However, there is no consideration for switching databases.
2. Third-party apps or frameworks
Geodjango: It's a Django-derived project that supports GIS storage and querying. But this frame is too heavy, too much content, simple
Familiar with it, its function is still very powerful. But at the database level, it also requires a database to support GIS.
Database Full-Text search: Using more of the Lucene and Sphinx tools, the time cost of familiarity with these two tools is too high, and from the performance
The same as using MySQL query.
3, own development
There are two scenarios to consider,
(1) The latitude and longitude of the location of the database, and the distance between the spherical two points is used to calculate and sort the nearby locations.
To improve efficiency, you can also save it as a stored procedure.
(2) Convert latitude and longitude to one-dimensional data geohash, which can be indexed on Geohash, and use like statements
can implement queries. But to call at least 6 like statements, and can not achieve any distance search, only a few distance search
The location within the range.
At present, the company is responsible for the development of product requirements do not need accurate search, from the time cost, performance two aspects of these scenarios, the best two scenarios are
More appropriate. Final selection of Geohash scenarios
Geo Implementation Scenarios