Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/foxbunny/ribcage-google-maps

Google Maps JavaScript API v3 wrapper for Ribcage
https://github.com/foxbunny/ribcage-google-maps

Last synced: 28 days ago
JSON representation

Google Maps JavaScript API v3 wrapper for Ribcage

Awesome Lists containing this project

README

        

# Ribcage-Google-Maps

This library adds support for [Google Maps JavaScript API
v3](https://developers.google.com/maps/documentation/javascript/) to
[Ribcage](https://github.com/foxbunny/ribcage) apps.

It constists of models, collections, and views that help make working with the
Maps API more like working with Backbone applications.

The library is still work in progress, so please don't expect miracles.

## Requirements

This library depends on Ribcage and
[require-async](https://github.com/millermedeiros/requirejs-plugins) module (if
used with RequireJS). Naturally, it requires the Google Maps API v3
library. It also requires [DaHelpers](https://github.com/foxbunny/dahelpers).

## Installation

Ribcage-Google-Maps modules are in UMD format. This means you can either use
them with an AMD module loader such as [RequireJS](http://requirejs.org/) or
with classic `` tags. If you wish to use this library with an AMD
loader, please also consult the [next section](#shimming-the-gmaps-module).

When loading modules using the `<script>` tag, please make sure `all.js` is
loaded before other modules. Also, when adding the modules using `<script>`
tags, the UMD wrapper will do a basic dependency check and you may receive
exceptions if the dependencies are not available.

## Shimming the gmaps module

When using as AMD modules, you will need to adjust your RequireJS and build
configuration. This is due to the way Google Maps API library is loaded, and
because the API key can only be specified in the library's URL.

Please see API documentation in [`doc/gmaps.mkd`](doc/gmaps.mkd) for
recommended setup. You may also substitute `gmaps.js` with your own version
that does things differently (e.g., downloaded version of Google Maps API
library, etc).

## Quick example

Here's a quick example with [`MapDataModel`](doc/models/map_data.mkd) and
[`MapView`](doc/views/map.mkd):

var mapData = new MapDataModel({
lat: 37.783333,
long: -122.416667
});

var map = new MapView({model: mapData, el: '#map-canvas'});
map.render()

This should render a map within an element with `id` attribute '#map-canvas'
centered on San Francisco.

## API documentation

Complete API documentation is located in the [`doc` directory](doc). These
files are Markdown files generated from the source code. Documentation for
[main module](doc/all.mkd) contains links to individual modules.