Skip to content

Exclude (0, 0) coordinates from GBFS bounding box computation - #1893

Draft
jay23606 wants to merge 1 commit into
MobilityData:mainfrom
jay23606:pr-go/1887-incorrect-bounding-box-due-to-bad-statio
Draft

jay23606 wants to merge 1 commit into
MobilityData:mainfrom
jay23606:pr-go/1887-incorrect-bounding-box-due-to-bad-statio

Conversation

@jay23606

Copy link
Copy Markdown

Problem

The bounding box of the BIXI Montréal GBFS system spans from Montreal to Null Island. Its station_information feed contains three stations (304, 724, 747) with location (0, 0). reverse_geolocation_process builds the dataset bounding box from the min/max of all station coordinates, so these placeholder points stretch the box to (0, 0).

Change

In functions-python/reverse_geolocation/src/reverse_geolocation_processor.py, the stop filter that already drops missing coordinates now also drops rows where both stop_lat and stop_lon are 0. Those points are excluded from the bounding box and from reverse geolocation. Obvious outliers other than (0, 0) are not handled here.

Testing

Added test_valid_request_excludes_zero_zero_coordinates in functions-python/reverse_geolocation/tests/test_reverse_geolocation_processor.py. It passes a stop DataFrame with two (0, 0) rows and two valid rows and asserts that update_dataset_bounding_box receives only the two valid rows.

The test was not run in the authoring environment: its Python dependencies (pandas, etc.) are not installed there, so CI is the verification. The Windows Python check python -c "import pandas, shapely, geoalchemy2, flask, sqlalchemy; print('ok')" exited with ModuleNotFoundError: No module named 'pandas'.

Regression test: untested: CONTRIBUTING does not mention tests

Fixes #1887

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

Incorrect bounding box due to bad station coordinates (GBFS)

2 participants