我的react应用程序,我使用的是库@react-google-maps/api
和react-places-autocomplete
。
我怎样才能得到国家、州、城市的长坐标?
如何获得格式化的地址,地点,给付和长?
发布于 2022-09-28 06:16:18
Geocoding.
npm安装-保存反应-本机地理编码
用于地理编码和反向地理编码的
从“react本机-地理编码”导入地理编码器;
);//初始化模块
Geocoder.from(41.89,12.49) .then(json => { var addressComponent = >json.results.address_components;
console.log(addressComponent);}) .catch(错误=> console.warn(错误));//位置对象Geocoder.from({纬度: 41.89,经度: 12.49 });
// latlng对象Geocoder.from({ lat : 41.89,液化天然气: 12.49 });//数组Geocoder.from(41.89,12.49);
https://stackoverflow.com/questions/73873698
复制相似问题