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 🙏

© 2026 – Pkg Stats / Ryan Hefner

geo-valley

v1.0.3

Published

A GeoJSON validation library for Typescript.

Readme

Geo Valley

A Promise-based GeoJSON validation library for TypeScript.

  • Validates GeoJSONs of the following types: Feature, FeatureCollection, Geometry, Geometry Collection.
  • Optimized for Node.js TypeScript.
  • Customizable output.

Documentation

User Guide

Install geo-valley using the npm package manager:

$ npm install geo-valley

Import the library at the top of your file:

import * as GV from 'geo-valley'

Examples

Say you have a parsed FeatureCollection myGeojson:

const myGeometry = {
    type: 'LineString',
    coordinates: [
        [102.0, 0.0], [103.0, 1.0], [104.0, 0.0]
    ]
}

const myGeojson = {
    type: 'FeatureCollection',
    features: [
        {
            type: 'Feature',
            geometry: myGeometry,
        }
    ]
}

Start validating your GeoJSON:

async function main() {
    const result = await GJ.isFeatureCollection(myGeojson)
    console.log(result)
    // undefined

    const result = await GJ.isFeatureCollection.bool(myGeojson)
    console.log(result)
    // true
}

If you use fp-ts, you can get the output as type Either<string, void>:

import { Either, isLeft, left } from 'fp-ts/lib/Either'

// ...

async function main() {
    const result = await GJ.isGeometry.either(myGeometry)

    if (isLeft(result)) {
        console.log('Errors:', left(result))
    } else {
        console.log('Valid')
    }
}

API

Each function takes one argument—the object you want to validate.

Each function returns undefined if the object is valid, or string[] if the object is invalid.

Each function has a bool variant that will simply return true for valid or false for invalid.


.isValid(geojson)

Checks whether an object is a valid GeoJSON.

Returns: Promise<string[] | undefined>

Variants:

  • isValid.bool(geojson): Promise<boolean>
  • isValid.either(geojson): Promise<Either<string[], void>>

.isGeojson(input)

Checks whether an object is a valid GeoJSON.

Returns: Promise<string[] | undefined>

Variants:

  • isGeojson.bool(input): Promise<boolean>
  • isGeojson.either(input): Promise<Either<string[], void>>

.isFeature(input)

Checks whether an object is a valid Feature.

Returns: Promise<string[] | undefined>

Variants:

  • isFeature.bool(input): Promise<boolean>
  • isFeature.either(input): Promise<Either<string[], void>>

.isFeatureCollection(input)

Checks whether an object is a valid FeatureCollection.

Returns: Promise<string[] | undefined>

Variants:

  • isFeatureCollection.bool(input): Promise<boolean>
  • isFeatureCollection.either(input): Promise<Either<string[], void>>

.isGeometry(input)

Checks whether an object is a valid Geometry.

Returns: Promise<string[] | undefined>

Variants:

  • isGeometry.bool(input): Promise<boolean>
  • isGeometry.either(input): Promise<Either<string[], void>>

.isGeometryCollection(input)

Checks whether an object is a valid GeometryCollection.

Returns: Promise<string[] | undefined>

Variants:

  • isGeometryCollection.bool(input): Promise<boolean>
  • isGeometryCollection.either(input): Promise<Either<string[], void>>

.isPoint(input)

Checks whether an object is a valid Point geometry.

Returns: Promise<string[] | undefined>

Variants:

  • isPoint.bool(input): Promise<boolean>
  • isPoint.either(input): Promise<Either<string[], void>>

.isMultiPoint(input)

Checks whether an object is a valid MultiPoint geometry.

Returns: Promise<string[] | undefined>

Variants:

  • isMultiPoint.bool(input): Promise<boolean>
  • isMultiPoint.either(input): Promise<Either<string[], void>>

.isLineString(input)

Checks whether an object is a valid Line String geometry.

Returns: Promise<string[] | undefined>

Variants:

  • isLineString.bool(input): Promise<boolean>
  • isLineString.either(input): Promise<Either<string[], void>>

.isMultiLineString(input)

Checks whether an object is a valid MultiLine String geometry.

Returns: Promise<string[] | undefined>

Variants:

  • isMultiLineString.bool(input): Promise<boolean>
  • isMultiLineString.either(input): Promise<Either<string[], void>>

.isPolygon(input)

Checks whether an object is a valid Polygon geometry.

Returns: Promise<string[] | undefined>

Variants:

  • isPolygon.bool(input): Promise<boolean>
  • isPolygon.either(input): Promise<Either<string[], void>>

.isMultiPolygon(input)

Checks whether an object is a valid MultiPolygon geometry.

Returns: Promise<string[] | undefined>

Variants:

  • isMultiPolygon.bool(input): Promise<boolean>
  • isMultiPolygon.either(input): Promise<Either<string[], void>>

.isBox(input)

Checks whether an object is a valid Bounding Box.

Returns: Promise<string[] | undefined>

Variants:

  • isBox.bool(input): Promise<boolean>
  • isBox.either(input): Promise<Either<string[], void>>

.isPosition(input)

Checks whether an object is a valid Position.

Returns: Promise<string[] | undefined>

Variants:

  • isPosition.bool(input): Promise<boolean>
  • isPosition.either(input): Promise<Either<string[], void>>

License

LGPL-3

Credits

Thanks to: