Storing and Querying GPS Coordinates Effectively

后端 未结 8 1947
一整个雨季
一整个雨季 2021-02-02 17:31

I want to create a large database of GPS coordinates that can be queried by saying \"Return all coordinates that are within \'n\' metres of [this coordinate]\".

I need i

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-02 18:02

    GIS databases (e.g. PostgreSQL with PostGIS) actually provide data structures for two- or three dimensional region-searches (spatial indices). The simplest one is the grid index, then the different search trees (kd-tree, quad-tree) with R-tree as the most frequently used (a generalized B-tree for more dimensions). These methods seem adequate.

    A basic grid-index (partitioning the space into grid-cells, and searching only in the nearby cells) can be implemented easily and can reduce the search time significantly. Search trees are a bit harder to implement, but there are lots of open-source implementations for lots of programming languages and DBs (like PostGIS or Geopandas etc.). Using them for problems like this one usually pays off.

提交回复
热议问题