Skip to content

Additional extension fields and option to extract CSV - #8

Open
yushiyangk wants to merge 17 commits into
francescocaponio:mainfrom
yushiyangk:extensions-csv
Open

Additional extension fields and option to extract CSV#8
yushiyangk wants to merge 17 commits into
francescocaponio:mainfrom
yushiyangk:extensions-csv

Conversation

@yushiyangk

@yushiyangk yushiyangk commented Jul 7, 2026

Copy link
Copy Markdown

Hi, thanks for this very useful project. I have implemented some additional features for my own use, that I hope you would consider incorporating upstream.

Summary of changes:

  1. Added names for some of the protobuf fields that were previously labelled as 'unknown', and included them in the extracted gps_data
  2. Expose extract_extensions to the CLI with a new option --additional
  3. Added an option require_gps=True, which when set to False allows points to be extracted even when GPS data is missing
  4. Added a method OsmoGps.save_csv() and CLI command extract-csv in addition to gpx

Do let me know if you have any thoughts, thank you!

Backwards compatibility

There should be no breaking changes.

The added parameters (require_gps) and added CLI options default to their previous behaviour.

Details

For (3), save_gpx() and resample() both will raise warnings if require_gps was set to False (defaults to True). When True, any data points that do not have GPS information will raise a warning, similar to prior behaviour.

Also, resample() will automatically discard any data points without GPS information if resampling_method is not none, because it's not clear to me how such data points should be treated otherwise.

For (4), I moved some of the duplicated logic between save_gpx and save_csv into their own functions. Output formatting is now done in _render_point(). I also made main.py:extract() take save_method as an argument.

Avoid a second pass for copying out the gpx data into separate lists. Using a single pass also potentially gives better spatial locality (though probably negligible in Python).
A warning will be raised if there is missing GPS data when `require_gps` is not explicitly set to False.

`save_gpx` will raise warnings if data was extracted with `require_gps` set to False, and also when there are missing GPS data points. `resample` will similarly raise warnings, and non-GPS data points will be discarded, unless resampling method is set to 'none'.
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.

1 participant