Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
geojson-precision
Advanced tools
Remove meaningless precision from your GeoJSON. If your coordinates go out to 7+ digits, you are probably misrepresenting your data. Most scenarios in which GeoJSON is useful (i.e. web-related applications) do not require survey-grade precision, and a higher value is placed on a compact file size. Trimming the precision of coordinates can greatly reduce file size, while removing the appearance of fake high precision.
npm install [-g] geojson-precision
geojson
is a valid GeoJSON object, and can be of type Point
, LineString
, Polygon
, MultiPoint
, MultiPolygon
, MultiLineString
, GeometryCollection
, Feature
, or FeatureCollection
. If you are unsure whether or not your GeoJSON object is valid, you can run it through a linter such as geojsonhint.
precision
is a positive integer. If your specified precision
value is greater than the precision of the input geometry, the output precision will be the same as the input. For example, if your input coordinates are [10.0, 20.0]
, and you specify a precision
of 5
, the output will be the same as the input.
const gp = require("geojson-precision");
let trimmed = gp.parse({
"type": "Point",
"coordinates": [
18.984375,
57.32652122521709
]
}, 3);
trimmed
will now look like this:
{
"type": "Point",
"coordinates": [
18.984,
57.326
]
}
.parse()
can also be used directly, for example:
const gp = require("geojson-precision");
let trimmed = gp({ ... }, 3);
Geojson-precision can also be used via the command line when installed globally (using -g
).
A positive integer specifying coordinate precision
A positive integer specifying extra coordinate precision for things like the z value when the coordinate is [longitude, latitude, elevation].
An input GeoJSON file
An output GeoJSON file
geojson-precision -p 4 input.json output.json
Concepts, ideas, etc borrowed to various degrees from:
MIT
FAQs
Remove meaningless precision from GeoJSON
We found that geojson-precision demonstrated a not healthy version release cadence and project activity because the last version was released 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.