【问题标题】:react-map-gl - India geoLocation is showing Incorrectreact-map-gl - 印度地理位置显示不正确
【发布时间】:2020-07-05 17:08:41
【问题描述】:

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

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

【问题讨论】:

    标签: javascript reactjs mapbox-gl-js react-map-gl


    【解决方案1】:

    问题出在 parseInt 上

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-16
      • 2011-02-25
      • 1970-01-01
      • 2021-10-30
      • 2022-08-18
      • 1970-01-01
      • 2022-01-22
      • 2017-02-12
      相关资源
      最近更新 更多