Skip to Main Content
Leaflet.js Essentials
book

Leaflet.js Essentials

by Paul Crickard III
August 2014
Intermediate to advanced content levelIntermediate to advanced
180 pages
3h 41m
English
Packt Publishing
Content preview from Leaflet.js Essentials

Groups of layers

MultiPolyline and MultiPolygon layers allow you to combine multiple polylines and polygons. If you want to create group layers of different types, such as a marker layer with a circle, you can use a layer group or a feature group.

The layer group

A layer group allows you to add multiple layers of different types to the map and manage them as a single layer. To use a layer group, you will need to define several layers:

var marker=L.marker([35.10418, -106.62987]).bindPopup("I am a Marker");
var marker2=L.marker([35.02381, -106.63811]).bindPopup("I am Marker 2");
var polyline=L.polyline([[35.10418, -106.62987],[35.19738, -106.875],[35.07946, -106.80634]], {color: 'red',weight:8}).bindPopup("I am a Polyline");

The preceding code creates ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

GeoServer Beginner's Guide - Second Edition

GeoServer Beginner's Guide - Second Edition

Stefano Iacovella
React Cookbook

React Cookbook

David Griffiths, Dawn Griffiths
Stop Guessing

Stop Guessing

Nat Greene

Publisher Resources

ISBN: 9781783554812Supplemental Content