Skip to content

Adds zoomToGeometries to L.map to create fit bounds made out of a geojson object

Notifications You must be signed in to change notification settings

GetDKAN/leaflet.map.zoomToGeometries.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adds a zoomToGeometries method to L.map

Demo

http://nucivic.github.io/leaflet.map.zoomToGeometries.js/

Usage

var div = $('#map');
var map = new L.map(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);

About

Adds zoomToGeometries to L.map to create fit bounds made out of a geojson object

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published