You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: this original "RFC" is only for a single, simple GeoTIFF. A multi-resolution image like a COG is much harder because you have to handle visibility of internal tiles to figure out what to load.
There's a continuum of options between reprojecting every pixel and reprojecting only the corners.
[When the source image is not in WGS84], the problem is more tricky, as you first need to transform the image coordinates to the native projection and then reproject to WGS84. This should be doable with proj4js when you have the according projection information. If you are lucky they are simply set in ProjectedCSTypeGeoKey or GeographicTypeGeoKey and you can get the projections WKT representation from epsg.io. See here how it was done in the COG-Explorer.
Therefore, to reproject an arbitrary pixel, given source_crs, dest_crs, pixel_x, pixel_y, image_height, image_width (watch out for flipped-y coordinates in images), you should be able to do something like the pseudocode:
src_crs_x = (pixel_x / width) * (bbox_max_x - bbox_min_x) + bbox_min_x
ditto for y, except for flipped coordinate
proj4(from, to, [src_crs_x, src_crs_y])
Then the next question is how many points to reproject. You can reproject only the corners, but for non-linear transformations, the inner pixels won't be in exactly the right place.
Alternatively you can reproject every image pixel, so that every pixel is in exactly the right position. To do this, you'd modify the existing mesh-creation code. (Since 8.2 when the GlobeView was added, the BitmapLayer creates a mesh and uses the GL.TRIANGLES draw mode.) The simplest way to do this then is to make a uniform mesh where every pixel gets two triangles. Then use those triangles as the inner mesh state.
Note: this original "RFC" is only for a single, simple GeoTIFF. A multi-resolution image like a COG is much harder because you have to handle visibility of internal tiles to figure out what to load.
There's a continuum of options between reprojecting every pixel and reprojecting only the corners.
return
. From QUESTION: How to get WGS 84 coordinates from GeoTiff? geotiffjs/geotiff.js#176:Therefore, to reproject an arbitrary pixel, given
source_crs
,dest_crs
,pixel_x
,pixel_y
,image_height
,image_width
(watch out for flipped-y coordinates in images), you should be able to do something like the pseudocode:Then the next question is how many points to reproject. You can reproject only the corners, but for non-linear transformations, the inner pixels won't be in exactly the right place.
Alternatively you can reproject every image pixel, so that every pixel is in exactly the right position. To do this, you'd modify the existing mesh-creation code. (Since 8.2 when the GlobeView was added, the BitmapLayer creates a mesh and uses the
GL.TRIANGLES
draw mode.) The simplest way to do this then is to make a uniform mesh where every pixel gets two triangles. Then use those triangles as the inner mesh state.References:
The text was updated successfully, but these errors were encountered: