SDFIdk / skraafoto_stac_public

Other
6 stars 1 forks source link

Images and item geometries do not align #57

Closed iamfrank closed 2 years ago

iamfrank commented 2 years ago

Consider this application that displays images via STAC API:

http://test11.dataforsyningen.dk/viewer.html?center=587902.36125098%2C6140874.720166781&map=0&item=2021_83_36_4_0012_00003998

The image in the main viewport does not display a little white crosshair at the user defined position. Only if you drag the image beyond its extent, is the crosshair revealed.

See Screenshot 1

the crosshair is visible just above the white toolbar in the upper left corner.

I suspected that the crosshair had somehow been positioned outside the image bounds. But I made a map of the crosshair position, the item geometry, and the item's bounding box and found that they were all contained within each other.

See Screenshot 2

I turns out that the corresponding image is cropped in a way that does not reflect the item's geometry. The image seems to be cropped at the upper edge when compared to the geometry coordinates on the map.

iamfrank commented 2 years ago

Bonus info

Link to image in question:

https://api.dataforsyningen.dk/skraafoto_server_test/COG_oblique_2021/10km_614_58/1km_6140_587/2021_83_36_4_0012_00003998.tif

STAC API request

GET | https://api.dataforsyningen.dk/skraafotoapi_test/search?limit=1&filter={"and":[{"contains":[{"property":"geometry"},{"type":"Polygon","coordinates":[[587892.36125098,6140884.720166781],[587912.36125098,6140884.720166781],[587912.36125098,6140864.720166781],[587892.36125098,6140864.720166781],[587892.36125098,6140884.720166781]]}]},{"eq":[{"property":"direction"},"east"]},{"eq":[{"property":"collection"},"skraafotos2021"]}]}&filter-lang=cql-json&filter-crs=http://www.opengis.net/def/crs/EPSG/0/25832&crs=http://www.opengis.net/def/crs/EPSG/0/25832

STAC API response

