0

我正在使用 react-map-gl 的标记组件在地图上渲染印度城市,显示前。Mumbai "lat": "19.0760", "long": "72.8777" on react-map-gl 但它在 map 上显示的位置不正确。

查找 Img 链接 - 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>
        ))}]

4

1 回答 1

0

问题出在 parseInt

答案 - https://github.com/visgl/react-map-gl/issues/1145

于 2020-07-10T12:34:10.220 回答