You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by ji...@apache.org on 2026/07/26 06:37:48 UTC
(sedona-spatialbench) branch main updated: Correct the region Q3 describes (#132)
This is an automated email from the ASF dual-hosted git repository.
jiayuasu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sedona-spatialbench.git
The following commit(s) were added to refs/heads/main by this push:
new 68fbe5d Correct the region Q3 describes (#132)
68fbe5d is described below
commit 68fbe5d648f58b7f1ef3895cbb7a15e87d3097e4
Author: Jia Yu <ji...@apache.org>
AuthorDate: Sat Jul 25 23:37:43 2026 -0700
Correct the region Q3 describes (#132)
Q3 filters trips against this ring:
POLYGON((-111.9060 34.7347, -111.6160 34.7347, -111.6160 35.0047,
-111.9060 35.0047, -111.9060 34.7347))
which is described everywhere as a "10km bounding box" giving a "15km radius"
once the 0.045 degree buffer is added. Neither figure is right. The ring spans
0.290 degrees of longitude by 0.270 of latitude, and at its center latitude
(34.8697 N) that is about 26.5 km east-west by 30 km north-south -- roughly 13
and 15 km from the center along each axis, with the corners about 20 km out, or
25 km once the buffer is added. The "10km box" label understates the region by
about 3x.
Only comments and prose change; the polygon literal, the thresholds and the
result sets are untouched, so the committed answers still apply.
Updated in the SQL source of truth (print_queries.py), the three dataframe
implementations that repeat the claim in their docstrings, the notebook, and the
rendered docs in both languages. The buffer's existing "~5km" annotation for
0.045 degrees is left alone: it is accurate in latitude and follows the same
degree-to-kilometre convention the rest of the geometry suite uses.
---
docs/queries.md | 4 ++--
docs/queries.zh.md | 4 ++--
notebooks/queries.ipynb | 4 ++--
spatialbench-queries/geopandas_queries.py | 4 ++--
spatialbench-queries/print_queries.py | 4 ++--
spatialbench-queries/pycanopy_queries.py | 2 +-
spatialbench-queries/spatial_polars.py | 4 ++--
7 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/docs/queries.md b/docs/queries.md
index 4312dfd..5c4284a 100644
--- a/docs/queries.md
+++ b/docs/queries.md
@@ -148,11 +148,11 @@ WHERE ST_Intersects(
└───────────────────────────────┘
-## Q3: Monthly trip statistics within a 15km radius of the Sedona city center
+## Q3: Monthly trip statistics for a buffered box around the Sedona city center
**Real-life scenario:** Track monthly travel trends and performance metrics in a metropolitan area with seasonal analysis.
-This query analyzes taxi and rideshare trip patterns around Sedona, Arizona, by grouping trips into monthly summaries. It looks at all trips that started within a 15-kilometer area around Sedona (a 10km box plus 5km buffer) and calculates key statistics for each month, including total number of trips, average trip distance, average trip duration, and average fare. The results are organized chronologically by month, allowing you to see seasonal trends and changes in ride patterns over tim [...]
+This query analyzes taxi and rideshare trip patterns around Sedona, Arizona, by grouping trips into monthly summaries. It looks at all trips that started within a box around Sedona — roughly 26.5 km east-west by 30 km north-south, with corners about 20 km from the center — plus a further ~5 km buffer, and calculates key statistics for each month, including total number of trips, average trip distance, average trip duration, and average fare. The results are organized chronologically by m [...]
**Spatial query characteristics tested:**
diff --git a/docs/queries.zh.md b/docs/queries.zh.md
index 88bd5a8..bb1b299 100644
--- a/docs/queries.zh.md
+++ b/docs/queries.zh.md
@@ -148,11 +148,11 @@ WHERE ST_Intersects(
└───────────────────────────────┘
-## Q3:Sedona 市中心 15 公里半径内的月度行程统计
+## Q3:Sedona 市中心周边带缓冲区方框内的月度行程统计
**真实场景:** 跟踪都市区的月度出行趋势和性能指标,并进行季节性分析。
-该查询通过将行程按月度汇总,分析 Sedona 周边的出租车和网约车行程模式。它会查看所有在 Sedona 周边 15 公里范围内(即 10km 的边界框加上 5km 的缓冲区)起始的行程,并为每个月份计算关键统计量,包括总行程数、平均行驶距离、平均行程时长以及平均车费。结果按月份按时间顺序排列,让你可以观察到 Sedona 地区出行模式的季节性变化趋势。
+该查询通过将行程按月度汇总,分析 Sedona 周边的出租车和网约车行程模式。它会查看所有在 Sedona 周边一个方框内起始的行程——该方框东西向约 26.5 公里、南北向约 30 公里,四角距中心约 20 公里——再加上约 5 公里的缓冲区,并为每个月份计算关键统计量,包括总行程数、平均行驶距离、平均行程时长以及平均车费。结果按月份按时间顺序排列,让你可以观察到 Sedona 地区出行模式的季节性变化趋势。
**被测试的空间查询特性:**
diff --git a/notebooks/queries.ipynb b/notebooks/queries.ipynb
index adf289d..ff7a031 100644
--- a/notebooks/queries.ipynb
+++ b/notebooks/queries.ipynb
@@ -225,11 +225,11 @@
"id": "998daae7-31e4-4e93-823d-70d4cee00605",
"metadata": {},
"source": [
- "## Q3: Monthly trip statistics within a 15km radius of the Sedona city center\n",
+ "## Q3: Monthly trip statistics for a buffered box around the Sedona city center\n",
"\n",
"**Real-life scenario:** Track monthly travel trends and performance metrics in a metropolitan area with seasonal analysis.\n",
"\n",
- "This query analyzes taxi and rideshare trip patterns around Sedona, Arizona, by grouping trips into monthly summaries. It looks at all trips that started within a 15-kilometer area around Sedona (a 10km box plus 5km buffer) and calculates key statistics for each month, including total number of trips, average trip distance, average trip duration, and average fare. The results are organized chronologically by month, allowing you to see seasonal trends and changes in ride patterns ove [...]
+ "This query analyzes taxi and rideshare trip patterns around Sedona, Arizona, by grouping trips into monthly summaries. It looks at all trips that started within a box around Sedona — roughly 26.5 km east-west by 30 km north-south, with corners about 20 km from the center — plus a further ~5 km buffer, and calculates key statistics for each month, including total number of trips, average trip distance, average trip duration, and average fare. The results are organized chronologically [...]
"\n",
"**Spatial query characteristics tested:**\n",
"\n",
diff --git a/spatialbench-queries/geopandas_queries.py b/spatialbench-queries/geopandas_queries.py
index ee36525..55e9efd 100644
--- a/spatialbench-queries/geopandas_queries.py
+++ b/spatialbench-queries/geopandas_queries.py
@@ -78,9 +78,9 @@ def q2(data_paths: dict[str, str]) -> DataFrame: # type: ignore[override]
def q3(data_paths: dict[str, str]) -> DataFrame: # type: ignore[override]
- """Q3 (GeoPandas): Monthly trip stats within 15km (10km box + 5km buffer) of Sedona center.
+ """Q3 (GeoPandas): Monthly trip stats for a buffered box around Sedona center.
- Implements: filter trips whose pickup location is within 0.045 degrees (~5km) of the 10km bounding
+ Implements: filter trips whose pickup location is within 0.045 degrees (~5km) of the ~26.5x30 km bounding
box polygon (approximating ST_DWithin(pickup_point, polygon, 0.045)). Then aggregates monthly:
* total_trips = COUNT(t_tripkey)
* avg_distance = AVG(t_distance) (set NaN if column absent)
diff --git a/spatialbench-queries/print_queries.py b/spatialbench-queries/print_queries.py
index c9cc29e..cb6d206 100755
--- a/spatialbench-queries/print_queries.py
+++ b/spatialbench-queries/print_queries.py
@@ -86,7 +86,7 @@ WHERE ST_Intersects(ST_GeomFromWKB(t.t_pickuploc), (SELECT ST_GeomFromWKB(z.z_bo
@staticmethod
def q3() -> str:
return """
--- Q3: Monthly trip statistics within 15km radius of Sedona city center (10km base + 5km buffer)
+-- Q3: Monthly trip statistics for a buffered box around Sedona city center
SELECT
DATE_TRUNC('month', t.t_pickuptime) AS pickup_month, COUNT(t.t_tripkey) AS total_trips,
AVG(t.t_distance) AS avg_distance, AVG(t.t_dropofftime - t.t_pickuptime) AS avg_duration,
@@ -94,7 +94,7 @@ SELECT
FROM trip t
WHERE ST_DWithin(
ST_GeomFromWKB(t.t_pickuploc),
- ST_GeomFromText('POLYGON((-111.9060 34.7347, -111.6160 34.7347, -111.6160 35.0047, -111.9060 35.0047, -111.9060 34.7347))'), -- 10km bounding box around Sedona
+ ST_GeomFromText('POLYGON((-111.9060 34.7347, -111.6160 34.7347, -111.6160 35.0047, -111.9060 35.0047, -111.9060 34.7347))'), -- ~26.5 km E-W by ~30 km N-S box around Sedona; corners ~20 km out
0.045 -- Additional 5km buffer
)
GROUP BY pickup_month
diff --git a/spatialbench-queries/pycanopy_queries.py b/spatialbench-queries/pycanopy_queries.py
index 53e5472..04d1120 100644
--- a/spatialbench-queries/pycanopy_queries.py
+++ b/spatialbench-queries/pycanopy_queries.py
@@ -63,7 +63,7 @@ def q2(data_paths: dict[str, str]) -> pl.DataFrame:
def q3(data_paths: dict[str, str]) -> pl.DataFrame:
- """Q3 (PyCanopy): Monthly trip stats within ~5km of a 10km bounding box around Sedona."""
+ """Q3 (PyCanopy): Monthly trip stats within ~5km of a ~26.5x30 km box around Sedona."""
distance = 0.045 # degrees (~5km)
base_poly = shapely.Polygon(
[
diff --git a/spatialbench-queries/spatial_polars.py b/spatialbench-queries/spatial_polars.py
index 6c22e27..b5d4a84 100644
--- a/spatialbench-queries/spatial_polars.py
+++ b/spatialbench-queries/spatial_polars.py
@@ -94,9 +94,9 @@ def q2(data_paths: dict[str, str]) -> DataFrame:
def q3(data_paths: dict[str, str]) -> DataFrame:
- """Q3 (Spatial Polars): Monthly trip stats within 15km (10km box + 5km buffer) of Sedona center.
+ """Q3 (Spatial Polars): Monthly trip stats for a buffered box around Sedona center.
- Implements: filter trips whose pickup location is within 0.045 degrees (~5km) of the 10km bounding
+ Implements: filter trips whose pickup location is within 0.045 degrees (~5km) of the ~26.5x30 km bounding
box polygon (approximating ST_DWithin(pickup_point, polygon, 0.045)). Then aggregates monthly:
* total_trips = COUNT(t_tripkey)
* avg_distance = AVG(t_distance) (set NaN if column absent)