我正在使用PostGIS/Rails,有一组带有地理位置的点。
对于给定的点集,我需要找到N个最接近的点集和它们之间的距离;
或者:
对于给定的最大距离和点集,我需要找到N个最接近的点集。
使用PostGIS,最好的方法是什么?
我的版本是PostgreSQL 9.3.4和PostGIS 2.1.2。
class DataSet < ActiveRecord::Base # these are the sets containing the points
has_many :raw_data
# attributes: id , name
end
class RawData < ActiveRecord::Base # these are the data points
belongs_to :data_set
# attributes: id, location which is "Point(lon,lat)"
end
对于给定的点集,我需要找到N个最接近的点集和它们之间的距离;
或者:
对于给定的最大距离和点集,我需要找到N个最接近的点集。
使用PostGIS,最好的方法是什么?
我的版本是PostgreSQL 9.3.4和PostGIS 2.1.2。