hilly


Namehilly JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://gitlab.com/ryanmcginger/hilly
SummaryTools for summarizing and viewing sporty GPX traces
upload_time2023-05-06 21:24:47
maintainer
docs_urlNone
authorRyan
requires_python>=3.10,<3.11
license
keywords gpx maps outdoors
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<p align="center">
  <img src="docs/img/hilly-icon_sm.png" />
</p>


# Hilly

Tools for summarizing and viewing sporty GPX traces

## Install

```bash
pip install hilly
```

## Dev Install

```
git clone
cd hilly
poetry install
```

## Features

  * Traces are loaded as GeoDataFrames (convenient exploring and editing)
  * Rasterize traces to see popular routes/trails.
  * Label/Filter Skiing Trace to label/exclude chair-lifts.
  * Summary for Skiing day

## Usage

Import a trace:

```python
import hilly

df = hilly.io.load_trace("path/to/trace.gpx")
```

If it is a ski/snowboarding trace, apply filters to identify runs/lifts:

```python
ski_df = hilly.ski.apply_filters(df)
ski_df.labels_str.unique().tolist()
# ['', 'lift-1', 'run-1', 'run-2', 'lift-2', 'run-3', 'lift-3', 'run-4']
```

The `labels_str` column labels points in the trace as belonging to a lift ride or run, otherwise it is empty. The number indicates a count of lift/runs.

From there you can get a summary for the trace (assuming it is over a single day):

```python
summary = hilly.ski.summary(ski_df)
#🏂 Ski Stats ⛷
#    runs: 4
#    Total Dist(km): 4.815023209198009
#    Longest Run(km): 1.409849302232853
#    Total time: 0 days 00:17:32
#    Total lift time: 0 days 00:36:55.990000
#    Time Ratio: 0.4747313841668961
```

Or, you can view the trace:

```python
# open leaflet map showing points, dropping datetime column for proper JSON
m = ski_df.drop(columns=["time"]).explore("labels", cmap="coolwarm_r")
m.show_in_browser()
```
![ski-point-map](docs/img/ski-point-map.png)

or rasterize the trace to get a density map:
```python
arr, bounds = hilly.utils.rasterize(ski_df, runs_only=True, res=1)
m = hilly.io.map_raster(arr, bounds)
m.show_in_browser()
```
![ski-raster-map](docs/img/ski-raster-map.png)

# Collecting Traces

There are many apps available for collecting traces. I use [OpenTracks](https://opentracksapp.com/) and follow the Export instructions from the settings menu.

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/ryanmcginger/hilly",
    "name": "hilly",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<3.11",
    "maintainer_email": "",
    "keywords": "gpx,maps,outdoors",
    "author": "Ryan",
    "author_email": "code+git@mcginger.net",
    "download_url": "https://files.pythonhosted.org/packages/ea/9b/34a1660f1ab8aead1ce4b06ecd803685a1eb76562c6dc7952daea334b071/hilly-0.1.3.tar.gz",
    "platform": null,
    "description": "\n<p align=\"center\">\n  <img src=\"docs/img/hilly-icon_sm.png\" />\n</p>\n\n\n# Hilly\n\nTools for summarizing and viewing sporty GPX traces\n\n## Install\n\n```bash\npip install hilly\n```\n\n## Dev Install\n\n```\ngit clone\ncd hilly\npoetry install\n```\n\n## Features\n\n  * Traces are loaded as GeoDataFrames (convenient exploring and editing)\n  * Rasterize traces to see popular routes/trails.\n  * Label/Filter Skiing Trace to label/exclude chair-lifts.\n  * Summary for Skiing day\n\n## Usage\n\nImport a trace:\n\n```python\nimport hilly\n\ndf = hilly.io.load_trace(\"path/to/trace.gpx\")\n```\n\nIf it is a ski/snowboarding trace, apply filters to identify runs/lifts:\n\n```python\nski_df = hilly.ski.apply_filters(df)\nski_df.labels_str.unique().tolist()\n# ['', 'lift-1', 'run-1', 'run-2', 'lift-2', 'run-3', 'lift-3', 'run-4']\n```\n\nThe `labels_str` column labels points in the trace as belonging to a lift ride or run, otherwise it is empty. The number indicates a count of lift/runs.\n\nFrom there you can get a summary for the trace (assuming it is over a single day):\n\n```python\nsummary = hilly.ski.summary(ski_df)\n#\ud83c\udfc2 Ski Stats \u26f7\n#    runs: 4\n#    Total Dist(km): 4.815023209198009\n#    Longest Run(km): 1.409849302232853\n#    Total time: 0 days 00:17:32\n#    Total lift time: 0 days 00:36:55.990000\n#    Time Ratio: 0.4747313841668961\n```\n\nOr, you can view the trace:\n\n```python\n# open leaflet map showing points, dropping datetime column for proper JSON\nm = ski_df.drop(columns=[\"time\"]).explore(\"labels\", cmap=\"coolwarm_r\")\nm.show_in_browser()\n```\n![ski-point-map](docs/img/ski-point-map.png)\n\nor rasterize the trace to get a density map:\n```python\narr, bounds = hilly.utils.rasterize(ski_df, runs_only=True, res=1)\nm = hilly.io.map_raster(arr, bounds)\nm.show_in_browser()\n```\n![ski-raster-map](docs/img/ski-raster-map.png)\n\n# Collecting Traces\n\nThere are many apps available for collecting traces. I use [OpenTracks](https://opentracksapp.com/) and follow the Export instructions from the settings menu.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Tools for summarizing and viewing sporty GPX traces",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://gitlab.com/ryanmcginger/hilly",
        "Repository": "https://gitlab.com/ryanmcginger/hilly"
    },
    "split_keywords": [
        "gpx",
        "maps",
        "outdoors"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e74a07ee48ab69f83c1493ae2cb8dae98cb87626e9bb52dafe859aec94114919",
                "md5": "c9f9381c6d56ce832a47dbed433de070",
                "sha256": "ef2bb0ed69efde40819daf8432b759958e47342a193a7239ce8379511dd79ccb"
            },
            "downloads": -1,
            "filename": "hilly-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c9f9381c6d56ce832a47dbed433de070",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<3.11",
            "size": 8900,
            "upload_time": "2023-05-06T21:24:45",
            "upload_time_iso_8601": "2023-05-06T21:24:45.501018Z",
            "url": "https://files.pythonhosted.org/packages/e7/4a/07ee48ab69f83c1493ae2cb8dae98cb87626e9bb52dafe859aec94114919/hilly-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea9b34a1660f1ab8aead1ce4b06ecd803685a1eb76562c6dc7952daea334b071",
                "md5": "e3ff343c7254f6e029e7b3c2b0f99bba",
                "sha256": "4c0d9284aad1f80e608e20a8c0b24ddcfdf878baf77a438a9c0e41e0da57e112"
            },
            "downloads": -1,
            "filename": "hilly-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "e3ff343c7254f6e029e7b3c2b0f99bba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<3.11",
            "size": 7536,
            "upload_time": "2023-05-06T21:24:47",
            "upload_time_iso_8601": "2023-05-06T21:24:47.340827Z",
            "url": "https://files.pythonhosted.org/packages/ea/9b/34a1660f1ab8aead1ce4b06ecd803685a1eb76562c6dc7952daea334b071/hilly-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-06 21:24:47",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "ryanmcginger",
    "gitlab_project": "hilly",
    "lcname": "hilly"
}
        
Elapsed time: 0.89515s