Skip to main content
# drogi

## What is this thing?

What I'm aiming to accomplish here is building a tool for analyzing city maps in terms of walkability, driveability, bikeability and so on. Its intended ultimate purpose is generating large amounts of data, as well as creating a simple way to visualize infrastructure trouble spots in a given area.

All in the spirit of new urbanism, urban renaissance, sustainability and reducing car dependency, concepts about which you can read in other places on the web, should you feel so inclined.

## How is it supposed to work?

#### Getting the data

Thankfully this part is pretty straightforward. At [GeoFabrik GmbH's site](https://download.geofabrik.de/) we can get OpenStreetMap .osm data as convenient extracts. But for the purposes of this readme we won't, at least not yet. Instead I manually grabbed an extract of my neighbourhood, it's smaller and in a sense means I get more intimate domain knowledge of what I'm looking at.

#### Processing the data

As I mentioned I intend to use this thing to generate data. For that reason I have decided to design it around a concept of a **WorkRun** which will consist of fetching the data, piece by piece, gluing it together to make a city-sized graph and walking it repeatedly. The patterns that emerge from all the walked paths can then be used to infer deductions.
The WorkRun class is used in the following way:
```python
import drogi
new_run = drogi.WorkRun(osm_file="sample_osm", num_of_trips=10)
```
What's happening inside is the walkable ways from the .osm map get converted into `shapely.LineString` objects and then a graph, represented as a dictionary, is built from those. The representation is pretty standard for Python, the following graph:

![graph example](img/graph.png)

Becomes:
```python
{'A': ['B', 'C'],
'B': ['A', 'C', 'D'],
'C': ['A', 'B', 'D', 'E'],
'D': ['B', 'C'],
'E': ['C']}
```
Only instead of strings we're using two-tuples of `(latitude, longitude)`.

#### Finding paths

We then pick two points, randomly for the time being, and using the [networkx](https://github.com/networkx)'s module A\* algorithm find the shortest path between them. It's proved fast enough for the inputs I've been playing with, especially compared to the previous implementation, which was a simple `numpy.ndarray` of ones and zeros, also traversed using A\*.
The paths are saved as `Path` objects and among other things, can be used to render a picture like this:

![rendered paths](img/255_overlaid.png)

To be perfectly honest this is from a previous version and it's using legacy functions that I've since deleted, but it looks pretty so I'm keeping it ;)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drogi-0.0.13.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drogi-0.0.13-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file drogi-0.0.13.tar.gz.

File metadata

  • Download URL: drogi-0.0.13.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for drogi-0.0.13.tar.gz
Algorithm Hash digest
SHA256 2c8daba5a6a111235716b15217eb696cda1291c37894aa77d973410e2d382b08
MD5 9d4bf3f9459a4a4c564ac59adc0ea882
BLAKE2b-256 9987b1864427f81b1c111838bbf9127095836399aaf85bcbfd9cc4ea3e4a9205

See more details on using hashes here.

File details

Details for the file drogi-0.0.13-py3-none-any.whl.

File metadata

  • Download URL: drogi-0.0.13-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.5

File hashes

Hashes for drogi-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 8a86f9393cf2f36ff288f31f815ab36a61d7a65d1580240b9590fab414282a5a
MD5 2820b799444393a7fc4d124effc6d2a6
BLAKE2b-256 eb6ccccfa1f68a506e8550f3a506d26c467e5dcc30d07de7637831fefdd26c37

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.15

2 files

0.0.14

1 file

This release

0.0.13 This release

2 files

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page