WP Manifestindependent plugin directory
manifest / integrations / choropleth-leaflet-map

Choropleth for Leaflet Map

WordPress Plugin: Choropleth for Leaflet Map

by hupe13 · github.com/hupe13/choropleth-leaflet-map · website

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/hupe13/choropleth-leaflet-map/archive/refs/heads/main.zip

Description

Code for using the Choropleth plugin for Leaflet (color scale based on value) in WordPress: https://github.com/timwis/leaflet-choropleth.

XSS and why excluded

While fixing a XSS vulnerability in this shortcode, I discovered a bug that has been there for at least two years. For that reason, and since no one has complained, I decided to remove that part from Extensions for Leaflet Map.

This plugin needs Extensions for Leaflet Map version > 5.4 or its Github version > 5.4-260808.

Shortcode

The shortcode has changed!! Do not forget hoverlap, if you want get a tooltip on mouse over.

[leaflet-map fitbounds ....]
[leaflet-geojson src=https://domain.tld/path/to/file.geojson]Property1 {property1}<br>{property2} Property2[/leaflet-geojson]
[choropleth valueProperty="property1" scale="white, red" steps=5 mode=e legend fillopacity=0.8]
[hoverlap]
[zoomhomemap]

Popup Content

Specify the popup content in leaflet-geojson shortcode: To add feature properties to the popups, use the inner content and curly brackets to substitute the values:

You can specify Property1 {property1}<br>{property2} Property2 as you like.

[leaflet-geojson ...]Field A = {field_a}[/leaflet-geojson]

Options

OptionDefaultDescriptionExample
valuepropertywhich property in the features to useproperty
scalewhite, reda comma separated list of colors for scale - include as many as you like"white, red, blue"
fillopacity0.8opacity of the colors in scale0.8
steps5number of breaks or steps in range5
modeqq for quantile, e for equidistant, k for k-meansq
legend1show legend!legend

mode

  • quantile maps try to arrange groups so they have the same quantity.
  • equidistant: divide the classes into equal groups.
  • k-means: each standard deviation becomes a class.

Installation

Example

How to include Leaflet plugin Leaflet Choropleth