GDAL for Windows
v3.13.3WindowsGDAL 3.13.3 for native Node.js addons on Windows, precompiled for x64 and arm64, Windows 10 or later as @crossbind/port-gdal-win32.
npm install @crossbind/port-gdal-win32@betaInstall
The addons and their loader land in dist; the Node.js playbook has the whole flow.
Usage
The examples the WebAssembly page runs, as Windows compiles them: the same headers and the same calls. They are checked on the WebAssembly build.
Convert GeoJSON to GeoPackage and Shapefile, reprojected
Format conversion is what GDAL is used for most, as the ogr2ogr tool: GDALVectorTranslate takes the same arguments, here -f for the format and -t_srs for the coordinate system. The input is text handed over through /vsimem/, and a zipped Shapefile is one file.
GPKG: 3 features, EPSG:3857, extent 3021523 4639455 3657925 5013551 ESRI Shapefile: 3 features, EPSG:32635, extent 512465 4252837 1000822 4541552
Write a GeoTIFF and read its georeferencing back
GDALCreate writes a raster with GDALSetGeoTransform and a CRS from OSRImportFromEPSG; GDALOpenEx opens it again as it opens any of the formats GDAL reads, and the size, band type, geotransform and CRS come back from the dataset. GDALInfo returns the report the gdalinfo tool prints.
GTiff, 200 x 150 pixels, 1 band of Float32 origin 500000, 4450000; pixel size 30 x -30 WGS 84 / UTM zone 35N, EPSG:32635 values 100 to 597 Upper Left ( 500000.000, 4450000.000) ( 27d 0' 0.00"E, 40d12' 1.44"N) Lower Right ( 506000.000, 4445500.000) ( 27d 4'13.64"E, 40d 9'35.41"N)
Reproject a raster and write a Cloud-Optimized GeoTIFF
GDALWarp reprojects as the gdalwarp tool does, here into a virtual raster that is computed while it is read; GDALTranslate with -of COG then writes it tiled, compressed and with overviews, the layout web maps read with HTTP range requests.
1093 x 672 pixels of 0.000322 x 0.000322 degrees LAYOUT=COG, COMPRESSION=DEFLATE, 256 x 256 blocks overviews 546 x 336, 273 x 168, 136 x 84
Hillshade, slope and contour lines from an elevation model
GDALDEMProcessing is the gdaldem tool: hillshade, slope, aspect, roughness, TRI and TPI by name. GDALContourGenerateEx draws the contour lines gdal_contour draws, into any vector layer; here an in-memory one, measured with OGR_G_Length.
hillshade: 12.00 to 255.00, mean 156.63, checksum 58516 slope: 0.00 to 42.97, mean 27.46, checksum 54054 contours every 100 m: 11 lines from 200 to 900 m, 46.9 km long
Read features and filter them by attribute and area
OGR reads every vector format through one API: the schema from OGR_L_GetLayerDefn, then OGR_L_GetNextFeature over the features that pass OGR_L_SetAttributeFilter, a SQL WHERE clause, and OGR_L_SetSpatialFilterRect. Open options turn the lon and lat columns of a CSV into points.
sensors: 6 features of Point, fields id Integer, kind String, reading Real 1 air 31.5 POINT (28.9784 41.0082) 3 water 22.7 POINT (27.1428 38.4237) 6 air 27.3 POINT (29.061 40.1885)
What is different on Windows
crossbind build -p win32links one.nodeaddon per architecture intodist, next to a loader,dist/<name>.native.cjs, thatrequireandimportboth load. A plaincrossbind buildskips it.await initNative()once, then call the classes: calls are synchronous, and no Worker is involved.- The library and the C++ runtime are linked into the addon statically; it needs Windows 10 or later and only DLLs that ship with Windows.
- There is no
m.FS: the C++ reads real paths, and data such asGDAL_DATAorproj.dbis copied todist/data. - The build runs in Docker on any host, a Mac included.
worker_threadsare not supported yet.
Other platforms
- GDAL overview: the apps, every platform's setup and the packages.
- GDAL for WebAssembly: browsers, Node.js and edge runtimes.
- GDAL for Android: React Native apps on Android.
- GDAL for iOS: React Native apps on iOS.
- GDAL for macOS: native Node.js addons and Electron on macOS.
- GDAL for Linux: native Node.js addons on Linux.
- GDAL for WASI: command-line programs under wasmtime.
Facts on this page come from the port manifests in the repository and from what npm served on beta when the site was built. See the Libraries guide for the full consumer flow.