visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.35k forks source link

[Bug] Map projection property not working #2328

Closed Hussain-Aziz closed 11 months ago

Hussain-Aziz commented 11 months ago

Description

I have a map component. Although the projection is set to globe, it still renders mercator.

Expected Behavior

A globe projection in the map panel

Steps to Reproduce

import Map, { Marker, GeolocateControl } from 'react-map-gl';
import React, { useRef, useEffect, useState } from 'react';
import 'mapbox-gl/dist/mapbox-gl.css';

export default function MapPanel() {

  const initialViewState = {
    latitude: 25.4359571,
    longitude: 55.706461,
    zoom: 4
  }

  return (
    <Map
      ref={mapRef}
      mapboxAccessToken="TOKEN"
      initialViewState={initialViewState}
      mapStyle="mapbox://styles/mapbox/satellite-v9"
      projection='globe'
    >
      <GeolocateControl
        positionOptions={{ enableHighAccuracy: true }}
        trackUserLocation={true}
      />

      {(shownUserData ?? userData).map((data) => createMarkerWithTooltip(data))}

    </Map>
  )
}

Environment

Logs

No response

Pessimistress commented 11 months ago

mapbox-gl v1.x does not support global projection.