Modern Spatial Reference System Class. Supports EPSG Codes, PROJ4 String, and Well-Known Text.

Overview

spatial-reference-system

Modern Spatial Reference System Class.

supports

  • EPSG Codes
  • PROJ4 Strings
  • ESRI and OGC Well-Known Text
  • PRJ File

install

npm install spatial-reference-system

usage

check if two projections are equivalent

import { equivalent } from "spatial-reference-system";

const web_mercator_esri_wkt = `PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]`;
const web_mercator_ogc_wkt = `PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs"],AUTHORITY["EPSG","3857"]]`;
equivalent(web_mercator_esri_wkt, web_mercator_ogc_wkt);
// true

get EPSG Code for ESRI Well-Known Text

import { SRS } from "spatial-reference-system";

const srs = new SRS(`PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",...`);
console.log(srs.code);
// 3857

convert wkt to a proj4 string

import { SRS } from "spatial-reference-system";

const srs = new SRS(`PROJCS["NAD83 / UTM zone 16N",GEOGCS["NAD83",...`);
console.log(srs.proj4);
// "+proj=utm +zone=16 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

get .prj file

import { SRS } from "spatial-reference-system";

const srs = new SRS(`PROJCS["NAD83 / UTM zone 16N",GEOGCS["NAD83",...`);
console.log(srs.prj);
// "PROJCS["NAD83 / UTM zone 16N",GEOGCS["NAD83",..."

uses

You might also like...

An easy-to-read, quick reference for JS best practices, accepted coding standards, and links around the Web

An easy-to-read, quick reference for JS best practices, accepted coding standards, and links around the Web

Feel free to contribute! Where? http://www.jstherightway.org Why? Today we have a bunch of websites running JavaScript. I think we need a place to put

Jan 1, 2023

ParkyDB - block based, linkable and verifiable document database -- javascript reference implementation

ParkyDB - block based, linkable and verifiable document database -- javascript reference implementation

Ancon ParkyDB A data mesh database using Web 3.0 technology Note: Requires Node v17.7.2 and up for development More about data mesh architecture Block

Aug 16, 2022

Reference for How to Write an Open Source JavaScript Library - https://egghead.io/series/how-to-write-an-open-source-javascript-library

Reference for How to Write an Open Source JavaScript Library The purpose of this document is to serve as a reference for: How to Write an Open Source

Dec 24, 2022

The Next.js reference implementation on how to design better APIs

The Next.js reference implementation on how to design better APIs

This is the Next.js reference implementation of my blog bost on How to design better APIs. Getting Started Clone the repository git clone https://gith

Nov 22, 2022

The reference LRB-USDL arbitrage bot implementation, built with neon-js.

README Introduction arby is the reference arbitrage bot for Lyrebird. arby is able to run at a profit because Lyrebird swaps LRB and USDL based on the

May 9, 2022

Sanity plugin for viewing resources which reference a particular resource.

Sanity plugin for viewing resources which reference a particular resource.

@indent-oss/sanityio-referenced-by Plugin to see which documents reference a particular document referenced-by-sanityio.mov Video Alt Text: Demonstrat

Nov 2, 2022

🎹 Memorize piano scales with ease! A music practice program w/ MIDI support. Consider it an interactive reference manual

🎹 Memorize piano scales with ease! A music practice program w/ MIDI support. Consider it an interactive reference manual

Piano Trainer Learn to play the piano at your own pace through various modes of practice. Watch the video Features MIDI compatible Home row keyboard i

Dec 21, 2022

A Complete Javascript Learning Reference Guide.

Learn Javascript A Javascript Reference Repository, which was initially created for my refernce is now open. Any one can Learn and Add more Content to

Oct 26, 2022

Stacks Voice is a reference project that builds on the SIP018 signed structured data standard to create an accountless internet forum.

Stacks Voice Stacks Voice is a reference project that builds on the SIP018 signed structured data standard to create an accountless internet forum. Th

Dec 21, 2022
Comments
  • Parse Objects

    Parse Objects

    const { SRS } = require("spatial-reference-system");
    new SRS({
      code: 3857,
      wkt: 'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]'
    });
    
    SRS {
      code: null,
      prj: undefined,
      proj4: null,
      proj4js: null,
      wkt: null
    }
    
    opened by DanielJDufour 1
Releases(v0.4.0)
Owner
Daniel J. Dufour
builds geotiff.io, geoblaze.io, georaster, georaster-layer-for-leaflet, date-extractor, geotiff-stats, and xml-utils; built code.gov, and maintains proj4js/mgrs
Daniel J. Dufour
Convert some JavaScript/TypeScript code string into a .d.ts TypeScript Declaration code string

convert-to-dts Converts the source code for any .js or .ts file into the equivalent .d.ts code TypeScript would generate. Usage import { convertToDecl

Lily Scott 11 Mar 3, 2022
The Frontend of Escobar's Inventory Management System, Employee Management System, Ordering System, and Income & Expense System

Usage Create an App # with npx $ npx create-nextron-app my-app --example with-javascript # with yarn $ yarn create nextron-app my-app --example with-

Viver Bungag 4 Jan 2, 2023
Get a quick hash that uses the well-liked Bernstein "times 33" hash method and delivers a hex string.

short-hash-ts -> Get a quick hash that uses the well-liked Bernstein "times 33" hash method and delivers a hex string. Installation Install short-hash

Younis Rahman 3 Sep 4, 2022
This package generates a unique ID/String for different browsers. Like chrome, Firefox and any other browsers which supports canvas and audio Fingerprinting.

Broprint.js The world's easiest, smallest and powerful visitor identifier for browsers. This package generates a unique ID/String for different browse

Rajesh Royal 68 Dec 25, 2022
Automaticly parses known pocket ips patch resources, scans folders or zip files for matching roms and applies the patches.

Pocket Automaton Automaticly parses known pocket ips patch resources, scans folders or zip files for matching roms and applies the patches. Usage pock

null 3 Nov 27, 2022
To understand the history of SACCOs, a Savings and Credit cooperative otherwise known as a Sacco is a type of corporation that aims at pooling money together.

To understand the history of SACCOs, a Savings and Credit cooperative otherwise known as a Sacco is a type of corporation that aims at pooling money together. Depending on the Saccos, there are different types of supplies of merchandise. These include and are not limited to recognition servers, sedimentation, and call home eggs installation. More to these items include check glades, bankers, checks standing orders and safe detentions, and salary progress.

incredicoder 2 Oct 19, 2022
Check if a url is a known route to a next.js application ahead of time

next-known-route Check if a url is a known route to a next.js application ahead of time. https://www.npmjs.com/package/next-known-route Use Case Why d

Zack Jackson 12 Jul 17, 2022
Search through all stops/stations known by Deutsche Bahn's HAFAS API.

db-stops-search Search through all stops/stations known by Deutsche Bahn's HAFAS API. Formats and imports the stops into a Meilisearch instance. Insta

Jannis R 3 Oct 4, 2022
VSCode extension to paste text as a string array

VSCode extension to paste text as a string array. This is useful when copying command line into launch.json args

Shady Boukhary 4 Dec 28, 2022
Kuldeep 2 Jun 21, 2022