geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
845 stars 175 forks source link

capturing world coordinates form the tiff imaegs using geotiff.js #428

Closed Rjaat closed 3 months ago

Rjaat commented 3 months ago

I am working on a project in which i will be adding functionality to measure distance (real world) between any two points on a tiff image. using openseadragon to display the image and the image comes with geoinformation.

requirement is, user will click any two points on the image to get the distance between those points. the length will be calculated in reference of the real world.

anyone help with, extracting the real-world coordinates of the point where user clicks.

constantinius commented 3 months ago

Hey @Rjaat

You can extract the location of a pixel using the getOrigin(), and getResolution() methods. Then you'd also need to extract the coordinate reference system, if it is not known to you beforehand. From these you can then do the distance calculations.

This is however not an issue with geotiff.js, which allows access to all the necessary information you require, so I will close this issue here.