MCPcopy Index your code
hub / github.com/visgl/react-map-gl

github.com/visgl/react-map-gl @v8.1.1 sqlite

repository ↗ · DeepWiki ↗ · release v8.1.1 ↗
519 symbols 1,385 edges 291 files 4 documented · 1% 5 cross-repo links
README

version build downloads

react-map-gl | Docs

react-map-gl is a suite of React components designed to provide a React API for mapbox-gl or maplibre-gl. More information in the online documentation.

See our Design Philosophy.

Installation

Using react-map-gl requires react >= 16.3.

# Using Maplibre
npm install react-map-gl maplibre-gl

or

# Using Mapbox
npm install react-map-gl mapbox-gl

Example

// Using Maplibre
import * as React from 'react';
import Map from 'react-map-gl/maplibre';
import 'maplibre-gl/dist/maplibre-gl.css';

function App() {
  return (
    <Map
      initialViewState={{
        longitude: -122.4,
        latitude: 37.8,
        zoom: 14
      }}
      style={{width: 600, height: 400}}
      mapStyle="https://api.maptiler.com/maps/streets/style.json?key=<Maptiler access token>"
    />
  );
}

or

// Using Mapbox
import * as React from 'react';
import Map from 'react-map-gl/mapbox';
import 'mapbox-gl/dist/mapbox-gl.css';

function App() {
  return (
    <Map
      // https://visgl.github.io/react-map-gl/docs/get-started/mapbox-tokens
      mapboxAccessToken="<Mapbox access token>"
      initialViewState={{
        longitude: -100,
        latitude: 40,
        zoom: 3.5
      }}
      style={{width: 600, height: 400}}
      mapStyle="mapbox://styles/mapbox/streets-v9"
    />
  );
}

Learn more with in our Getting Started guide.

Contribute

See contribution guide.

Attributions

react-map-gl is part of vis.gl, an OpenJS Foundation project.

Development is also supported by

Extension points exported contracts — how you extend this code

ImmutableLike (Interface)
(no doc)
modules/react-mapbox/src/types/common.ts
ImmutableLike (Interface)
(no doc)
modules/main/src/mapbox-legacy/types/common.ts
ImmutableLike (Interface)
(no doc)
modules/react-maplibre/src/types/common.ts
MapLib (Interface)
(no doc)
modules/react-mapbox/src/types/lib.ts
MapLib (Interface)
(no doc)
modules/main/src/mapbox-legacy/types/lib.ts
MapLib (Interface)
(no doc)
modules/react-maplibre/src/types/lib.ts
IMapEvent (Interface)
(no doc)
modules/react-mapbox/src/types/events.ts
IMapEvent (Interface)
(no doc)
modules/main/src/mapbox-legacy/types/events.ts

Core symbols most depended-on inside this repo

map
called by 31
modules/react-mapbox/src/mapbox/mapbox.ts
sleep
called by 26
modules/react-mapbox/test/utils/test-utils.jsx
sleep
called by 24
modules/main/test/utils/test-utils.jsx
sleep
called by 24
modules/react-maplibre/test/utils/test-utils.jsx
getCenter
called by 16
modules/react-mapbox/test/utils/mapbox-gl-mock/edge_insets.js
getMap
called by 15
examples/mapbox/custom-overlay/src/custom-overlay.tsx
deepEqual
called by 14
modules/react-maplibre/src/utils/deep-equal.ts
deepEqual
called by 13
modules/main/src/mapbox-legacy/utils/deep-equal.ts

Shape

Function 335
Method 148
Class 26
Interface 10

Languages

TypeScript100%

Modules by API surface

modules/react-mapbox/src/mapbox/mapbox.ts23 symbols
modules/main/src/mapbox-legacy/mapbox/mapbox.ts23 symbols
modules/react-mapbox/test/utils/mapbox-gl-mock/lng_lat_bounds.js20 symbols
modules/main/test/utils/mapbox-gl-mock/lng_lat_bounds.js20 symbols
modules/react-maplibre/src/maplibre/maplibre.ts18 symbols
modules/react-mapbox/test/utils/mapbox-gl-mock/transform.js13 symbols
modules/main/test/utils/mapbox-gl-mock/transform.js11 symbols
modules/react-mapbox/test/utils/mapbox-gl-mock/lng_lat.js9 symbols
modules/main/test/utils/mapbox-gl-mock/lng_lat.js9 symbols
examples/maplibre/custom-overlay/src/custom-overlay.tsx9 symbols
examples/mapbox/custom-overlay/src/custom-overlay.tsx9 symbols
modules/react-mapbox/test/utils/mapbox-gl-mock/edge_insets.js8 symbols

Dependencies from manifests, versioned

@docusaurus/core3.0.0 · 1×
@mapbox/mapbox-gl-draw1.3.0 · 1×
@mapbox/mapbox-gl-geocoder4.7.4 · 1×
@maplibre/maplibre-gl-geocoder1.5.0 · 1×
@maplibre/maplibre-gl-style-spec19.2.1 · 1×
@turf/area6.5.0 · 1×
@turf/bbox6.5.0 · 1×
@types/mapbox-gl3.4.0 · 1×
@types/mapbox__mapbox-gl-draw1.2.3 · 1×
@types/mapbox__mapbox-gl-geocoder4.7.2 · 1×
@types/node22.0.0 · 1×
@types/react16.0.0 · 1×

For agents

$ claude mcp add react-map-gl \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact