Repository navigation
Build the points before pickling - #15
Merged
Merged
Conversation
movingpandas 0.22 stopped building points from `x`/`y`: the geometry stays None and is built on demand, inside movingpandas' own methods only. v2.2.0 lifted the 0.17.2 pin, so every pickle it writes carries no locations. Readers touching `trajectory.df.geometry` directly crash - movingpandas < 0.22 in `TrajectoryStopDetector` (Stop Detector, develop) and Apps on any version in their own code (Behavioral Annotation / Segmentation, production). Building the GeoDataFrame here makes the output independent of the writer's movingpandas and restores what 0.17.2 handed over, without `coords_x`/`coords_y`. Trello #1419. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cleemansen
added a commit
that referenced
this pull request
Oct 6, 2026
Brings v2.2.1 (#15, Trello #1419) onto v3: v3.0.0-RC1 locks movingpandas 0.23.0 and wrote the same pickles without locations. transform_to_pickle.py merged cleanly; the dropped-track warning still reads `data`, which keeps `coords_x`/`coords_y`. The test conflict was two additions side by side. `pytz` stays out - v3 removed it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since
move2_loc to MovingPandasv7 (v2.2.0) the next Python App can crash: the pickled trajectories carry no point locations.v2.2.0lifted themovingpandas=0.17.2pin. Since movingpandas 0.22, aTrajectoryCollectionbuilt fromx/ykeeps its geometryNoneand builds it on demand — but only inside movingpandas' own methods. The pickle carries that state. Readers touchingtrajectory.df.geometrydirectly getNone:Stop Detector and Visualizer(movingpandas 0.18.1) →AttributeError: 'NoneType' object has no attribute 'x'inTrajectoryStopDetector._process_traj.Behavioral Annotation / Segmentationv3 (current movingpandas, readstrajectory.dfitself) →has no valid geometry for UTM conversion, twice since 2026-09-30.Not related to gzip — both logs show the pickle read correctly.
Change
create_moving_pandasbuilds theGeoDataFramewithpoints_from_xyitself and hands it to movingpandas withoutx/y. The output no longer depends on the writer's movingpandas version.coords_x/coords_yare dropped, as movingpandas 0.17.2 did (v6). v7 handed them over in addition.Verification
test_it_should_write_trajectories_with_point_locations: red before the fix (3265 of 3265 geometriesNone), green after; swapping x/y fails it.test/Dockerfilewith a fresh resolution (Python 3.14.7, pandas 2.3.3): 11 tests OK.TrajectoryStopDetectorfinds the same 157 stops in both.Follow-up
Tag
v2.2.1after merge, new App version ofmove2_loc to MovingPandas, then bring the fix viamainintov3(feature/port-to-moveapps-package, v8 has the same bug).Trello: https://trello.com/c/O8xHQ571