/gdal-js

This is an Emscripten port of GDAL, an open source X/MIT licensed translator library for raster and vector geospatial data formats.

Primary LanguageC++

GDAL JS

An Emscripten port of GDAL 2.1.

Installation

npm install gdal-js

Usage

Caution! It is strongly recommended to run this code inside of a web worker. To see complete examples for how to do this, checkout the examples directory. From simplest to most complex, these are:

  1. inspect_geotiff
  2. map_extent
  3. thumbnail
  4. thumbnail_map
  5. tile_tiff

If you want to use GDAL from within a Node application, you are probably looking for https://www.npmjs.com/package/gdal.

This library exports the following GDAL functions:

  • CSLCount
  • GDALSetCacheMax
  • GDALAllRegister
  • GDALOpen
  • GDALOpenEx
  • GDALClose
  • GDALGetDriverByName
  • GDALCreate
  • GDALCreateCopy
  • GDALGetRasterXSize
  • GDALGetRasterYSize
  • GDALGetRasterCount
  • GDALGetRasterDataType
  • GDALGetRasterBand
  • GDALGetRasterStatistics
  • GDALGetRasterMinimum
  • GDALGetRasterMaximum
  • GDALGetRasterNoDataValue
  • GDALGetProjectionRef
  • GDALSetProjection
  • GDALGetGeoTransform
  • GDALSetGeoTransform
  • OSRNewSpatialReference
  • OSRDestroySpatialReference
  • OSRImportFromEPSG
  • OCTNewCoordinateTransformation
  • OCTDestroyCoordinateTransformation
  • OCTTransform
  • GDALCreateGenImgProjTransformer
  • GDALDestroyGenImgProjTransformer
  • GDALGenImgProjTransform
  • GDALDestroyGenImgProjTransformer
  • GDALSuggestedWarpOutput
  • GDALTranslate
  • GDALTranslateOptionsNew
  • GDALTranslateOptionsFree
  • GDALWarpAppOptionsNew
  • GDALWarpAppOptionsSetProgress
  • GDALWarpAppOptionsFree
  • GDALWarp
  • GDALBuildVRTOptionsNew
  • GDALBuildVRTOptionsFree
  • GDALBuildVRT
  • GDALReprojectImage
  • CPLError
  • CPLSetErrorHandler
  • CPLQuietErrorHandler
  • CPLErrorReset
  • CPLGetLastErrorMsg
  • CPLGetLastErrorNo
  • CPLGetLastErrorType
  • GDALRasterize
  • GDALRasterizeOptionsNew
  • GDALRasterizeOptionsFree
  • GDALDEMProcessing
  • GDALDEMProcessingOptionsNew
  • GDALDEMProcessingOptionsFree

For documentation of these functions' behavior, please see the GDAL documentation

In order to limit build size, GDAL is currently built with support for GeoTIFFs and PNGs only.

Developing

  1. Install Docker
  2. Run ./scripts/setup, which will build the Docker container.
  3. Run ./scripts/make gdal. The make script just calls make from inside the Docker container.
  4. ./scripts/make clean works as expected.
  5. To package up a release, run ./scripts/make VERSION=<number> release