【问题标题】:Drawing a radius on a datapoint and counting other points in that radius在数据点上绘制半径并计算该半径中的其他点
【发布时间】:2018-11-02 10:43:21
【问题描述】:

假设我有两个仅包含点的地理数据集。对于数据集 A 的每个点,我想绘制一个 1 公里的半径,计算该半径内 B 类点的数量,并将该值附加到数据集 A。

这可能使用 QGIS 或 Python 吗?

非常感谢, E

【问题讨论】:

    标签: python geolocation geospatial geo qgis


    【解决方案1】:

    我认为你可以编写一个循环来使用这个库绘制 cricle 点:

    from mpl_toolkits.basemap import Basemap
    import matplotlib.pyplot as plt
    import math
    from osgeo import ogr, osr
    import matplotlib.cm as cmx
    import matplotlib.colors as colors
    

    然后你写:

    def createCircleAroundWithRadius(lat, lon, radiusMiles):
        ring = ogr.Geometry(ogr.wkbLinearRing)
        latArray = []
        lonArray = []
    
       for brng in range(0,360):
           lat2, lon2 = getLocation(lat,lon,brng,radiusMiles)
           latArray.append(lat2)
           lonArray.append(lon2)
    
      return lonArray,latArray
    

    作为返回,您会收到带有两个坐标的数组。然后你可以对数据集 B 进行循环并证明他的坐标在数组中的所有点内

    希望对你有帮助。

    信息:https://stochasticcoder.com/2016/04/06/python-custom-distance-radius-with-basemap/

    问候!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-18
      • 1970-01-01
      • 1970-01-01
      • 2014-11-19
      • 2017-04-13
      • 2022-11-29
      • 1970-01-01
      • 2015-02-24
      相关资源
      最近更新 更多