UNPKG

react-google-maps

Version:
76 lines (68 loc) 1.86 kB
### Usage ```jsx static import { compose } from "recompose"; import { withScriptjs, withGoogleMap, GoogleMap, GroundOverlay, } from "react-google-maps"; const MapWithGroundOverlay = compose( withScriptjs, withGoogleMap )(props => <GoogleMap defaultZoom={12} defaultCenter={{lat: 40.740, lng: -74.18}} > <GroundOverlay url="https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg" bounds={new google.maps.LatLngBounds( new google.maps.LatLng(40.712216, -74.22655), new google.maps.LatLng(40.773941, -74.12544) )} defaultOpacity={.5} /> </GoogleMap> ); <MapWithGroundOverlay googleMapURL="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing.places" loadingElement={<div style={{ height: `100%` }} />} containerElement={<div style={{ height: `400px` }} />} mapElement={<div style={{ height: `100%` }} />} /> ``` ### Map with Ground Overlay ```jsx const { compose } = require("recompose"); const { withScriptjs, withGoogleMap, GoogleMap, GroundOverlay, } = require("../index"); const MapWithGroundOverlay = compose( withScriptjs, withGoogleMap )(props => <GoogleMap defaultZoom={12} defaultCenter={{lat: 40.740, lng: -74.18}} > <GroundOverlay url="https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg" bounds={new google.maps.LatLngBounds( new google.maps.LatLng(40.712216, -74.22655), new google.maps.LatLng(40.773941, -74.12544) )} defaultOpacity={.5} /> </GoogleMap> ); <MapWithGroundOverlay googleMapURL="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places" loadingElement={<div style={{ height: `100%` }} />} containerElement={<div style={{ height: `400px` }} />} mapElement={<div style={{ height: `100%` }} />} /> ```