Skip to content

Commit

Permalink
Add example (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Aug 8, 2024
1 parent 5f0231b commit 68672d7
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 19,814 deletions.
49 changes: 42 additions & 7 deletions route_choice_local/README.qmd → aequilibrae.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
format: html
---

The starting point is the following [example](https://github.com/AequilibraE/aequilibrae/blob/develop/docs/source/examples/assignment_workflows/plot_route_choice.py) (rendered on their [website](https://aequilibrae.com/python/latest/_auto_examples/assignment_workflows/plot_route_choice_set.html#sphx-glr-auto-examples-assignment-workflows-plot-route-choice-set-py)) from the Aequillibrae documentation:

```{r}
#| include: false
ls()
```
The starting point was the following [example](https://github.com/AequilibraE/aequilibrae/blob/develop/docs/source/examples/assignment_workflows/plot_route_choice.py) (rendered on their [website](https://aequilibrae.com/python/latest/_auto_examples/assignment_workflows/plot_route_choice_set.html#sphx-glr-auto-examples-assignment-workflows-plot-route-choice-set-py)) from the Aequillibrae documentation:

<details>

Expand Down Expand Up @@ -261,4 +256,44 @@ od_matrix.to_scipy().toarray()
project.close()
```

</details>
</details>

You can also use aequilibrae to do basic routing, as shown in the [`plot_assignment_without_model` example](https://aequilibrae.com/python/latest/_auto_examples/aequilibrae_without_a_model/plot_assignment_without_model.html).


```{python}
# Imports
import os
import pandas as pd
import numpy as np
from tempfile import gettempdir
from aequilibrae.matrix import AequilibraeMatrix
from aequilibrae.paths import Graph
from aequilibrae.paths import TrafficAssignment
from aequilibrae.paths.traffic_class import TrafficClass
```

```{python}
# Create a project for Leeds
from aequilibrae.project import Project
```

```{python}
p = Project()
```

```{python}
#| eval: false
p.new('leeds_project')
```


```{python}
p.open('leeds_project')
import geopandas as gpd
zones = gpd.read_file('input_data/zones_msoa_leeds.geojson')
# p.network.create_from_osm(model_area = zones, modes = ['car'])
# Fails with
p.network.create_from_osm(place_name = 'Leeds, UK')
```
Loading

0 comments on commit 68672d7

Please sign in to comment.