从给定角生成地理坐标

问题描述 投票:-1回答:1

基于地图(位置A)中的给定角,我想通过在给定的纬度和经度上添加一些小的值(距离)来生成更多的朝向位置B的坐标。例如:

  • 地图上从位置A到B有6栋房屋。如果我知道纬度,1个房屋的经度( 143.5689855, -38.328956999999996),如何为其余5个坐标创建坐标?
  • 我试图通过在给定角的坐标中添加一些小数字来实现这一目标,如下面的脚本所示。但是代码仅输出1个房子。如何在代码中创建一个循环,该循环将自动添加给定的较小数字并显示其余房屋甚至更大面积的新坐标?

enter image description here

我尝试过的:

from arcgis.gis import GIS
from arcgis.geocoding import geocode
from arcgis.geocoding import reverse_geocode
import pprint

# Create an anonymous connection to ArcGIS Online
gis = GIS()


#45-Stodart-St (given corner)
geocode_home = geocode(address="45 Stodart St, Colac VIC 3250")
location = [geocode_home[0]["location"]['x'], geocode_home[0]["location"]['y']]
pprint.pprint(location)


#Add some small numbers in origanal location. This will give us coordinates of next house i.e 43-Stodart-St

#43-Stodart-St

new_loc = [location[0]+0.0002215*1,location[1]*0.999999]

pprint.pprint(new_loc)

输出:

enter image description here

python arcgis
1个回答
1
投票

假设您拥有房屋A和房屋B的两个位置分别为loc_Aloc_B。假设您知道A和B的房子号码。->您知道房子的数目。

以下代码将迭代门牌号并创建位置列表:

longitude_diff = loc_B[0] - loc_A[0]
latitude_diff = loc_B[1] - loc_A[1]
house_locations = []

for i in range(1, house_number_B - house_number_A):
    house_locations.append([loc_B[0] + i * longitude_diff/(house_number_B - house_number_A),
           loc_B[1] + i * latitude_diff/(house_number_B - house_number_A)])
© www.soinside.com 2019 - 2024. All rights reserved.