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

geojson-converter

v0.1.5

Published

Convert GeoJSON to GeoJSON (from obsolete specification (aka GJ2008) and back)

Downloads

5

Readme

geojson-converter

About

Coordinates defined in GeoJSON objects uses WGS 84 projection (EPSG:4326).

Obsolete specifications of GeoJSON (aka GJ2008) allow to specify coordinate reference system (CRS) to use coordinates in others systems, for example, in Web Mercator projection (EPSG:3857).

This module can convert from obsolete specification (aka GJ2008) to (normal) GeoJSON and back.

Module uses proj4 library to translate coordinates (this allow to pecify the projection name and datum if necessary).

Usage example

Install

$ npm install geojson-converter

Usage to normalize GeoJSON:

import {normalize} from 'geojson-converter';

const geoJsonWithCrs = {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"name":"building"},"geometry":{"coordinates":[[[4327063.487520801,7530792.175331439],[4327079.9973121025,7530744.296936532],[4327110.815589298,7530753.652485012],[4327092.104492462,7530803.181859037],[4327063.487520801,7530792.175331439]]],"type":"Polygon"}}],"crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:EPSG::3857"}}};

console.log(normalize(geoJsonWithCrs));

Usage to convert GeoJSON to obsolete schema (with crs attribute):

import {obsolete} from 'geojson-converter';

const geoJson = {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"name":"building"},"geometry":{"coordinates":[[[38.87067266195456,55.86098927010207],[38.8708209719332,55.860747896682426],[38.871097817227536,55.86079506172163],[38.87092973258484,55.861044758032676],[38.87067266195456,55.86098927010207]]],"type":"Polygon"}}]};

console.log(obsolete(geoJson, 'EPSG:102018', '+proj=gnom +lat_0=90 +lon_0=0 +x_0=6300000 +y_0=6300000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs'));

License

MIT