您好,我正在使用地理编码功能来获取某些城市的经纬度数据,但是对于某些特殊字母字符的城市,例如:“ MarcosJuárezArgentina”或“PerúArgentina”,在生成查询时会出错:>
dynamic_btn.style[position_1] = position_1_value;
有没有办法解决这个问题?
答案 0 :(得分:1)
我们可以使用enc2utf8()
函数来读取或设置字符向量的声明编码:
> geocode(enc2utf8("Marcos Juárez Argentina"), output = 'more')
Information from URL : http://maps.googleapis.com/maps/api/geocode/json?address=Marcos%20Ju%C3%A1rez%20Argentina&sensor=false
lon lat type loctype address north south east west locality
1 -62.1058 -32.69786 locality approximate marcos juárez, cordoba, argentina -32.67304 -32.71417 -62.07497 -62.1302 Marcos Juárez
administrative_area_level_2 administrative_area_level_1 country
1 Marcos Juárez Department Cordoba Argentina
答案 1 :(得分:1)
或者您可以使用不对输入进行音译的地理编码服务:example
在杰森(Json): https://geocode.xyz/Marcos%20Ju%C3%A1rez%20Argentina?json=1
{“ standard”:{“ addresst”:{},“ city”:“ MarcosJuárez”,“ prov”:“ AR”,“ countryname”:“ Argentina”,“ postal”:{},“信心“:” 0.9“},” longt“:” -62.10158“,” alt“:{},”海拔“:{},” latt“:” -32.69679“}