Creating choropleth maps with a variety of classification schemes
Uncomment the following line to install leafmap if needed.
In [1]:
Copied!
# %pip install "leafmap[maplibre]"
# %pip install "leafmap[maplibre]"
In [2]:
Copied!
import leafmap.maplibregl as leafmap
import leafmap.maplibregl as leafmap
In [3]:
Copied!
data = "https://github.com/opengeos/datasets/releases/download/vector/countries.geojson"
data = "https://github.com/opengeos/datasets/releases/download/vector/countries.geojson"
Available classification schemes:
- BoxPlot
- EqualInterval
- FisherJenks
- FisherJenksSampled
- HeadTailBreaks
- JenksCaspall
- JenksCaspallForced
- JenksCaspallSampled
- MaxP
- MaximumBreaks
- NaturalBreaks
- Quantiles
- Percentiles
- StdMean
- UserDefined
In [4]:
Copied!
m = leafmap.Map(style="liberty")
first_symbol_id = m.find_first_symbol_layer()["id"]
m.add_data(
data,
column="POP_EST",
scheme="Quantiles",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
extrude=True,
scale_factor=1000,
)
m.add_layer_control()
m
m = leafmap.Map(style="liberty")
first_symbol_id = m.find_first_symbol_layer()["id"]
m.add_data(
data,
column="POP_EST",
scheme="Quantiles",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
extrude=True,
scale_factor=1000,
)
m.add_layer_control()
m
In [5]:
Copied!
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="Quantiles",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="Quantiles",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
In [ ]:
Copied!
In [6]:
Copied!
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="EqualInterval",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="EqualInterval",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
In [7]:
Copied!
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="FisherJenks",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="FisherJenks",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
In [8]:
Copied!
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="FisherJenks",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="FisherJenks",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
In [9]:
Copied!
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="JenksCaspall",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m
m = leafmap.Map(style="liberty")
m.add_data(
data,
column="POP_EST",
scheme="JenksCaspall",
cmap="Blues",
legend_title="Population",
name="Population",
before_id=first_symbol_id,
)
m.add_layer_control()
m