Skip to content

yunwei37/gdal-proj-wasm

Repository files navigation

GDAL for wasm

compile and run

  1. install emscripten

    see https://github.com/kripken/emscripten\

    tested emscripten version:

    emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.25 (febd44b21ecaca86e2cb2a25ef3ed4a0a2076365) clang version 16.0.0 (https://github.com/llvm/llvm-project effd75bda4b1a9b26e554c1cda3e3b4c72fa0aa8)

  2. compile gdal and proj for multi-thread

    make
  3. install gdal and proj headers

    cd gdal && make install

    The lib can befound:

    • proj4/src/.libs/libproj.a
    • gdal/libgdal.a

This is a part of GPlates wasm project.

GDAL JS

============== An Emscripten port of GDAL 2.4.

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. inspect_vector
  3. map_extent
  4. thumbnail
  5. thumbnail_map
  6. 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
  • GDALGetDataTypeSizeBytes
  • GDALGetDataTypeByName
  • GDALGetDataTypeName
  • GDALRasterIO
  • GDALRasterIOEx
  • GDALReadBlock
  • GDALWriteBlock
  • GDALGetBlockSize
  • GDALGetActualBlockSize
  • 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
  • GDALDatasetGetLayer
  • GDALDatasetGetLayerByName
  • GDALDatasetGetLayerCount
  • GDALDatasetExecuteSQL
  • GDALRasterIO
  • GDALRasterIOEx
  • GDALDatasetRasterIO
  • GDALDatasetRasterIOEx
  • GDALReadBlock
  • GDALWriteBlock
  • GDALGetBlockSize
  • GDALGetActualBlockSize
  • OGR_L_GetNextFeature
  • OGR_L_GetExtent
  • OGR_L_GetLayerDefn
  • OGR_L_ResetReading
  • OGR_L_GetName
  • OGR_F_GetFieldAsInteger
  • OGR_F_GetFieldAsInteger64
  • OGR_F_GetFieldAsDouble
  • OGR_F_GetFieldAsString
  • OGR_F_GetFieldAsBinary
  • OGR_F_GetFieldAsDateTime
  • OGR_F_GetFieldAsDateTimeEx
  • OGR_F_GetFieldAsDoubleList
  • OGR_F_GetFieldAsIntegerList
  • OGR_F_GetFieldAsInteger64List
  • OGR_F_GetFieldAsStringList
  • OGR_F_GetGeometryRef
  • OGR_F_Destroy
  • OGR_FD_GetFieldCount
  • OGR_FD_GetFieldDefn
  • OGR_Fld_GetType
  • OGR_Fld_GetNameRef
  • OGR_G_GetGeometryType
  • OGR_G_GetX
  • OGR_G_GetY
  • OGR_G_GetPoint
  • OGR_G_GetPoints
  • OGR_G_GetPointCount
  • OGR_G_GetEnvelope
  • OGR_G_GetSpatialReference
  • OGR_G_Intersects
  • OGR_G_Simplify
  • OGR_G_Touches
  • OGR_G_Transform
  • OGR_G_Within
  • OGR_G_ExportToGML
  • OGR_G_ExportToJson
  • OGR_G_ExportToJsonEx
  • OGR_G_ExportToKML
  • OGR_G_ExportToWkb
  • OGR_G_ExportToWkt
  • GDALVectorTranslate (ogr2ogr)
  • GDALVectorTranslateOptionsFree
  • GDALVectorTranslateOptionsNew
  • GDALVectorTranslateOptionsSetProgress
  • GDALPolygonize
  • GDALFPolygonize
  • GDALSieveFilter

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

In order to limit build size, GDAL is currently built with raster support for GeoTIFFs, PNGs, and JPEGs 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

About

A wasm port for gdal and proj4 library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published