adjusting the drawn object in map automatically using leaflet 'Geojson' property 'getbound'

天大地大妈咪最大 提交于 2020-01-15 12:18:30

问题


I am using leaflet in my project for displaying objects and elements in map (Open source map). I have drawn some objects in my map using Geojson styles While using Geojson with the leaflet js implementation I am not able to use getBounds option properties.

But normally if I am not using Geojson and its features I am able to use this option getBounds mentioned below.

var group = new L.featureGroup([marker, circle, polygon, rectangle]);
//alert(group);
map.fitBounds(group.getBounds());

My set view code:

var map = L.map('map').setView([39.75621, -104.99404], 13);

Whenever a page loaded it should find the objects and draw elements (trace components) and adjust its Zooming.

Jsfiddle

来源:https://stackoverflow.com/questions/23380886/adjusting-the-drawn-object-in-map-automatically-using-leaflet-geojson-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!