如何确定纬度和经度是否属于特定城市的一部分?
How to identify if latitude and longitude are part of particular city?
我有一个纬度和经度的集合。如果我提供城市名称(例如芝加哥),我如何才能只找出那些在提供的城市边界内的 lat/longs?
最终产品将是带有定位图钉的城市地图。
您可以使用 result_type=locality
参数对 latlng 执行 reverse geocoding 请求。响应将包含此坐标所属的城市名称。
例如坐标41.878253,-87.72995将return 'Chicago, IL, USA':
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.878253%2C-87.72995&result_type=locality&key=YOUR_API_KEY
坐标41.970722,-88.420715将return 'Campton Hills, IL, USA':
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.970722%2C-88.420715&result_type=locality&key=YOUR_API_KEY
希望对您有所帮助!
我有一个纬度和经度的集合。如果我提供城市名称(例如芝加哥),我如何才能只找出那些在提供的城市边界内的 lat/longs?
最终产品将是带有定位图钉的城市地图。
您可以使用 result_type=locality
参数对 latlng 执行 reverse geocoding 请求。响应将包含此坐标所属的城市名称。
例如坐标41.878253,-87.72995将return 'Chicago, IL, USA':
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.878253%2C-87.72995&result_type=locality&key=YOUR_API_KEY
坐标41.970722,-88.420715将return 'Campton Hills, IL, USA':
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.970722%2C-88.420715&result_type=locality&key=YOUR_API_KEY
希望对您有所帮助!