
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
GitHub | Documentation | Issue Tracker | PyPI
Simple routing over OSM data.
pyroutelib3 is a Python library for simple routing over OpenStreetMap data.
import pyroutelib3
live_graph = pyroutelib3.osm.LiveGraph(pyroutelib3.osm.CarProfile())
start_node = live_graph.find_nearest_node((52.23201, 21.00737))
end_node = live_graph.find_nearest_node((52.24158, 21.02807))
route = pyroutelib3.find_route_without_turn_around(live_graph, start_node.id, end_node.id)
route_lat_lons = [live_graph.get_node(node).position for node in route]
The example above uses osm.LiveGraph
, which automatically downloads OpenStreetMap data in tiles
and caches them on your disk. It is much more wise to download the data beforehand from a service
like Geofabrik OSM data extracts:
import pyroutelib3
with open("mazowieckie-latest.osm.pbf", "rb") as f:
graph = pyroutelib3.osm.Graph.from_file(pyroutelib3.osm.CarProfile(), f)
start_node = graph.find_nearest_node((52.23201, 21.00737))
end_node = graph.find_nearest_node((52.24158, 21.02807))
route = pyroutelib3.find_route_without_turn_around(graph, start_node, end_node)
route_lat_lons = [graph.get_node(node).position for node in route]
pyroutelib3 not only is able to parse OpenStreetMap data into a graph (see the osm
module),
but also contains generic implementations of the A* path-finding algorithm (find_route
and
find_route_without_turn_around
functions) and the k-d tree data structure (KDTree
class).
This library was designed with extensibility in mind, and most components can be swapped for
completely custom ones through the usage of well-defined protocols. As an example,
a nx.GraphAdaptor
is provided to use networkx graphs
with pyroutelib3's functionality.
pip install --upgrade pyroutelib3
pyroutelib3 uses semantic versioning. Always specify dependencies on
this library with a constraint on the major revision, e.g. pyroutelib3 ~= 2.0.0
.
Note that version 1 of this library is incompatible with version 2.
find_route
and find_route_without_turn_around
functions)SimpleGraph
class)KDTree
class)protocols
module)
nx.GraphAdaptor
and
nx.ExternalGraphAdaptor
classes)osm.reader.read_features
function)osm.Graph
class)
restriction:TRANSPORT
and exempt
tagsosm.LiveGraph
class)pyroutelib3 is distributed under GNU GPL v3 (or any later version).
© Copyright 2024 Mikołaj Kuranowski
pyroutelib3 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
pyroutelib3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with pyroutelib3. If not, see http://www.gnu.org/licenses/.
FAQs
Simple routing over OpenStreetMap data
We found that pyroutelib3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.