react-map-gl - 印度地理定位显示不正确
react-map-gl - India geoLocation is showing Incorrect
我正在使用 react-map-gl 的标记组件在地图上渲染印度城市,
显示前。孟买 "lat": "19.0760", "long": "72.8777" on react-map-gl 但它在地图上显示的位置不正确。
查找 Img link - https://i.stack.imgur.com/vlhqg.png
{
"cities": [
{
"name": "Mumbai",
"state": "Maharashtra",
"lat": "19.0760",
"lon": "72.8777"
}
]
}
// compoment
[{cityList.cities.map(city => (
<Marker
key={city.name}
latitude={parseInt(city.lat)}
longitude={parseInt(city.lon)}
offsetLeft={-20} offsetTop={-10}
>
<button
className="marker-btn"
onClick={e => {
e.preventDefault();
console.log(city.name);
}}
>
{city.name}
</button>
</Marker>
))}]
问题出在 parseInt
我正在使用 react-map-gl 的标记组件在地图上渲染印度城市, 显示前。孟买 "lat": "19.0760", "long": "72.8777" on react-map-gl 但它在地图上显示的位置不正确。
查找 Img link - https://i.stack.imgur.com/vlhqg.png
{
"cities": [
{
"name": "Mumbai",
"state": "Maharashtra",
"lat": "19.0760",
"lon": "72.8777"
}
]
}
// compoment
[{cityList.cities.map(city => (
<Marker
key={city.name}
latitude={parseInt(city.lat)}
longitude={parseInt(city.lon)}
offsetLeft={-20} offsetTop={-10}
>
<button
className="marker-btn"
onClick={e => {
e.preventDefault();
console.log(city.name);
}}
>
{city.name}
</button>
</Marker>
))}]
问题出在 parseInt