react-leaflet-google-traffic

google layer(traffic) as React compoment for Leaflet clone form Christos Charmatzis's react-leaflet-google

Usage no npm install needed!

<script type="module">
  import reactLeafletGoogleTraffic from 'https://cdn.skypack.dev/react-leaflet-google-traffic';
</script>

README

react-leaflet-google npm version

GoogleMaps layer as React component for Leaflet build on top of React-Leaflet.

The google maps layer is using the plugin from Leaflet.GridLayer.GoogleMutant

Also it uses google-maps, a wrapper for asynchronously download Google Maps API in the browser.

Example

supported versions

  • "react-leaflet": "^1.0.1"
  • "leaflet": "^1.0.3"
  • "react": "^15.5.0"

Getting started

import { Map, TileLayer, LayersControl } from 'react-leaflet'
import {GoogleLayer} from '../src'
const { BaseLayer } = LayersControl;
const key = 'Your Key goes here';
const terrain = 'TERRAIN';
const road = 'ROADMAP';


....

  <BaseLayer checked name='Google Maps Roads'>
     <GoogleLayer googlekey={key}  maptype={road}/>
  </BaseLayer>
  <BaseLayer  name='Google Maps Terrain'>
     <GoogleLayer googlekey={key}  maptype={terrain} />
  </BaseLayer>


For more details on how to use this plugin check the example.