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

reproject-stream

v2.0.0

Published

reproject a stream of LDJSON into a different projection

Downloads

3

Readme

reproject-stream

geographic coordinate reproject of LDSON streams

CLI Usage

npm install reproject-stream -g

Lets assume there is a json file, something.json with geo data, in EPSG:3857 projection.

[
 {"x":-12696407.9691,"y":6644490.815599999", "OBJECTID":16960,"Name":"West Nose Creek Confluence Park","Type":35,"Address_1":"North side of Beddington Tr.","Address_2":"","Geographic_Location":"","Postal_Code":"","Website":"","Status":1,"Reasons":"","Programs_and_Services":"Various pathways","Comment":"","created_user":"cgync","created_date":null,"last_edited_user":"cgync","last_edited_date":1390861153000}
]

We can reproject to the default 'WGS84' projection

cat something.json | reproject-stream "x" "y" "EPSG:3857"

where args are

  • the path on the object to the x coord
  • the patj on the object to the y coord
  • the projection the current lat,lon are in

To reproject to another projection

cat something.json | reproject-stream "x" "y" "EPSG:3857" "EPSG:4269"

To use a proj or wkt string

cat something.json | reproject-stream "x" "y" "EPSG:3857" "+proj=gnom +lat_0=90 +lon_0=0 +x_0=6300000 +y_0=6300000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"

GEOJson objects

It can also reproject full GEOJson objects without having to specify they x and y. So Polygons and other shapes can be reprojected. Here is a long example of something like that.

cat assessment.csv | ldjson-csv  | jsonmap "this.geometry = JSON.parse(this.GEOMETRY); delete this.GEOMETRY; this.type = 'Feature'"| reproject-stream "+proj=tmerc +lat_0=0 +lon_0=-114 +k=0.9999 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs" --geojson

Module Usage

npm install reproject-stream --save

then

var opts = {};
opts.x_selector = 'x';
opts.y_selector = 'y';
opts.from_proj = 'EPSG:3857'
fs.createReadStream('something.json')
  .pipe(reproject(x_selector, y_selector, from_proj))
  .pipe(process.stdout)