🔒 Everything runs locally in your browser. No file, coordinate or measurement is uploaded to a server.
Write a Float32 GeoTIFF that GDAL actually reads
A deformation raster is a small file with an unforgiving specification. It has to declare
that its samples are 32-bit floating point, say where the first pixel sits in a real coordinate
system, and put exactly the right number of bytes in the strip. Get any of those three wrong and
the file either opens with nonsense values or fails outright. For years the convenient browser
route — the writer shipped with geotiff.js — has been the weak link, and anyone who has tried to
hand a SNAP product to a GDAL-based pipeline has met the resulting Offset is outside the
bounds of the DataView error.
This tool takes a SNAP BEAM-DIMAP product or a pasted numeric matrix and writes the TIFF bytes
explicitly, then reads them back in the same tab so you can see the maximum per-pixel error
before the file leaves your machine. The example uses EPSG:32610, WGS 84 / UTM zone 10N, which
is the sort of projected deliverable a North American corridor or mining compliance package
expects. The mechanism is deliberately narrow: one band, one strip, no compression, no
reprojection, no guesswork.
Input A — SNAP BEAM-DIMAP files
Select the .dim XML, the ENVI .hdr and the raw band binary together. Only interleave=bsq with an explicitly declared EPSG is accepted.
Input B — paste a matrix and declare the geometry
Rows separated by spaces, tabs or semicolons. Do not leave empty cells: the matrix must be rectangular.
Product summary
Export and verify
The defect, precisely
geotiff.js 2.1.3 is an excellent reader and a broken writer for non-8-bit samples. In
geotiffwriter.js at line 223 the strip is built with
new Uint8Array(values). For a Float32Array of 12 deformation values,
that constructor copies one byte-equivalent per element — it truncates each value modulo 256 —
and produces a 12-byte strip where the TIFF metadata correctly advertises 48 bytes. Any reader
that trusts StripByteCounts then runs off the end of the buffer. The symptom is a
DataView bounds error; the cause is that a 32-bit sample was treated as an 8-bit one.
A Float32 value is not an 8-bit value. Writing it requires either a byte view over the
original Float32Array (with explicit endianness handling) or one
DataView.setFloat32(offset, value, true) call per sample. This exporter uses the
second approach, little-endian throughout, and sets StripByteCounts = width × height ×
4. A 4×3 grid of 12 values therefore produces exactly 48 bytes of pixel data. The
read-back button parses the resulting buffer with geotiff.js and reports the largest absolute
difference between the written and recovered values: zero.
Tags and GeoKeys the file contains
A GeoTIFF is a TIFF plus a small set of georeferencing tags. This encoder writes a single IFD
with 13 entries, all values stored in an external data area with offsets back-filled after the
layout is computed, so the entry count can never disagree with the number of entries written.
The header is II (little-endian) with magic number 42.
TIFF tag / GeoKey
Value written
Why it matters
258 BitsPerSample
32
Declares a 32-bit sample, not 8-bit
339 SampleFormat
3
3 means IEEE floating point; 1 would mean unsigned integer
259 Compression
1 (none)
Single uncompressed strip, trivially verifiable
279 StripByteCounts
width × height × 4
The number the broken writer violated
33550 ModelPixelScale
[sx, sy, 0]
Pixel size in metres or degrees
33922 ModelTiepoint
[0, 0, 0, x0, y0, 0]
Upper-left pixel centre in CRS coordinates
34735 GeoKeyDirectory
1024, 1025, plus 3072 or 2048
Model type, raster type, and the EPSG code
3072 ProjectedCSType
for example 32610
Used when the EPSG is a projected system
2048 GeographicType
for example 4326
Used when the EPSG is a geographic system
CRS classification is fail-closed. EPSG codes in the 4000–4999 range are treated as
geographic and written to GeoKey 2048; codes at or above 2000 are treated as projected and
written to GeoKey 3072. Anything below 2000, non-numeric or negative is rejected with a
BAD_EPSG_CLASS error. The encoder does not attempt to infer a CRS from the numbers
in the raster, and it does not reproject. If your product is in geographic degrees but the
deliverable requires a UTM grid, transform the raster in GDAL first, then export.
What the BEAM-DIMAP reader accepts
SNAP stores a product as a .dim XML document plus a .data folder
containing an ENVI .hdr header and a raw binary band file. The reader takes only
the raster width, height and Data_File_Path from the XML; everything else comes
from the header. It selects the raw binary by the path declared in the .dim, then by a matching
.hdr stem, and only falls back to a single candidate when there is exactly one — a .data folder
usually also contains quicklook and preview binaries, so guessing is unsafe.
Supported ENVI data types are 1 (uint8), 2 (int16), 3 (int32), 4 (float32), 5 (float64),
12 (uint16) and 13 (uint32), with byte order honoured. Only interleave = bsq is
accepted. The reader checks that the binary length equals
samples × lines × bands × bytes-per-sample, that the requested band exists, and
that the XML dimensions match the header. Any mismatch is a reason code, not a silent
approximation.
Georeferencing comes from one of three explicit declarations: an
AUTHORITY["EPSG","NNNN"] inside the coordinate system string; a
Geographic Lat/Lon map info with units=Degrees and a WGS-84 datum,
which resolves to EPSG:4326; or a UTM map info with an explicit zone and hemisphere on WGS-84,
which resolves to 326xx or 327xx. Anything else returns NO_EXPLICIT_CRS. The
upper-left tie point is computed from the 1-based reference pixel in map info as
x0 = e − (i−1)·sx and y0 = n + (j−1)·sy.
Verify with GDAL before you deliver
The browser read-back is a convenience; the acceptance test that matters is the one your
client runs. With GDAL installed, a few commands settle every common question:
gdalinfo insar-float32.tif | grep -E "Size is|Pixel Size|Type=|AUTHORITY|Origin"
# expect: Type=Float32, Size is 4, 3, Pixel Size = (20.000...,-20.000...)
# and AUTHORITY["EPSG","32610"]
gdal_translate -of GTiff -ot Float32 insar-float32.tif verified.tif
gdalinfo -stats verified.tif | grep -E "Minimum|Maximum|Mean"
# if the product is still in degrees, transform explicitly:
gdalwarp -t_srs EPSG:32610 -r bilinear insar-float32.tif utm10n.tif
Note the sign convention in the reported pixel size: this encoder stores a positive
sy in ModelPixelScale together with a top-left tie point, which is why GDAL reports
a negative north–south spacing. That is correct behaviour for a north-up image, not an inverted
raster. EPSG:3857, Web Mercator, is a display projection: do not measure deformation in it, and
do not let it appear in a compliance deliverable as though it were a survey CRS.
Limits worth stating in the method section
No reprojection of tie-point grids. Products whose geometry is carried by GCPs or a
tie-point grid rather than map info are outside this reader. Terrain-correct SNAP outputs
frequently fall into this category; reproject them in SNAP or GDAL first.
No CRS guessing. A missing EPSG is an error, never a default of 4326. Silently
assuming WGS 84 is how a raster ends up a continent away from its vector overlay.
No multi-band, tiled, compressed or big-endian output. One band, one strip, little
endian, uncompressed. That constraint is what makes the byte layout auditable.
No nodata rewriting. The ENVI data ignore value is reported in the
summary but the output TIFF does not add a nodata tag. Set it downstream with
gdal_translate -a_nodata if your pipeline needs it.
No scientific interpretation. The encoder preserves numerical values; it does not
validate unwrapping, atmosphere, a reference point or a sign convention.
Where this fits in an ASF / USGS-style deliverable
A typical open-data workflow starts with Sentinel-1 SLCs, an ASF HyP3 or ISCE2 interferogram
product, unwrapping and time-series inversion, then a velocity or displacement raster that has
to be delivered alongside a vector alignment and a metadata note. The raster is the artifact
most likely to be re-opened years later by somebody who was not on the project. A Float32
GeoTIFF with an explicit EPSG GeoKey, a correct pixel scale and a verifiable tie point survives
that handoff; a CSV of pixel values with a README does not. Writing the CRS into the file also
makes downstream checks trivial: gdalinfo, QGIS layer properties and a simple
extent comparison in a notebook all agree.
Keep the read-back output in your delivery note. "Maximum per-pixel round-trip error = 0,
EPSG read = 32610, extent = [550000, 5269940, 550080, 5270000]" is the kind of line that ends
an argument before it starts.
Frequently asked questions
What exactly is wrong with writing Float32 through geotiff.js 2.1.3?
Its writer builds the strip with new Uint8Array(values) at geotiffwriter.js line 223. For a Float32Array that copies one byte-equivalent per element and truncates each value modulo 256, so 12 Float32 samples produce 12 bytes while StripByteCounts still advertises 48. Readers then hit Offset is outside the bounds of the DataView. Using geotiff.js as a reader is fine; the defect is in its writer.
Which TIFF tags make the output a valid Float32 GeoTIFF?
BitsPerSample = 32 and SampleFormat = 3 declare IEEE floating point samples. Compression = 1 gives one uncompressed strip whose StripByteCounts is width x height x 4. ModelPixelScaleTag 33550 and ModelTiepointTag 33922 place the grid, and GeoKeyDirectoryTag 34735 carries GTModelTypeGeoKey 1024, GTRasterTypeGeoKey 1025 and either ProjectedCSTypeGeoKey 3072 or GeographicTypeGeoKey 2048 with the EPSG code.
Will the tool guess my coordinate reference system if the header is missing one?
No. An undeclared CRS returns NO_EXPLICIT_CRS and the export is blocked. The reader accepts an AUTHORITY EPSG code in the coordinate system string, a fully specified WGS 84 Geographic Lat/Lon map info with units=Degrees (EPSG:4326), or a UTM map info with an explicit zone and hemisphere on WGS-84 (326xx or 327xx). Silently defaulting to WGS 84 would misplace a raster by a whole continent.
Why does my terrain-corrected SNAP product fail to load?
Products that carry their geometry as ground control points or a tie-point grid rather than a simple map info transform are outside this reader. It writes a single affine transform built from pixel scale and one upper-left tie point, and it will not reproject a tie-point grid. Terrain-correct the product and export a conventionally geocoded raster in SNAP, or reproject with gdalwarp before conversion.
Can I export an EPSG:4326 raster and then use EPSG:32610 in my report?
Only after an actual transformation. The encoder writes whatever EPSG you declare and never reprojects. Export the geographic product, then run gdalwarp -t_srs EPSG:32610 to create the projected deliverable, and check the resulting extent in QGIS or with gdalinfo. Relabelling degrees as metres is a data error, not a projection.
What does the read-back check actually prove?
It parses the generated buffer with geotiff.js, reads the raster band back and computes the largest absolute difference against the original Float32 values. A maximum error of 0 confirms the byte layout, sample format and strip length are consistent. It also prints the EPSG recovered from the GeoKeys and the bounding box, which confirms the georeferencing tags are readable. It does not validate the physics of the values.
Does the exporter add a nodata value to the GeoTIFF?
No. The ENVI data ignore value is shown in the product summary so you can see it, but the output TIFF does not carry a nodata tag by default. If your downstream pipeline needs one, add it explicitly with gdal_translate -a_nodata after export, choosing a value that cannot collide with a real displacement measurement.
This toolkit provides preliminary geotechnical interpretation only. Results cannot replace licensed site investigation or official geohazard assessment reports. Field verification by qualified professionals is required for all engineering decisions.