This package transforms on-street points to block-wise linestrings. The constructed linestrings are parallel to the curvature of the road they lay on. To satisfy this condition, a road network is queried from OpenStreetMap. Points are grouped per street-block (separating left and right side of the block) by solving the travelling salesman problem.
In both examples, on-street parking meter data was obtained from open government data. The parking meters are transformed to linestrings, which can be further used in GIS and mapping applications.
Original points (red) and generated lines (yellow) in Vancouver, Canada. | Original points (red) and generated lines (yellow) in San Francisco, USA. |
To get a local copy simply clone this repository: git clone https://github.com/mhubrich/linestringnize.git
To run the package, simply execute python linestringnize.py
in the command line with the following (optional) arguments:
--input
: path to the input file--output
: path to the output file--id
: name of the feature ID property--max_distance
: maximum distance between two points to be connected by a line--min_length
: minimum length of a line--clipping
: minimum buffer in meter between line start/end and intersection--stats
: if true, output file contains statistics on the aggregations
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some amazing feature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE
file for details.
Shout-out to @dmishin for providing the tsp-solver package, a sub-optimal travelling salesman problem (TSP) solver.