是否有一个R函数来检查GeoJSON对象(多边形或多多边形)是否包含点?以及哪个GeoJSON对象容器指向哪

时间:2019-06-07 18:49:45

标签: r json geojson data-cleaning

我有一个点数组

{
  "Sheet1": [
    {
      "CoM ID": "1040614",
      "Genus": "Washingtonia",
      "Year Planted": "1998",
      "Latitude": "-37.81387927",
      "Longitude": "144.9817733"
    },
    {
      "CoM ID": "1663526",
      "Genus": "Banksia",
      "Year Planted": "2017",
      "Latitude": "-37.79582801",
      "Longitude": "144.9160598"
    },
    {
      "CoM ID": "1031170",
      "Genus": "Melaleuca",
      "Year Planted": "1997",
      "Latitude": "-37.82326441",
      "Longitude": "144.9305296"
    }
  ]
}

以及以下所示形式的Geojson多边形数组(featureCollection):

{"type":"FeatureCollection","features":[
{"type":"Feature","id":"01","properties":{"name":"Alabama","density":94.65},"geometry":{"type":"Polygon","coordinates":[[[-87.359296,35.00118],[-85.606675,34.984749],[-85.431413,34.124869],[-85.184951,32.859696],[-85.069935,32.580372],[-84.960397,32.421541],[-85.004212,32.322956],[-84.889196,32.262709],[-85.058981,32.13674],[-85.053504,32.01077],[-85.141136,31.840985],[-85.042551,31.539753],[-85.113751,31.27686],[-85.004212,31.003013],[-85.497137,30.997536],[-87.600282,30.997536],[-87.633143,30.86609],[-87.408589,30.674397],[-87.446927,30.510088],[-87.37025,30.427934],[-87.518128,30.280057],[-87.655051,30.247195],[-87.90699,30.411504],[-87.934375,30.657966],[-88.011052,30.685351],[-88.10416,30.499135],[-88.137022,30.318396],[-88.394438,30.367688],[-88.471115,31.895754],[-88.241084,33.796253],[-88.098683,34.891641],[-88.202745,34.995703],[-87.359296,35.00118]]]}},{"type":"Feature","id":"15","properties":{"name":"Hawaii","density":214.1},"geometry":{"type":"MultiPolygon","coordinates":[[[[-155.634835,18.948267],[-155.881297,19.035898],[-155.919636,19.123529],[-155.886774,19.348084],[-156.062036,19.73147],[-155.925113,19.857439],[-155.826528,20.032702],[-155.897728,20.147717],[-155.87582,20.26821],[-155.596496,20.12581],[-155.284311,20.021748],[-155.092618,19.868393],[-155.092618,19.736947],[-154.807817,19.523346],[-154.983079,19.348084],[-155.295265,19.26593],[-155.514342,19.134483],[-155.634835,18.948267]]],[[[-156.587823,21.029505],[-156.472807,20.892581],[-156.324929,20.952827],[-156.00179,20.793996],[-156.051082,20.651596],[-156.379699,20.580396],[-156.445422,20.60778],[-156.461853,20.783042],[-156.631638,20.821381],[-156.697361,20.919966],[-156.587823,21.029505]]],[[[-156.982162,21.210244],[-157.080747,21.106182],[-157.310779,21.106182],[-157.239579,21.221198],[-156.982162,21.210244]]],[[[-157.951581,21.697691],[-157.842042,21.462183],[-157.896811,21.325259],[-158.110412,21.303352],[-158.252813,21.582676],[-158.126843,21.588153],[-157.951581,21.697691]]],[[[-159.468693,22.228955],[-159.353678,22.218001],[-159.298908,22.113939],[-159.33177,21.966061],[-159.446786,21.872953],[-159.764448,21.987969],[-159.726109,22.152277],[-159.468693,22.228955]]]]}}

我正在尝试使用R查找内部具有点的Geojson多边形。例如,如何知道上面添加的三个点是否在多边形内部?以及哪个点在哪个多边形中。

因为我有一个Geojson多边形对象列表和一个点​​列表。无法将它们手动输入到R中。

是否存在任何R函数或任何方式对解决此问题有用?如果返回的是多边形的ID,将非常有帮助。

0 个答案:

没有答案