npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

osmlinter

v1.0.0

Published

Advanced OSM linter for node and browsers

Downloads

23

Readme

OSM Linter

Build Status npm version MIT licensed ES5

Standard - JavaScript Style Guide

Advanced OSM linter for node and browsers

Install

npm

$ yarn osmlinter

web

<script type='module'>
import { getAngle } from "https://unpkg.com/osmlinter?module"
console.log(getAngle([5, 5], [5, 6], [3, 4]))
</script>

API

closestEndNodes

Closest End Nodes, this validator detects if a line has ending nodes closer to other lines.

End Nodes touching lines are ignored.

JSOM Linter (Way end node near other highway)

Parameters

  • lines (FeatureCollection | Feature<(LineString | MultiLineString)>) GeoJSON (Multi)LineString(s)
  • options Object? Optional parameters
    • options.maxDistance number Maximum distance a node is allowed from lines (optional, default 7.5)
    • options.units number Measured distance units (kilometers, meters, miles) (optional, default "meters")

Examples

const lines = turf.featureCollection([
  turf.lineString([[5.00001, 6.00001], [2, 2], [0, 1]]),
  turf.lineString([[5, 5], [5, 6], [3, 4]])
])
const endNodes = osmlinter.closestEndNodes(lines)
//=endNodes

Returns FeatureCollection<Point> End nodes near other lines

index

Finds the angle between 3 points.

Parameters

Examples

osmlinter.getAngle([5, 5], [5, 6], [3, 4])
//=45

Returns number angle

index

Detects if line is closed

Parameters

  • geojson Feature<(LineString | MultiLineString | Polygon | MultiPolygon)> LineString(s) or Polygons(s)
  • options Object Optional parameters (optional, default {})

Examples

const line1 = turf.lineString([[5, 5], [5, 6], [3, 4], [5, 5]])
const line2 = turf.lineString([[5, 5], [5, 6], [3, 4], [3, 3]])

osmlinter.isLineClosed(line1)
//=true
osmlinter.isLineClosed(line2)
//=false

Returns boolean true/false if line is closed

impossibleAngle

Impossible Angle, this validator detects lines with less likely turning angles.

Parameters

  • lines (FeatureCollection | Feature<(LineString | MultiLineString)>) GeoJSON (Multi)LineString(s)
  • options Object? Optional parameters
    • options.minAngle number Minimum Angle in degrees (optional, default 10)
    • options.maxAngle number Maximum Angle in degrees (optional, default Infinity)

Examples

const line = {
  type: 'LineString',
  coordinates: [[5, 5], [5, 6], [3, 4]]
}
osmlinter.impossibleAngle(line)

Returns boolean true/false

isBuilding

Detects if geometry is highly likely to be a building

Parameters

  • geojson Feature<(LineString | MultiLineString | Polygon | MultiPolygon)> LineString(s) or Polygons(s)
  • options Object Optional parameters (optional, default {})
    • options.minArea number Minimum area in square meters (optional, default 0)
    • options.maxArea number Maximum area in square meters (optional, default 40000)

Examples

const line = turf.lineString([[5, 5], [5, 6], [3, 4], [4, 4] [5, 5]])

osmlinter.isBuilding(line)
//=true/false

Returns boolean true/false

isRiverbank

Detects if geometry is highly likely to be a riverbank

Parameters

  • geojson Feature<(LineString | MultiLineString | Polygon | MultiPolygon)> LineString(s) or Polygons(s)
  • options Object Optional parameters (optional, default {})
    • options.minArea number Minimum area in square meters (optional, default 40000)
    • options.maxArea number Maximum area in square meters (optional, default Infinity)

Examples

const line = turf.lineString([[5, 5], [5, 6], [3, 4]])

osmlinter.isRiverbank(line)
//=true/false

Returns boolean true/false

totalNodes

Count the amount of Nodes in a GeoJSON Geometry

Parameters

  • geojson GeoJSON GeoJSON

Examples

const line = turf.lineString([[10, 5], [-10, 0]])

osmlinter.totalNodes(line) // => 2

Returns number Total number of nodes in GeoJSON