Oh Snap

Snap points to nearest point in a different set.
Alternatives To Oh Snap
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Geojson Area892,198655 years ago2December 19, 20163otherJavaScript
compute the area of a geojson polygon or multipolygon
Sharedstreets Js62742 years ago61May 16, 202056mitTypeScript
SharedStreets (Node.js & Javascript)
Haversine Distance422398 months ago10March 09, 20202mitJavaScript
Haversine formula in Javascript. In meters. Nothing more.
2 years ago3October 05, 2021mitKotlin
Kotlin geometry library
Oh Snap7129 years ago2January 06, 2015JavaScript
Snap points to nearest point in a different set.
2 years agomitPython
ViewSHED is an open-source API for computing the visible area given a location and elevation.
4 years agootherDart
Calculate the area inside of any GeoJSON geometry. This is a Dart port of Mapbox's geojson-area.
3 years agomitCrystal
Calculate the area inside of any GeoJSON geometry
Random Coordinates3
7 years agomitJavaScript
Generate a random coordinates, which are latitude and longitude, comma separated.
Turf Area2
8 years ago1JavaScript
Calculates the total geographical area in meters squared of any GeoJSON object
Alternatives To Oh Snap
Select To Compare

Alternative Project Comparisons


Snap points to nearest point in a different set.


Install via npm:

npm install oh-snap



points is a GeoJSON feature collection of points.

snapTo is another GeoJSON feature collection of points.

maxDistance is an optional maximum distance, in meters (the default is no maximum). If specified, a point in points will only be counted as being at the nearest point in snapTo if it's less than maxDistance meters away.


Let's say you have a GeoJSON collection of points where car crashes happened, and a GeoJSON collection of points for intersections, and you want to get a list of intersections with the number of crashes at/near each.

var snap = require("oh-snap");

//crashes is a GeoJSON FeatureCollection of points
//intersections is another GeoJSON FeatureCollection of points

var result = snap(crashes,intersections);

result will be another GeoJSON FeatureCollection with the same points as intersections. Each one will have one new property, called snapped:

snapped: {
  count: 4,
  details: [{...},{...},{...},{...}]

That means 4 points in crashes were closest to this intersection. details is an array of those four crashes' properties, in case you want it.

Popular Geojson Projects
Popular Meter Projects
Popular Mapping Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.