Skip to content

Commit

Permalink
fix: remove geoarrow-rust-core dependency (#151)
Browse files Browse the repository at this point in the history
* fix: remove geoarrow-rust-core dependency

* chore: remove comment
  • Loading branch information
RaczeQ authored Sep 10, 2024
1 parent 05bd663 commit f1426af
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Removed

- `geoarrow-rust-core` from dependencies

## [0.9.2] - 2024-08-28

### Changed
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,14 @@ Required:

- `pyarrow (>=16.0.0)`: For parquet files wrangling

- `geoarrow-pyarrow (>=0.1.2)`: For GeoParquet IO operations
- `geoarrow-pyarrow (>=0.1.2)`: For GeoParquet IO operations and transforming Arrow data to Shapely objects

- `geoarrow-pandas (>=0.1.1)`: For GeoParquet integration with GeoPandas

- `geopandas (>=0.6)`: For returning GeoDataFrames and reading Geo files

- `shapely (>=2.0)`: For parsing WKT and GeoJSON strings and fixing geometries

- `geoarrow-rust-core (>=0.2)`: For transforming Arrow data to Shapely objects

- `polars (>=0.19.4)`: For faster OSM ways grouping operation

- `typeguard (>=3.0)`: For internal validation of types
Expand Down
17 changes: 1 addition & 16 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies = [
"requests",
"polars>=0.19.4",
"rich>=12.0.0",
"geoarrow-rust-core>=0.2.0",
"geopy>=2.0.0",
"numpy>=1.26.0",
]
Expand Down
12 changes: 8 additions & 4 deletions quackosm/_intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from pathlib import Path
from typing import Optional

import geoarrow.pyarrow as ga
import pyarrow as pa
from geoarrow.rust.core import PointArray
from shapely import STRtree
from shapely.geometry.base import BaseGeometry

Expand All @@ -15,11 +15,15 @@ def _intersect_nodes(
table: pa.Table,
geometry_filter: BaseGeometry,
) -> pa.Table: # pragma: no cover
points_array = PointArray.from_xy(
x=table["lon"].combine_chunks(), y=table["lat"].combine_chunks()
points_array = ga.to_geopandas(
ga.point().from_geobuffers(
None,
x=table["lon"].to_numpy(),
y=table["lat"].to_numpy(),
)
)

tree = STRtree(points_array.to_shapely())
tree = STRtree(points_array)

intersecting_ids_array = table["id"].take(tree.query(geometry_filter, predicate="intersects"))

Expand Down
13 changes: 9 additions & 4 deletions tests/base/test_intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from pathlib import Path

import duckdb
import geoarrow.pyarrow as ga
import pyarrow as pa
import pyarrow.parquet as pq
from geoarrow.rust.core import PointArray

from quackosm import geocode_to_geometry
from quackosm._intersection import intersect_nodes_with_geometry
Expand Down Expand Up @@ -38,9 +38,14 @@ def test_nodes_intersection() -> None:
"""
)
nodes_points = pq.ParquetDataset(nodes_destination).read()
points_array = PointArray.from_xy(
x=nodes_points["lon"].combine_chunks(), y=nodes_points["lat"].combine_chunks()
).to_shapely()
points_array = ga.to_geopandas(
ga.point().from_geobuffers(
None,
x=nodes_points["lon"].to_numpy(),
y=nodes_points["lat"].to_numpy(),
)
)

intersecting_points_mask = geom_filter.intersects(points_array)

intersecting_ids_array = (
Expand Down

0 comments on commit f1426af

Please sign in to comment.