22[ ![ Coverage Status] ( https://coveralls.io/repos/github/aviklai/react-leaflet-google-layer/badge.svg?branch=master )] ( https://coveralls.io/github/aviklai/react-leaflet-google-layer?branch=master )
33[ ![ npm version] ( https://img.shields.io/npm/v/react-leaflet-google-layer.svg )] ( https://www.npmjs.com/package/react-leaflet-google-layer )
44
5- Google layer for React-Leaflet using leaflet.gridlayer.googlemutant, implemented with typescript.
5+ Google layer for React-Leaflet v3 using leaflet.gridlayer.googlemutant, implemented with typescript.
66
7- Installation instructions:
7+ ## Requirements
8+ The current version of this library supports React Leaflet v3. <br />
9+ If you are using React Leaflet v2, please use the previous version of this library. Please see the documentation here: <br />
10+ https://github.com/aviklai/react-leaflet-google-layer/tree/v1
11+
12+ ## Installation instructions:
8131 . run ` npm install --save react-leaflet-google-layer `
9142 . By default this library uses the google-maps loader library to load the google maps api. If you want to use the script tag instead, you can Add google maps js api in your index.html: <br />
1015` <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" async defer></script> ` <br />
@@ -14,38 +19,35 @@ and set the prop useGoogMapsLoader to `false`.
1419Usage example:
1520```
1621import * as React from 'react';
17- import { Map } from 'react-leaflet';
22+ import { MapContainer } from 'react-leaflet';
1823import ReactLeafletGoogleLayer from 'react-leaflet-google-layer';
1924
20- export class App extends React.Component {
21- render() {
22- return (
23- <Map zoom={15} center={[45, 20]}>
24- <ReactLeafletGoogleLayer googleMapsLoaderConf={{KEY: 'YOUR_API_KEY'}} type={'satellite'} />
25- </Map>
26- );
27- }
28- }
25+ export const App = () => {
26+ return (
27+ <MapContainer zoom={15} center={[45, 20]}>
28+ <ReactLeafletGoogleLayer apiKey='YOUR_API_KEY' type={'satellite'} />
29+ </MapContainer>
30+ );
31+ };
32+
2933```
3034
3135## Basic usage example
32- https://codesandbox.io/s/basicusage-qluec
36+ https://codesandbox.io/s/basic-usage-with-react-leaflet-v3-vx8fd
3337
3438## Options
39+ apiKey?: string <br />
3540useGoogMapsLoader?: boolean, default: ` true ` <br />
3641googleMapsAddLayers?: { name: 'BicyclingLayer' | 'TrafficLayer' | 'TransitLayer', options?: any }[ ] <br />
3742zIndex?: number <br />
3843
3944#### From google-maps (https://github.com/Carrooi/Js-GoogleMapsLoader ) - googleMapsLoaderConf prop:
40- * KEY?: string
41- * URL?: string
42- * LIBRARIES?: string[ ]
43- * CLIENT?: string
44- * CHANNEL?: string
45- * LANGUAGE?: string
46- * REGION?: string
47- * VERSION?: string
48- * WINDOW_CALLBACK_NAME?: string
45+ * version?: string
46+ * client?: string
47+ * channel?: string
48+ * language?: string
49+ * region?: string
50+ * libraries?: string[ ]
4951
5052#### From googlemutant (https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant):
5153* minZoom?: number
0 commit comments