sheetsee-maps
Advanced tools
+18
-2
@@ -176,3 +176,3 @@ var mapbox = require('mapbox.js') | ||
| module.exports.addMarkerLayer = function(geoJSON, map, template) { | ||
| module.exports.addMarkerLayer = function(geoJSON, map, template, clusterMarkers) { | ||
| if (!template) { | ||
@@ -196,3 +196,9 @@ template = makePopupTemplate(geoJSON) | ||
| var bounds = layer.getBounds() | ||
| layer.addTo(map) | ||
| // check option and Leaflet extension | ||
| var cluster = clusterMarkers && 'MarkerClusterGroup' in L | ||
| if (cluster) { | ||
| var clusterGroup = new L.MarkerClusterGroup() | ||
| } | ||
| map.fitBounds(bounds) | ||
@@ -203,4 +209,14 @@ | ||
| marker.bindPopup(popupContent.html(), {closeButton: false}) | ||
| if (cluster) { | ||
| clusterGroup.addLayer(marker) | ||
| } | ||
| }) | ||
| if (cluster) { | ||
| map.addLayer(clusterGroup) | ||
| } else { | ||
| layer.addTo(map) | ||
| } | ||
| return layer | ||
| } |
+1
-1
| { | ||
| "name": "sheetsee-maps", | ||
| "version": "0.0.4", | ||
| "version": "0.2.4", | ||
| "description": "enables map creation functionality with sheetsee.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+4
-3
| # Sheetsee-maps | ||
| see: [jlord.github.io/sheetsee.js](jlord.github.io/sheetsee.js) | ||
| see: [jlord.github.io/sheetsee.js](http://jlord.github.io/sheetsee.js) | ||
| demo: [maps](http://jlord.github.io/sheetsee.js/demos/demo-map.html) | ||
@@ -90,5 +91,5 @@ Sheetsee.js uses [Mapbox.js](http://mapbox.com/mapbox.js) and [Leaflet.js](http://leafletjs.com/) to make maps of your **points**, **polygons**, **lines** or **multipolygons** (all coordinate based). Details on what that actually looks like [here](http://leafletjs.com/examples/geojson.html). | ||
| ### Sheetsee.addMarkerLayer(geoJSON, map) | ||
| ### Sheetsee.addMarkerLayer(geoJSON, map, popupTemplate, clusterMarkers) | ||
| To add makers, lines or shapes to your map, use this function and pass in your **geoJSON** so that it can get the coordinates and your **map** so that it places the markers there. You can customize what the content in your marker's popup looks like with a **popupTemplate**, which is an ICanHaz.js template in HTML and can reference the column headers you included in your optionsJSON. | ||
| To add markers, lines or shapes to your map, use this function and pass in your **geoJSON** so that it can get the coordinates and your **map** so that it places the markers there. You can customize what the content in your marker's popup looks like with a **popupTemplate**, which is an ICanHaz.js template in HTML and can reference the column headers you included in your optionsJSON. You can set `true` or `false` (default `false`) to **culsterMarkers** to enable marker clusters on your map. | ||
@@ -95,0 +96,0 @@ ```javascript |
11856
4.72%194
6.59%128
0.79%