All Projects → alex3165 → React Mapbox Gl

alex3165 / React Mapbox Gl

Licence: mit
A React binding of mapbox-gl-js

Programming Languages

typescript
32286 projects
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to React Mapbox Gl

React Map Gl
React Component Library for Mapbox GL JS
Stars: ✭ 298 (-82.29%)
Mutual labels:  mapbox-gl, mapbox-gl-js, map
angular-mapboxgl-directive
AngularJS directive for Mapbox GL
Stars: ✭ 43 (-97.45%)
Mutual labels:  map, mapbox-gl, mapbox-gl-js
Mapbox Gl Js
Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
Stars: ✭ 8,017 (+376.35%)
Mutual labels:  mapbox-gl, mapbox-gl-js, map
react-map-gl-cluster
Urbica React Cluster Component for Mapbox GL JS
Stars: ✭ 27 (-98.4%)
Mutual labels:  map, mapbox-gl, mapbox-gl-js
React Map Gl
React friendly API wrapper around MapboxGL JS
Stars: ✭ 6,244 (+271%)
Mutual labels:  mapbox-gl, mapbox-gl-js, map
maptalks.mapboxgl
MapboxglLayer for maptalks.js
Stars: ✭ 51 (-96.97%)
Mutual labels:  mapbox-gl, mapbox-gl-js
who-owns-what
Who owns what in nyc?
Stars: ✭ 146 (-91.33%)
Mutual labels:  mapbox-gl, mapbox-gl-js
react-mapboxgl
Declarative React components for mapbox-gl-js.
Stars: ✭ 15 (-99.11%)
Mutual labels:  mapbox-gl, mapbox-gl-js
Mapbox Gl Native Android
Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL
Stars: ✭ 135 (-91.98%)
Mutual labels:  mapbox-gl, map
nycbikemap
A web-based, unified, interactive bike map for NYC that combines information from NYC OpenData, Citi Bike and other sources.
Stars: ✭ 15 (-99.11%)
Mutual labels:  map, mapbox-gl-js
Mapdeck
R interface to Deck.gl and Mapbox
Stars: ✭ 296 (-82.41%)
Mutual labels:  mapbox-gl, mapbox-gl-js
react-map-gl-draw
React Component for Mapbox GL Draw
Stars: ✭ 50 (-97.03%)
Mutual labels:  mapbox-gl, mapbox-gl-js
deck.gl-time-series-widget
A React Time Slider implementation for DECK.GL - (non)temporal data - by CPU filtering ⌛
Stars: ✭ 19 (-98.87%)
Mutual labels:  mapbox-gl, mapbox-gl-js
Mapbox Gl Draw
Draw tools for mapbox-gl-js
Stars: ✭ 569 (-66.19%)
Mutual labels:  mapbox-gl, mapbox-gl-js
Osm Liberty
A free Mapbox GL basemap style for everyone
Stars: ✭ 231 (-86.27%)
Mutual labels:  mapbox-gl, mapbox-gl-js
Martin
Blazing fast and lightweight PostGIS vector tiles server
Stars: ✭ 540 (-67.91%)
Mutual labels:  mapbox-gl, mapbox-gl-js
Iclient Javascript
Modern GIS Web Client for JavaScript, based on Leaflet\OpenLayers\MapboxGL-JS\Classic(iClient8C), enhanced with ECharts\D3\MapV etc. Contributed by SuperMap & community.
Stars: ✭ 593 (-64.77%)
Mutual labels:  mapbox-gl-js, map
Mapbox Gl Native
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
Stars: ✭ 4,091 (+143.08%)
Mutual labels:  mapbox-gl, map
Editor
An open source visual editor for the 'Mapbox Style Specification'
Stars: ✭ 1,167 (-30.66%)
Mutual labels:  mapbox-gl, mapbox-gl-js
Chartjs Chart Geo
Chart.js Choropleth and Bubble Maps
Stars: ✭ 94 (-94.41%)
Mutual labels:  map

Logo

React-mapbox-gl | Documentation | Demos

Build Status npm version npm downloads TypeScript

React wrapper for mapbox-gl-js.



London cycle example gif

Components

Proxy components (proxy between React and Mapbox API)

  • ReactMapboxGL
  • Layer & Feature
    • property symbol displays a mapbox symbol.
    • property line displays a lineString.
    • property fill displays a polygon.
    • property circle displays a mapbox circle.
    • property raster displays a mapbox raster tiles.
    • property fill-extrusion displays a layer with extruded buildings.
    • property background displays a mapbox background layer.
    • property heatmap displays a mapbox heatmap layer.
  • Source
  • GeoJSONLayer

DOM components (normal React components)

  • ZoomControl
  • ScaleControl
  • RotationControl
  • Marker (Projected component)
  • Popup (Projected component)
  • Cluster

Getting Started

npm install react-mapbox-gl mapbox-gl --save

Example:

Adding the css in your index.html:

<html>
  <head>
    ...
    <link
      href="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.css"
      rel="stylesheet"
    />
  </head>
</html>
// ES6
import ReactMapboxGl, { Layer, Feature } from 'react-mapbox-gl';
import 'mapbox-gl/dist/mapbox-gl.css';

// ES5
var ReactMapboxGl = require('react-mapbox-gl');
var Layer = ReactMapboxGl.Layer;
var Feature = ReactMapboxGl.Feature;
require('mapbox-gl/dist/mapbox-gl.css');

const Map = ReactMapboxGl({
  accessToken:
    'pk.eyJ1IjoiZmFicmljOCIsImEiOiJjaWc5aTV1ZzUwMDJwdzJrb2w0dXRmc2d0In0.p6GGlfyV-WksaDV_KdN27A'
});

// in render()
<Map
  style="mapbox://styles/mapbox/streets-v9"
  containerStyle={{
    height: '100vh',
    width: '100vw'
  }}
>
  <Layer type="symbol" id="marker" layout={{ 'icon-image': 'marker-15' }}>
    <Feature coordinates={[-0.481747846041145, 51.3233379650232]} />
  </Layer>
</Map>;

Why are zoom, bearing and pitch Arrays ?

If those properties changed at the mapbox-gl-js level and you don't update the value kept in your state, it will be unsynced with the current viewport. At some point you might want to update the viewport value (zoom, pitch or bearing) with the ones in your state but using value equality is not enough. Taking zoom as example, you will still have the unsynced zoom value therefore we can't tell if you want to update the prop or not. In order to explicitly update the current viewport values you can instead break the references of those props and reliably update the current viewport with the one you have in your state to be synced again.

Current version documentation

Version 3.0 documentation

Version 2.0 documentation

Contributions

Please try to reproduce your problem with the boilerplate before posting an issue.

mapbox-gl-draw compatibility

Try react-mapbox-gl-draw

Looking for an Angular alternative?

Try ngx-mapbox-gl

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].