Skip to content

Latest commit

 

History

History
48 lines (44 loc) · 730 Bytes

README.md

File metadata and controls

48 lines (44 loc) · 730 Bytes

Adds a zoomToGeometries method to L.map

Demo

https://teosibileau.github.io/leaflet.map.zoomToGeometries.js/

Usage

var div = $('#map');
var map = new L.GeoJSONBoundedMap(div.get(0));
var geojson = {
  type: "FeatureCollection",
  features: [
  {
  type: "Feature",
  id: "01",
  properties: {
  name: "Alabama",
  density: 94.65
  },
  geometry: {
  type: "Polygon",
  coordinates: [
    [
      [
        -87.359296,
        35.00118
      ],
      [
        -85.606675,
        34.984749
      ],
      [
        -85.431413,
        34.124869
      ],
      [
        -87.359296,
        35.00118
      ]
    ]
  ]
};
var geojson = new L.GeoJSON(geojson);
geojson.addTo(map);
map.zoomToGeometries(geojson);