Skip to content

Housing prices

image image image

Mapping US Housing Prices by County

Uncomment the following line to install leafmap if needed.

1
# %pip install "leafmap[maplibre]"
1
2
import geopandas as gpd
import leafmap.maplibregl as leafmap
1
geojson = "https://github.com/opengeos/datasets/releases/download/us/zillow_home_value_by_county.geojson"
1
2
gdf = gpd.read_file(geojson)
gdf.head()
1
2
3
column = "2024-10-31"
data = gdf[["RegionName", "State", column, "geometry"]]
data.head()

Available classification schemes: * BoxPlot * EqualInterval * FisherJenks * FisherJenksSampled * HeadTailBreaks * JenksCaspall * JenksCaspallForced * JenksCaspallSampled * MaxP * MaximumBreaks * NaturalBreaks * Quantiles * Percentiles * StdMean * UserDefined

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
m = leafmap.Map(style="liberty", pitch=60)
first_symbol_id = m.find_first_symbol_layer()["id"]
m.add_data(
    data,
    column=column,
    scheme="Quantiles",
    cmap="Blues",
    legend_title="Median Home Value",
    name="Home value",
    before_id=first_symbol_id,
    extrude=True,
    scale_factor=3,
)
m.add_layer_control()
m

image

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
m = leafmap.Map(style="liberty")
m.add_data(
    data,
    column=column,
    scheme="Quantiles",
    cmap="Blues",
    legend_title="Median Home Value",
    name="Home value",
    before_id=first_symbol_id,
)
m.add_layer_control()
m

image