Skip to content

Conversation

@nreinicke
Copy link
Collaborator

Updates the internal RTree to be the SRTree from shapely rather than using the rtree package. This allows us to pickle and unpickle the matcher without corrupting the index.

Also adds support for the pixi build tool.

@nreinicke nreinicke requested a review from jhoshiko as a code owner November 14, 2025 22:22
@nreinicke
Copy link
Collaborator Author

And this drops python 3.9 support and adds python 3.13 support

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the rtree package dependency with Shapely's built-in STRtree to enable proper pickling/unpickling of matcher objects. It also adds pixi build tool support and updates Python version support (dropping 3.9, adding 3.13).

Key changes:

  • Switched from rtree.index.Index to shapely.strtree.STRtree for spatial indexing
  • Removed rtree dependency from pyproject.toml
  • Added version constraints to all dependencies
  • Configured pixi as an alternative build tool

Reviewed Changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pyproject.toml Removed rtree dependency, added version constraints, added pixi configuration, updated Python version support
mappymatch/maps/nx/nx_map.py Replaced rtree with STRtree, updated nearest_road implementation
mappymatch/maps/igraph/igraph_map.py Replaced rtree with STRtree, updated _nearest_edge_index implementation
mappymatch/matchers/lcss/lcss.py Removed unused match_trace_batch method that had rtree serialization issues
.github/workflows/*.yml Updated Python version matrix to 3.10-3.13
environment*.yml Deleted conda environment files (replaced by pixi)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nreinicke
Copy link
Collaborator Author

This also introduces an optional parameter "additional_metadata_keys" into the NxMap.from_geofence method that will allow users to pass in additional keys they want to persist through the matching. For example, they could pass additional_metadata_keys=["highway"] and those OSM values would show up in the final match result.

@nreinicke
Copy link
Collaborator Author

@jhoshiko - this should be ready for your review!

Copy link
Collaborator

@jhoshiko jhoshiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, All of the changes looks good to me. I pulled the branch and ran all of the unit tests which are all passing and also put together a quick notebook to test the branch which also went flawlessly (all testing was python=3.13).

I also noticed your note about the memory usage while building the tree and I will also keep an eye out for memory issues in the future, but I think we can merge this in! Thanks for putting this together.

@nreinicke nreinicke merged commit 820a7bb into main Nov 17, 2025
4 checks passed
@nreinicke nreinicke deleted the ndr/use-srtree branch November 17, 2025 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants