Improve map
This commit is contained in:
parent
ced6b16140
commit
a2e4c29839
10 changed files with 285 additions and 111 deletions
|
|
@ -9,7 +9,7 @@ AGGREGATES_DIR = PROCESSED_DIR / "aggregates"
|
|||
|
||||
# H3 resolutions to generate and serve
|
||||
# https://h3geo.org/docs/core-library/restable/#average-area-in-m2
|
||||
H3_RESOLUTIONS = [6, 7, 8, 9, 10, 11, 12]
|
||||
H3_RESOLUTIONS = [6, 7, 8, 9, 10, 11]
|
||||
DEFAULT_H3_RESOLUTION = 8
|
||||
|
||||
# Year filters
|
||||
|
|
@ -20,4 +20,4 @@ DEFAULT_MAX_YEAR = 2024
|
|||
|
||||
# Price filters
|
||||
DEFAULT_MIN_PRICE = 0
|
||||
DEFAULT_MAX_PRICE = 2_000_000
|
||||
DEFAULT_MAX_PRICE = 100_000_000
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
"""Pipeline CLI to process property data with H3 spatial indexing."""
|
||||
|
||||
from pathlib import Path
|
||||
import polars as pl
|
||||
from tqdm import tqdm
|
||||
|
||||
from pipeline.sources.postcodes import save_postcodes, DATA_DIR
|
||||
from pipeline.sources.postcodes import save_postcodes
|
||||
from pipeline.sources.property_prices import PropertyPricesSource
|
||||
from pipeline.processors.h3_aggregator import save_aggregates
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ def process_postcodes() -> pl.LazyFrame:
|
|||
df = df.with_columns(
|
||||
pl.struct(["lat", "long"])
|
||||
.map_elements(
|
||||
lambda x: lat_long_to_h3(x["lat"], x["long"], res),
|
||||
# Capture res by value using default argument to avoid closure bug
|
||||
lambda x, res=res: lat_long_to_h3(x["lat"], x["long"], res),
|
||||
return_dtype=pl.Utf8,
|
||||
)
|
||||
.alias(col_name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue