Proj4JS Projector Fully Loaded with Projections
npm install proj4-fully-loadedbash
npm install -S proj4-fully-loaded
`motivation
One of the most popular questions I hear from users of georaster
is how do I use a GeoTIFF that's in UTM or another projection not included in the default build of proj4.
I've created this library, so users can use georaster and georaster-layer-for-leaflet
without worrying about how to find and load the projection information for their data.usage
Use it just like you would proj4,
except you don't have to load your projection.`javascript
const proj4 = require("proj4-fully-loaded");const pointIn4326 = [-85.3097, 35.0456];
// EPSG:32617 is automatically included in proj4-fully-loaded
const pointInUTM = proj4("EPSG:4326", "EPSG:32617").forward(pointIn4326);
// pointInUTM is [106823.88325412886, 3886600.558377227]
`manual way
For your reference, here is the way to manually load the projection information
without the proj4-fully-loaded library.
`javascript
const proj4 = require("proj4");// find and load projection specific definition
// taken from http://epsg.io/32617
proj4.defs("EPSG:32617", "+proj=utm +zone=17 +datum=WGS84 +units=m +no_defs");
const pointIn4326 = [-85.3097, 35.0456];
const pointInUTM = proj4("EPSG:4326", "EPSG:32617").forward(pointIn4326);
// pointInUTM is [106823.88325412886, 3886600.558377227]
``