Super Low-Level Raster Reprojection and Resampling Library

Related tags

Maps geowarp
Overview

geowarp

Super Low-Level Raster Reprojection and Resampling Library

install

npm install -S geowarp

usage

const geowarp = require("geowarp");
const proj4 = require("proj4-fully-loaded");

const result = geowarp({
  // control the level of console log output
  // set debug_level to zero to turn off console logging
  debug_level: 2,

  // reproject from an [x, y] point in the output spatial reference system
  // to an [x, y] point in the input spatial reference system
  reproject: proj4("EPSG:" + 3857, "EPSG:" + in_srs).forward,

  // two-dimensional array of pixel data organized by band
  // usually [ r, g, b ] or [ r, g, b, a ]
  // pixel data for each band is usually flattened,
  // so the end of one row is immediately followed by the next row
  in_data: [
    [0, 123, 123, 162, ...],
    [213, 41, 62, 124, ...],
    [84, 52, 124, 235, ...]
  ],

  // bounding box of input data (in_data)
  // in [xmin, ymin, xmax, ymax] format
  in_bbox: [ -122.51, 40.97, -122.34, 41.11 ],

  // a number or string representing the spatial reference system of the input data
  // could be 4326 or "EPSG:4326"
  in_srs: 4326,

  // how many pixels wide the input data is
  in_width: 1032,

  // how many pixels tall the input data is
  in_height: 1015,

  // bounding box of output
  // this is the space that you want to paint
  // in same format as in_bbox
  out_bbox: [-13638811.83098057, 5028944.964938315, -13619243.951739563, 5028944.964938315],

  // a number or string representing the spatial reference system of the input data
  // could be 4326 or "EPSG:4326"
  out_srs: 3857,

  // height of the output image in pixels
  out_height: 256,

  // width of the output image in pixels
  out_width: 256,

  // method to use to sample the pixels
  // current supported methods are:
  // "max", "mean", "median", "min", "mode", "mode-max", "mode-mean", "mode-median", and "mode-min"
  method: 'median',

  // round output pixel values to closest integer
  // do this if you will convert your output to a PNG or JPG
  round: true,

  // optional
  // the lowest possible pixel value considering the bit-depth of the data
  // this is used to speed up the min and mode-min resampling
  // if in_data is an array of typed arrays, this will be automatically calculated 
  theoretical_min: 0,

  // optional
  // the highest possible pixel value considering the bit-depth of the data
  // this is used to speed up the max and mode-max resampling
  // if in_data is an array of typed arrays, this will be automatically calculated 
  theoretical_max: 255
});

// result.data is a 3-dimensional array of pixel values broken down by row then column the band
You might also like...

jQuery Vector Map Library

This project is a heavily modified version of jVectorMap as it was in April of 2012. I chose to start fresh rather than fork their project as my inten

Dec 28, 2022

jQuery Vector Map Library

This project is a heavily modified version of jVectorMap as it was in April of 2012. I chose to start fresh rather than fork their project as my inten

Dec 28, 2022

JavaScript library to transform coordinates from one coordinate system to another, including datum transformations

PROJ4JS Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations. Origina

Dec 28, 2022

AngularJS directive to embed an interact with maps managed by Leaflet library

Angular Leaflet Why the fork? While we are grateful for all the original work at tombatossals/angular-leaflet-directive. We need to be able to operate

Nov 10, 2022

A library that makes Image Map Area responsive

A library that makes Image Map Area responsive

Jan 21, 2022

Waypoints is a library that makes it easy to execute a function whenever you scroll to an element.

