Hello!
I'll tell you about one small (~ 30kb) JS library for easy work with the Google Maps API called
gmaps.js .
Since the library was created to speed up the web development process, I will not detain you either. As the name implies, it does nothing more than simplifies interaction with
the Google Maps API . Many of you worked with the API and probably every time you had to sweat in order to dig into the documentation and implement, for example, your own description of the label on the map. Or subscribe to a card interaction event ...
So, she hasn't got any major version yet, and currently she has
version 0.1.12.3 . It is distributed under the
MIT License and is developed by the whole community (and you can also help with this).
Examples of opportunities
Creating a map
new GMaps({ div: '#map', lat: -12.043333, lng: -77.028333 });
And you can add options
zoom ,
width ,
height . Although according to the standard, the width and height of the map will be adjusted to the container.
')
Developments
map = new GMaps({ div: '#map', zoom: 16, lat: -12.043333, lng: -77.028333, click: function(e) { alert('click'); }, dragend: function(e) { alert('dragend'); } });
All Maps API events are supported.
Geolocation
GMaps.geolocate({ success: function(position) { map.setCenter(position.coords.latitude, position.coords.longitude); }, error: function(error) { alert('Geolocation failed: '+error.message); }, not_supported: function() { alert("Your browser does not support geolocation"); }, always: function() { alert("Done!"); } });
Well, isn't it lovely?
Adding a marker
map.addMarker({ lat: -12.043333, lng: -77.028333, title: 'Lima', click: function(e) { alert('You clicked in this marker'); }, infoWindow: { content: '<p>Home, sweet home...</p>' } } });
And everything, everything, everything!
The library supports almost the full functionality of the Maps API, including displaying static maps (by a picture), overlaying layers, plotting routes, drawing polygons, drawing their controls, GeoRSS, and so on ...
Please read the library website:
http://hpneo.github.com/gmaps/ and start creating.
And immediately fork the repository on Github:
https://github.com/HPNeo/gmapsUPD: KidsKilla suggests that, in principle, according to Maps API ToS, no one has the right to create their own
wrappers (shells) over the current API until it receives official Google permission. (
https://developers.google.com/maps/terms , clause 10.2). To which the developer (Gustavo Leon) replied that he would do two things: 1) request permission from Google 2) the connection ticket is already open,
not only for the Google Maps API, but also for OpenStreetMap. This is happiness!