Placard.js
A dead simple interface for creating Google Maps with multiple points.
Usage
Begin by including the Maps API and Placard JavaScript files:
Create an object containing the points you want to add to your map. The only
required properties are lat
and lng
. Use latlng.me if
you need help.
var locations = lat: 3973703 lng: -10497280 lat: 3976463 lng: -10500401 lat: 3975046 lng: -10499954 lat: 3974414 lng: -10498984 lat: 3976112 lng: -10498172 ;
Next, create a new map using Placard.Map
:
var map = 'canvas' center: lat: 3973932 lng: -10498480 zoom: 13;
Finally, add your locations to the map:
locations;
API
Placard.Map
Constructor
Creates a new instance of Placard.Map and returns itself.
var map = el config;
Parameters
Name | Type | Description |
---|---|---|
el | String | The ID of the HTML element for the map |
config | google.maps.MapOptions | The settings used to configure the map |
addPoint
Adds a point to the map and returns the map.
map;
Parameters
Name | Type | Description |
---|---|---|
point | Object | An object containing both lat and lng properties |
Placard.Point
Constructor
Creates a new instance of Placard.Point and returns itself.
var point = point;
Parameters
Name | Type | Description |
---|---|---|
point | Object | An object containing both lat and lng properties |
addToMap
Adds the point to a map and returns the point.
point;
Parameters
Name | Type | Description |
---|---|---|
map | Placard.Map | The map that the point should be added to |