geotiff.js icon indicating copy to clipboard operation
geotiff.js copied to clipboard

repeated parsing of file directories by every getImage call

Open jcphill opened this issue 1 year ago • 1 comments

As shown below, every call to getImage() calls await this.parseFileDirectoriesPerFile() without using the result. parseFileDirectoriesPerFile() saves the result in this.fileDirectoriesPerFile but that variable is never referenced. The result is that every call to getImage() calls parseFileDirectoryAt() for every file for no reason.

https://github.com/geotiffjs/geotiff.js/blob/af0421bb6cfbb16a3d68aff54cb50f9d8824017f/src/geotiff.js#L613-L634

jcphill avatar Dec 12 '24 20:12 jcphill

Just to note, this only affects the MultiGeoTIFF class (overviews in separate files). The single-file case looks OK.

jcphill avatar Dec 16 '24 15:12 jcphill