Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A Python implementation of the Visvalingam-Wyatt line simplification algorithm.
This implementation is due to Eliot Hallmark. This release simply packages it as a Python module.
>>> import visvalingamwyatt as vw
>>> points = [(1, 2), (2, 3), (3, 4), ...]
>>> vw.simplify(points)
[(1, 2), (3, 4), ...]
Points may be any Sequence
-like object that (list
, tuple
, a custom class that exposes an __iter__
method).
Test different methods and thresholds:
simplifier = vw.Simplifier(points)
# Simplify by percentage of points to keep
simplifier.simplify(ratio=0.5)
# Simplify by giving number of points to keep
simplifier.simplify(number=1000)
# Simplify by giving an area threshold (in the units of the data)
simplifier.simplify(threshold=0.01)
Shorthands for working with geodata:
import visvalingamwyatt as vw
feature = {
"properties": {"foo": "bar"},
"geometry": {
"type": "Polygon",
"coordinates": [...]
}
}
# returns a copy of the geometry, simplified (keeping 90% of points)
vw.simplify_geometry(feature['geometry'], ratio=0.90)
# returns a copy of the feature, simplified (using an area threshold)
vw.simplify_feature(feature, threshold=0.90)
The command line tool vwsimplify
is available to simplify GeoJSON files:
# Simplify using a ratio of points
vwsimplify --ratio 0.90 in.geojson -o simple.geojson
# Simplify using the number of points to keep
vwsimplify --number 1000 in.geojson -o simple.geojson
# Simplify using a minimum area
vwsimplify --threshold 0.001 in.geojson -o simple.geojson
Install Fiona for the additional ability to simplify any geodata layer.
MIT
FAQs
Simplify geometries with the Visvalingam-Wyatt algorithm
We found that visvalingamwyatt 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.