Bootstrap

通过地址获取LONG和LAT并且存入csv

通过地址获取LONG和LAT并且存入csv

1. Address存在Address这个column里,从网上复制(如果可以爬虫自动更好)

2. 用代码获取GPS,再存入表格

import pandas as pd
from geopy.geocoders import Nominatim
from time import sleep

# 读取 CSV 文件
csv_file = r"D:\Research\Bessie\58_Address.csv"
hospitals = pd.read_csv(csv_file)

# 初始化地理编码器
geolocator = Nominatim(user_agent="hospital_geocoder")

# 定义地理编码函数
def geocode_address(address):
    try:
        location = geolocator.geocode(address)
        if location:
            return location.longitude, location.latitude
        else:
            return None, None
    except:
        return None, None

# 创建新列存储经纬度
hospitals['longitude'], hospitals['latitude'] = zip(*hospitals['Address'].apply(geocode_address))

# 保存带经纬度的 CSV 文件
hospitals.to_csv("58_hospitals_with_latlong.csv", index=False)

3.根据文件名找到表格,并且放入arcgis里面

buffer大小:10m, 50m, 100m, 150m, and 200m

;