Waypoints Waypoints is a library that makes it easy to execute a function whenever you scroll to an element. var waypoint = new Waypoint({ element:

Jan 4, 2023

An online tool to generate and visualize maps for irregular and/or gapped LED layouts, for use with FastLED, Pixelblaze and other libraries.

An online tool to generate and visualize maps for irregular and/or gapped LED layouts, for use with FastLED, Pixelblaze and other libraries.

An online tool to generate and visualize maps for irregular and/or gapped LED layouts, for use with FastLED, Pixelblaze and other libraries.

Dec 8, 2022

MERN stack travel app using mapbox API, Travel and drop pin , share reviews and rate the location

MERN stack travel app using mapbox API, Travel and drop pin , share reviews and rate the location

MERN-Travel-Map Travel Map Pin A single page application built with MERN Stack from scratch (MongoDB + Mongoose, Express, React & NodeJs) Table of Con

Dec 29, 2022

This is the leaflet plugin for GeoServer. Using this plugin user can have access to wms and wfs request easily.

This is the leaflet plugin for GeoServer. Using this plugin user can have access to wms and wfs request easily.

Documentation leaflet-geoserver-request This is the plugin for Geoserver various kind of requests. Using this plugin, we can make WMS, WFS, getLegendG

Dec 15, 2022
Comments
  • Output Viewport Does Not Match out_bbox

    Output Viewport Does Not Match out_bbox

    I am trying to warp this GeoTiff into EPSG:4326 to generate a tile for Mapbox.

    input

    Parsing with georaster seems to give the expected result:

      height: 570,
      width: 501,
      pixelHeight: 56,
      pixelWidth: 56,
      xmin: 450278,
      xmax: 478334,
      ymax: 1891090,
      ymin: 1859170,
    

    When I geowarp() with these params, I get a correctly sized result that looks like the projection of a small piece of the top left corner of the source raster:

      const georaster = await parseGeoraster('https://nassgeodata.gmu.edu/webservice/nass_data_cache/CDL_2008_clip_20220323194315_1211782049.tif')
    
      const options = {
        left: 0,
        top: 0,
        right: georaster.width,
        bottom: georaster.height,
        width: georaster.width,
        height: georaster.height,
      }
    
      const values = await georaster.getValues(options)
    
      const result = geowarp({
        debug_level: 2,
        forward: albersConicalEqualArea.inverse,
        inverse: albersConicalEqualArea.forward,
        in_data: values[0],
        in_bbox: [xmin, ymin, xmax, ymax],
        in_layout: '[row][column,band]',
        in_pixel_depth: 1,
        in_srs: ALBERS_CONICAL_EQUAL_AREA,
        in_width: georaster.pixelWidth,
        in_height: georaster.pixelHeight,
        out_bbox: [west, south, east, north],
        out_layout: '[row][column,band]',
        out_srs: 4326,
        out_height: 256,
        out_width: 256,
        method: 'near',
        round: false,
        theoretical_min: 0,
        theoretical_max: 255,
      })
    
    

    The requested output bbox is a direct projection of the bbox in the source tiff:

    [geowarp] out_xmin: -90.703125
    [geowarp] out_ymin: 39.6395375643667
    [geowarp] out_xmax: -90.3515625
    [geowarp] out_ymax: 39.909736234537185
    

    The result is the correct size, but does not appear to match the requested output bbox: temp

    The result looks to be a projected version of a small, top left piece of the input tiff: Screen Shot 2022-03-23 at 7 04 12 PM

    opened by jbeuckm 3
Releases(v1.10.1)
  • v1.10.1(Dec 31, 2022)

    • added .geojson to .gitignore e87737b
    • reverted geotiff version 09b08f0
    • fixed bug in near resampling 2e4f100

    https://github.com/DanielJDufour/geowarp/compare/v1.10.0...v1.10.1

    Source code(tar.gz)
    Source code(zip)
  • v1.10.0(Nov 14, 2022)

  • v1.9.0(Nov 14, 2022)

  • v1.8.0(Nov 4, 2022)

  • v1.7.0(Oct 25, 2022)

  • v1.6.0(Oct 22, 2022)

  • v1.5.0(Oct 22, 2022)

  • v1.4.0(Oct 12, 2022)

    • deleted and added package-lock.json to .gitignore d7a5d0c
    • improved exporting 38713c1
    • added row_start 6134f40

    https://github.com/DanielJDufour/geowarp/compare/v1.3.1...v1.4.0

    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Feb 19, 2022)

  • v1.3.0(Dec 16, 2021)

  • v1.2.0(Dec 8, 2021)

  • v1.1.1(Dec 8, 2021)

    • upgraded xdim 9134ef7
    • Update README.md b2d8aff
    • Update README.md 5ebf5f0
    • added support for custom method function, resizing cf36c90

    https://github.com/DanielJDufour/geowarp/compare/v1.1.0...v1.1.1

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Nov 13, 2021)

  • v1.0.3(Nov 13, 2021)

    • fixed bug when resizing small unprojected images 1ff59fd
    • updated .gitignore a9206f7

    https://github.com/DanielJDufour/geowarp/compare/v1.0.2...v1.0.3

    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(Oct 21, 2021)

  • v1.0.0(Sep 21, 2021)

  • v0.5.0(Sep 15, 2021)

    • update README.md d1ba8a0
    • added xdim layout support 3590b77
    • added 4 layout tests 2e9d167
    • added support for arbitrary out layout d945a51
    • added in_layout without noticeable performance decrease 72aaf51
    • added layout params to tests 4c08054
    • Update README.md ec2ff78

    https://github.com/DanielJDufour/geowarp/compare/v0.4.0...v0.5.0

    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Jun 5, 2021)

  • v0.3.1(Jun 4, 2021)

  • v0.3.0(Jun 4, 2021)

  • v0.2.0(May 26, 2021)

  • v0.1.0(May 26, 2021)

    • sped up max, min, and median resampling eb73c54

    https://github.com/DanielJDufour/geowarp/compare/080a4b7b484a4bbda1b6b5f4b8a1e24ff39f5deb...v0.1.0

    Source code(tar.gz)
    Source code(zip)
