Giter Site home page Giter Site logo

thibaultclem / react-map-gl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from visgl/react-map-gl

0.0 1.0 0.0 7.29 MB

React friendly API wrapper around MapboxGL JS

Home Page: https://uber.github.io/react-map-gl

License: Other

JavaScript 83.51% HTML 1.11% CSS 14.61% Shell 0.77%

react-map-gl's Introduction

version build downloads

react-map-gl | Docs

React Components Suite for Mapbox GL JS.

In addition to exposing MapboxGL functionality to React apps, react-map-gl also integrates seamlessly with deck.gl.

Installation

Using react-map-gl requires node >= v4 and react >= 15.4.

npm install --save react-map-gl

Example

import {Component} from 'react';
import ReactMapGL from 'react-map-gl';

class Map extends Component {

  state = {
    viewport: {
      width: 400,
      height: 400,
      latitude: 37.7577,
      longitude: -122.4376,
      zoom: 8
    }
  };

  render() {
    return (
      <ReactMapGL
        {...this.state.viewport}
        onViewportChange={(viewport) => this.setState({viewport})}
      />
    );
  }
}

About Mapbox Tokens

To show maps from a service such as Mapbox you will need to register on their website in order to retrieve an access token required by the map component, which will be used to identify you and start serving up map tiles. The service will be free until a certain level of traffic is exceeded.

There are several ways to provide a token to your app, as showcased in some of the example folders:

  • Modify the source directly
  • Set the MapboxAccessToken environment variable
  • Provide it in the URL, e.g ?access_token=TOKEN

But we would recommend using something like dotenv and put your key in an untracked .env file, that will then expose it as a process.env variable, with much less leaking risks.

react-map-gl's People

Contributors

abmai avatar cammanderson avatar chris-catignani avatar cl0ckwork avatar drewbo avatar epicallan avatar ericsoco avatar forrert avatar ibgreen avatar j0nas avatar javidhsueh avatar jdeerhake avatar joao avatar joeduncan avatar jwarning avatar koulmomo avatar lafin avatar lucafalasco avatar mattdesl avatar mohammad7t avatar pessimistress avatar philogb avatar pilotconway avatar pranspach avatar rilyu avatar tsemerad avatar vicapow avatar vinkla avatar willyham avatar wwwtyro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.