简体   繁体   中英

react-map-gl - India geoLocation is showing Incorrect

i am rendering indian cities on map using marker component of react-map-gl, showing ex. Mumbai "lat": "19.0760", "long": "72.8777" on react-map-gl but it is showing in incorrect position on map.

find 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>
        ))}]

the problem was with parseInt

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM