Open aabright90 opened 2 years ago
We're interested in using the globe projection feature as well.
Cool, will this feature be availble in the latest version of React Map GL? And if so, when can this be expected?
I'm not part of the react-map-gl team, just part of another project who also want this feature :).
I don't see why you can't use it now. projection
accepts any string:
https://github.com/visgl/react-map-gl/blob/v7.0.12/src/mapbox/mapbox.ts#L272
"globe" isn't availble in the type declarations here: https://github.com/visgl/react-map-gl/blob/v7.0.12/src/types/external.ts#L4. The globe feature is only availble in Mapbox gl 2.9.1 and the latest version of react-map-gl uses Mapbox gl 2.8.0
@aabright90 You can't set center
and parallel
with name: 'globe'
. The map props allow any string passed to projection
on top of ProjectionSpecification
.
Regardless, if this bothers you, feel free to open a PR.
@aabright90 You can't set
center
andparallel
withname: 'globe'
. The map props allow any string passed toprojection
on top ofProjectionSpecification
.
Can you clarify what you mean? I try:
const { map: mapbox } = useContext(MapContext);
...
mapbox.setProjection("globe");
And get error: Invalid projection name: globe
Is there a workaround for this?
Set projection="globe"
. It's a prop on the Map component.
The native map class is not typed by this library. It is imported from @types/mapbox-gl
.
Also, the error you see is not a type error. It probably comes from mapbox-gl which means you do not have the latest version installed.
the latest version of react-map-gl uses Mapbox gl 2.8.0
react-map-gl does not specify a mapbox-gl version. It is whatever version your own project installed.
After reinstalling the react-mapbox-gl package I got it to work.
<Map projection="globe">
Globe projection prop works with latest react-mapbox-gl update
Target Use Case
I have a client who uses react-map-gl for an application that predicts live events accross the United States that also has global application. He wants to use the latest version of mapbox-gl for its globe feature, but 'globe' isn't available to pass into to projection prop on the Map component.
Proposal
Is it possible to get this package to accomodate the latest version of mapbox-gl so that the globe feature can be used?
https://www.mapbox.com/blog/globe-view/?utm_campaign=email%7Cblast%7Cglobe-launch-weather&utm_content=Globe+view+announcement+1&utm_medium=email_action&utm_source=customer.io