https://github.com/raruto/google-geolocate
Google Maps plugin that allows to add a geolocation control.
https://github.com/raruto/google-geolocate
geolocation google-maps javascript location-control mylocation position-control
Last synced: about 1 year ago
JSON representation
Google Maps plugin that allows to add a geolocation control.
- Host: GitHub
- URL: https://github.com/raruto/google-geolocate
- Owner: Raruto
- License: gpl-3.0
- Created: 2018-11-12T20:51:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-23T23:38:46.000Z (over 7 years ago)
- Last Synced: 2025-01-24T08:11:37.554Z (over 1 year ago)
- Topics: geolocation, google-maps, javascript, location-control, mylocation, position-control
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# google-geolocate.js
A Google Maps plugin that allows to add a geolocation control.
_For a working example (without API Key) see [demo](https://raruto.github.io/examples/google-geolocate/google-geolocate.html)_
---
## How to use
1. **include CSS & JavaScript**
```html
...
html, body, #map { width: 100%; height: 100%; margin: 0; padding: 0; }
...
```
2. **choose the div container used for the slippy map**
```html
...
...
```
3. **create your first simple “google-geolocate” slippy map**
```html
var mapOpts = {
center: new google.maps.LatLng(45, 9.5),
zoom: 5,
MapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map'), mapOpts);
var geolocationControl = new GeolocationControl(map, 13);
```
_**NB** to be able to use the “Geolocator API” (a.k.a. “MyLocation Button”) you **MUST** own:_
- _a valid [SSL Website](https://en.wikipedia.org/wiki/HTTPS)._
- _a valid [Google Maps API Key](https://developers.google.com/maps/documentation/javascript/get-api-key)_
---
**Compatibile with:** gmaps@3.34
---
**Contributors:** [Raruto](https://github.com/Raruto/google-geolocate)