{"type":"FeatureCollection","features":[{"type":"Feature","stac_version":"1.0.0","stac_extensions":["https://stac-extensions.github.io/view/v1.0.0/schema.json","https://stac-extensions.github.io/projection/v1.0.0/schema.json","https://raw.githubusercontent.com/stac-extensions/perspective-imagery/main/json-schema/schema.json"],"id":"2021_83_36_4_0012_00003998","collection":"skraafotos2021","geometry":{"type":"Polygon","coordinates":[[[586674.8067783763,6140845.246682442],[587944.1270908772,6140968.373635566],[587925.1642002523,6140118.77011994],[586664.573379939,6140287.494729317],[586674.8067783763,6140845.246682442]]]},"bbox":[586664.573379939,6140118.77011994,587944.1270908772,6140968.373635566],"properties":{"datetime":"2021-03-31T12:55:15Z","gsd":0.1,"license":"various","platform":"Fixed-wing aircraft","instruments":["UCOM3p-423S81560X411059_UC-Op-Left"],"providers":[{"name":"Geofly GmbH","roles":["producer"]},{"url":"https://sdfe.dk/","name":"SDFE","roles":["licensor","host"]}],"proj:epsg":null,"proj:shape":[10300.0,7700.0],"direction":"east","estimated_accuracy":null,"pers:omega":-0.570393,"pers:phi":-44.941068,"pers:kappa":-90.426591,"pers:perspective_center":[585787.078,6140580.422,1514.575],"pers:crs":25832,"pers:vertical_crs":5799,"pers:rotation_matrix":[-0.005270068784836322,-0.9999750875269151,0.004695817345402912,0.7078140879386058,-0.0004131202102392959,0.7063986454172541,-0.7063791073429639,0.0070465351223267785,0.7077986317111153],"pers:interior_orientation":{"camera_id":"UCOM3p-423S81560X411059_UC-Op-Left","focal_length":123.0,"pixel_spacing":[0.0052,0.0052],"calibration_date":"2019-03-01","principal_point_offset":[0.0,6.75],"sensor_array_dimensions":[7700.0,10300.0]},"asset:data":"https://api.dataforsyningen.dk/skraafoto_server_test/COG_oblique_2021/10km_614_58/1km_6140_587/2021_83_36_4_0012_00003998.tif","asset:thumbnail":"https://api.dataforsyningen.dk/skraafoto_cogtiler_test/thumbnail.jpg?url=https%3A%2F%2Fapi.dataforsyningen.dk%2Fskraafoto_server_test%2FCOG_oblique_2021%2F10km_614_58%2F1km_6140_587%2F2021_83_36_4_0012_00003998.tif"},"links":[{"rel":"self","type":"application/geo+json","href":"https://api.dataforsyningen.dk/skraafotoapi_test/collections/skraafotos2021/items/2021_83_36_4_0012_00003998"},{"rel":"parent","type":"application/json","href":"https://api.dataforsyningen.dk/skraafotoapi_test/collections/skraafotos2021"},{"rel":"collection","type":"application/json","href":"https://api.dataforsyningen.dk/skraafotoapi_test/collections/skraafotos2021"},{"rel":"root","type":"application/json","href":"https://api.dataforsyningen.dk/skraafotoapi_test/"},{"rel":"license","href":"https://sdfe.dk/om-os/vilkaar-og-priser","type":"text/html; charset=UTF-8","title":"SDFE license terms"},{"rel":"alternate","href":"https://api.dataforsyningen.dk/skraafoto_cogtiler_test/viewer.html?url=https%3A%2F%2Fapi.dataforsyningen.dk%2Fskraafoto_server_test%2FCOG_oblique_2021%2F10km_614_58%2F1km_6140_587%2F2021_83_36_4_0012_00003998.tif","type":"text/html; charset=UTF-8","title":"Interactive image viewer"}],"assets":{"data":{"href":"https://api.dataforsyningen.dk/skraafoto_server_test/COG_oblique_2021/10km_614_58/1km_6140_587/2021_83_36_4_0012_00003998.tif","type":"image/tiff; application=geotiff; profile=cloud-optimized","roles":["data"],"title":"Raw tiff file"},"thumbnail":{"href":"https://api.dataforsyningen.dk/skraafoto_cogtiler_test/thumbnail.jpg?url=https%3A%2F%2Fapi.dataforsyningen.dk%2Fskraafoto_server_test%2FCOG_oblique_2021%2F10km_614_58%2F1km_6140_587%2F2021_83_36_4_0012_00003998.tif","type":"image/jpeg","roles":["thumbnail"],"title":"Thumbnail"}},"crs":{"type":"name","properties":{"name":"http://www.opengis.net/def/crs/EPSG/0/25832"}}}],"links":[{"rel":"self","type":"application/geo+json","href":"https://api.dataforsyningen.dk/skraafotoapi_test/search?limit=1&filter=%7B%22and%22%3A+%5B%7B%22contains%22%3A+%5B%7B%22property%22%3A+%22geometry%22%7D%2C+%7B%22type%22%3A+%22Polygon%22%2C+%22coordinates%22%3A+%5B%5B587892.36125098%2C+6140884.720166781%5D%2C+%5B587912.36125098%2C+6140884.720166781%5D%2C+%5B587912.36125098%2C+6140864.720166781%5D%2C+%5B587892.36125098%2C+6140864.720166781%5D%2C+%5B587892.36125098%2C+6140884.720166781%5D%5D%7D%5D%7D%2C+%7B%22eq%22%3A+%5B%7B%22property%22%3A+%22direction%22%7D%2C+%22east%22%5D%7D%2C+%7B%22eq%22%3A+%5B%7B%22property%22%3A+%22collection%22%7D%2C+%22skraafotos2021%22%5D%7D%5D%7D&filter-lang=cql-json&filter-crs=http%3A%2F%2Fwww.opengis.net%2Fdef%2Fcrs%2FEPSG%2F0%2F25832&crs=http%3A%2F%2Fwww.opengis.net%2Fdef%2Fcrs%2FEPSG%2F0%2F25832","method":"GET"},{"rel":"next","type":"application/geo+json","href":"https://api.dataforsyningen.dk/skraafotoapi_test/search?limit=1&filter=%7B%22and%22%3A+%5B%7B%22contains%22%3A+%5B%7B%22property%22%3A+%22geometry%22%7D%2C+%7B%22type%22%3A+%22Polygon%22%2C+%22coordinates%22%3A+%5B%5B587892.36125098%2C+6140884.720166781%5D%2C+%5B587912.36125098%2C+6140884.720166781%5D%2C+%5B587912.36125098%2C+6140864.720166781%5D%2C+%5B587892.36125098%2C+6140864.720166781%5D%2C+%5B587892.36125098%2C+6140884.720166781%5D%5D%7D%5D%7D%2C+%7B%22eq%22%3A+%5B%7B%22property%22%3A+%22direction%22%7D%2C+%22east%22%5D%7D%2C+%7B%22eq%22%3A+%5B%7B%22property%22%3A+%22collection%22%7D%2C+%22skraafotos2021%22%5D%7D%5D%7D&filter-lang=cql-json&filter-crs=http%3A%2F%2Fwww.opengis.net%2Fdef%2Fcrs%2FEPSG%2F0%2F25832&crs=http%3A%2F%2Fwww.opengis.net%2Fdef%2Fcrs%2FEPSG%2F0%2F25832&pt=PmR0OjIwMjEtMDMtMzEgMTQ6NTU6MTUrMDI6MDB-czoyMDIxXzgzXzM2XzRfMDAxMl8wMDAwMzk5OA%3D%3D","method":"GET"}],"context":{"returned":1,"limit":1,"matched":5}}
iamfrank commented 2 years ago

According to the API team, this is a feature, not a bug. Images are supposedly cropped to appear rectangular. If this is the case, it would be useful with some other way to get the actual extent of the image.

OR, as an alternative, be able to sort a list of features on the request's intersection point's closeness to image center.

AsgerPetersen commented 2 years ago

The image itself is not cropped at all. The footprint should represent the coverage of the image as closely as possible, but inaccuracies at the edges are inevitable. These inaccuracies come from inaccuracies in the camera position and angles, inaccuracies in the terrain model. Also occlusions from for instance buildings may reduce or extend the area which is actually visible in the image compared to the footprint.

iamfrank commented 2 years ago

The image itself is not cropped at all. The footprint should represent the coverage of the image as closely as possible, but inaccuracies at the edges are inevitable. These inaccuracies come from inaccuracies in the camera position and angles, inaccuracies in the terrain model. Also occlusions from for instance buildings may reduce or extend the area which is actually visible in the image compared to the footprint.

Message received. I'll close this issue and concentrate on working on a solution to avoid acting at the edge of images.