Owner
Daniel J. Dufour
builds geotiff.io, geoblaze.io, georaster, georaster-layer-for-leaflet, date-extractor, geotiff-stats; built code.gov, and maintains proj4js/mgrs
Daniel J. Dufour
Blazing Fast JavaScript Raster Processing Engine

Geoblaze A blazing fast javascript raster processing engine Geoblaze is a geospatial raster processing engine written purely in javascript. Powered by

GeoTIFF 125 Dec 20, 2022
The smallest, simplest and fastest JavaScript pixel-level image comparison library

pixelmatch The smallest, simplest and fastest JavaScript pixel-level image comparison library, originally created to compare screenshots in tests. Fea

Mapbox 5.1k Jan 8, 2023
The NASA WorldWind Javascript SDK (WebWW) includes the library and examples for creating geo-browser web applications and for embedding a 3D globe in HTML5 web pages.

Web WorldWind New versions of WorldWind released Web WorldWind 0.10.0 and WorldWind Java 2.2.0 are now available on GitHub. The new version of Web Wor

NASA WorldWind 770 Jan 1, 2023
geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.

geotiff.js Read (geospatial) metadata and raw array data from a wide variety of different (Geo)TIFF files types. Features Currently available function

geotiff.js 649 Dec 21, 2022
An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics

Cesium 9.7k Dec 26, 2022
An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics

Cesium 9.7k Jan 3, 2023
A very fast geospatial point clustering library for browsers and Node.

supercluster A very fast JavaScript library for geospatial point clustering for browsers and Node. <script src="https://unpkg.com/[email protected]/d

Mapbox 1.6k Jan 7, 2023
A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling

Windshaft A Node.js map tile library for PostGIS and torque.js, with CartoCSS styling. Can render arbitrary SQL queries Generates image and UTFGrid in

CARTO 306 Dec 22, 2022
:leaves: JavaScript library for mobile-friendly interactive maps

Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps. Weighing just about 39 KB of gzipped JS plus 4 KB of gzipp

Leaflet 36.5k Jan 1, 2023
Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers.

Polymaps Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers. See http://polymaps.org for more details.

Urban Airship 1.6k Dec 23, 2022