Storing Lat Lng values in MySQL using Spatial Point Type

前端 未结 4 1754
太阳男子
太阳男子 2020-12-04 09:44

Tech used: MySQL 5.1 and PHP 5.3

I am just designing a new database for a site I am writing. I am looking at the best way of now storing Lat and Lng values.

4条回答
  •  甜味超标
    2020-12-04 09:46

    If you can affor placing some extra code into your backend, use Geohash.

    It encodes a coordinate into a string in a way that prefixes denote a broader area. The longer your string is, the more precision you have.

    And it has bindings for many languages.

    http://en.wikipedia.org/wiki/Geohash https://www.elastic.co/guide/en/elasticsearch/guide/current/geohashes.html

提交回复
热议问题