An open API service indexing awesome lists of open source software.

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.

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)_

---


Google+Geolocate Control

## 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)