Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Error with Maplibre 5 and React Map GL (pixelsToGLUnits) #2460

Closed
tordans opened this issue Jan 6, 2025 · 3 comments
Closed

[Bug] Error with Maplibre 5 and React Map GL (pixelsToGLUnits) #2460

tordans opened this issue Jan 6, 2025 · 3 comments
Labels

Comments

@tordans
Copy link
Contributor

tordans commented Jan 6, 2025

Description

I tried to update two of my Astro+React (React Map GL) projects to Maplibre 5 and I am getting an error “pixelsToGLUnits” for both.

I don’t see issues in either repo (Search Maplibre), but React Map GL uses the setting internally.

The new react-maplibre library does not use the setting.

image

Expected Behavior

No response

Steps to Reproduce

  1. Run https://github.com/FixMyBerlin/nudafa
  2. Update Maplibre to 5
  3. Open https://www.nudafa.de/radnetz/einleitung?map=11%2F52.345%2F13.61 (locally) to see the error

Environment

  • Framework version: "react-map-gl": "^7.2.0-beta.1",
  • Map library: "maplibre-gl": "^4.7.1" works, 5.0.x does not
  • Browser: Chrome
  • OS: Mac OS

Logs

No response

@tordans tordans added the bug label Jan 6, 2025
@albricepiazza
Copy link

albricepiazza commented Jan 6, 2025

Same here !

There is a compatibility problem between react-map-gl and maplibre-gl@5

@Pessimistress
Copy link
Collaborator

See #2457

emersion added a commit to OpenRailAssociation/osrd-ui that referenced this issue Jan 14, 2025
maplibre-gl v5 causes multiple issues:

- The story is broken (JavaScript error trying to set pixelsToGLUnits).
  Upstream bug report: visgl/react-map-gl#2460
- A new TypeScript error pops up, went unnoticed because CI doesn't
  fail on these:

    (!) [plugin typescript] src/components/DataLoader.tsx (61:43): @rollup/plugin-typescript TS2345: Argument of type 'GeoJSONFeature' is not assignable to parameter of type 'MapGeoJSONFeature'.
      Type 'GeoJSONFeature' is missing the following properties from type '{ layer: (Omit<FillLayerSpecification, "source"> | Omit<LineLayerSpecification, "source"> | Omit<SymbolLayerSpecification, "source"> | ... 5 more ... | Omit<...>) & { ...; }; source: string; sourceLayer?: string | undefined; state: { ...; }; }': layer, source, state
    /home/simon/src/osrd-ui/ui-warped-map/src/components/DataLoader.tsx:61:43

    61               .map((f) => simplifyFeature(f, sourceLayer));

This commit effectively reverts:
#797

Signed-off-by: Simon Ser <[email protected]>
emersion added a commit to emersion/react-map-gl that referenced this issue Jan 14, 2025
maplibre-gl causes some errors:
visgl#2460

Indicate in package.json that react-map-gl is not yet compatible
with maplibre-gl v5.
emersion added a commit to emersion/react-map-gl that referenced this issue Jan 14, 2025
maplibre-gl v5 causes some errors:
visgl#2460

Indicate in package.json that react-map-gl is not yet compatible
with maplibre-gl v5.
github-merge-queue bot pushed a commit to OpenRailAssociation/osrd-ui that referenced this issue Jan 15, 2025
maplibre-gl v5 causes multiple issues:

- The story is broken (JavaScript error trying to set pixelsToGLUnits).
  Upstream bug report: visgl/react-map-gl#2460
- A new TypeScript error pops up, went unnoticed because CI doesn't
  fail on these:

    (!) [plugin typescript] src/components/DataLoader.tsx (61:43): @rollup/plugin-typescript TS2345: Argument of type 'GeoJSONFeature' is not assignable to parameter of type 'MapGeoJSONFeature'.
      Type 'GeoJSONFeature' is missing the following properties from type '{ layer: (Omit<FillLayerSpecification, "source"> | Omit<LineLayerSpecification, "source"> | Omit<SymbolLayerSpecification, "source"> | ... 5 more ... | Omit<...>) & { ...; }; source: string; sourceLayer?: string | undefined; state: { ...; }; }': layer, source, state
    /home/simon/src/osrd-ui/ui-warped-map/src/components/DataLoader.tsx:61:43

    61               .map((f) => simplifyFeature(f, sourceLayer));

This commit effectively reverts:
#797

Signed-off-by: Simon Ser <[email protected]>
@mhu
Copy link

mhu commented Jan 16, 2025

I encountered the same problem with react-map-gl version 7.1.8 and maplibre-gl version 5.0.1. Additionally, none of my Markers were showing up on my map.

I resolved both issues by downgrading maplibre-gl to version 4.7.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants