[英]Generating geographical coordinates from giver corner
Based on the given corner in the map(position A), I want to generate more coordinates towards position B by adding some small values (distances) in the given latitude and longitude.基于地图中的给定角(位置 A),我想通过在给定的纬度和经度中添加一些小值(距离)来生成更多朝向位置 B 的坐标。 For instance:
例如:
( 143.5689855, -38.328956999999996)
, how can I create the coordinates for the remaining 5?( 143.5689855, -38.328956999999996)
,我该如何创建其余 5 所房子的坐标? What I have tried:我尝试过的:
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)
Output:输出:
Assuming you have the 2 locations of house A and house B as loc_A
and loc_B
.假设你有房子 A 和房子 B 的 2 个位置作为
loc_A
和loc_B
。 Assuming you know the house numbers of A and B. --> You know the number of houses.假设你知道 A 和 B 的门牌号。 --> 你知道门牌号。
The following code will iterate over the house numbers and create a list of locations:以下代码将遍历门牌号并创建位置列表:
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)])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.