Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement geo upload #47

Open
wants to merge 242 commits into
base: master
Choose a base branch
from
Open

Implement geo upload #47

wants to merge 242 commits into from

Conversation

mtiessen1175
Copy link
Collaborator

@mtiessen1175 mtiessen1175 commented Nov 30, 2023

references #44

Implement the structure for the upload mechanism in the volume-edit view. Allow the upload of both - browsing layers and context layers - i.e. upload of geoTIFF and (iFDO) metadata, linkage of WMS.

  • Additional layers can be added in the volume edit view
  • An additional layer can be a georeferenced file (geoTIFF) or a link to a WMS source
    • geoTIFF upload done (but should be tested more thoroughly by adding more example .tif files, e.g. a geoTIFF using the ModelTransformationTag. Corresponding code implemented here. Update: Tests fully cover this case; see commits cafb808 and bb6b2c6)
    • WMS
  • Layers can be ordered in the volume edit view
  • Each layer can either be a "browsing layer" (Geospatial browsing visualisation #44) or a "context layer" or both
  • The filter-map shows all configured "browsing" layers
  • Option to upload the full image extent as metadata (also from iFDO, see Geospatial context fusion display #45)

associated PR's:

  • #725 in biigle/core
  • #761 in biigle/core

Base automatically changed from browsing_vis to master December 8, 2023 14:43
@mtiessen1175 mtiessen1175 marked this pull request as ready for review October 17, 2024 15:14
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I upload a GeoTIFF, I get JS errors (see below). The upload seems to succeed, though.

When I upload the DEM_Rest_2014 file (you sent me?), I can't find it at the same location than QGIS tells me. Also, the tile files produced by Vips are binary (i.e. only #000 and #FFF colors).

Do you have a WMS for me to test?

14:31:59.876 [Vue warn]: $listeners is readonly.

found in

---> <Portal>
       <Tab>
         <Tabs>
           <Root> volumes.js:3924:15
14:32:01.063 [Vue warn]: $attrs is readonly.

found in

---> <Portal>
       <Tab>
         <Tabs>
           <Root> 2 volumes.js:3924:15
14:32:01.094 Uncaught (in promise) TypeError: callback.call is not a function
    finally http://localhost:8000/assets/scripts/main.js?1729685278:133407
    promise callback*./node_modules/vue-resource/dist/vue-resource.esm.js/p$1.then http://localhost:8000/assets/scripts/main.js?1729685278:133394
    finally http://localhost:8000/assets/scripts/main.js?1729685278:133406
    uploadGeoTiff http://localhost:8000/vendor/geo/scripts/volumes.js?1729686705:15985
    invokeWithErrorHandling http://localhost:8000/assets/scripts/main.js?1729685278:136516
    invoker http://localhost:8000/assets/scripts/main.js?1729685278:136841
    _wrapper http://localhost:8000/assets/scripts/main.js?1729685278:142244
    add$1 http://localhost:8000/assets/scripts/main.js?1729685278:142248
    updateListeners http://localhost:8000/assets/scripts/main.js?1729685278:136873
    updateDOMListeners http://localhost:8000/assets/scripts/main.js?1729685278:142278
    invokeCreateHooks http://localhost:8000/assets/scripts/main.js?1729685278:140759
    createElm http://localhost:8000/assets/scripts/main.js?1729685278:140646
    createChildren http://localhost:8000/assets/scripts/main.js?1729685278:140743
    createElm http://localhost:8000/assets/scripts/main.js?1729685278:140644
    createChildren http://localhost:8000/assets/scripts/main.js?1729685278:140743
    createElm http://localhost:8000/assets/scripts/main.js?1729685278:140644
    createChildren http://localhost:8000/assets/scripts/main.js?1729685278:140743
    createElm http://localhost:8000/assets/scripts/main.js?1729685278:140644
    patch http://localhost:8000/assets/scripts/main.js?1729685278:141167
    _update http://localhost:8000/assets/scripts/main.js?1729685278:138608
    updateComponent http://localhost:8000/assets/scripts/main.js?1729685278:138729
    get http://localhost:8000/assets/scripts/main.js?1729685278:139143
    Watcher http://localhost:8000/assets/scripts/main.js?1729685278:139132
    mountComponent http://localhost:8000/assets/scripts/main.js?1729685278:138736
    $mount http://localhost:8000/assets/scripts/main.js?1729685278:143742
    $mount http://localhost:8000/assets/scripts/main.js?1729685278:146656
    init http://localhost:8000/assets/scripts/main.js?1729685278:137788
    createComponent http://localhost:8000/assets/scripts/main.js?1729685278:140668
    createElm http://localhost:8000/assets/scripts/main.js?1729685278:140615
    createChildren http://localhost:8000/assets/scripts/main.js?1729685278:140743
    createElm http://localhost:8000/assets/scripts/main.js?1729685278:140644
    patch http://localhost:8000/assets/scripts/main.js?1729685278:141167
    _update http://localhost:8000/assets/scripts/main.js?1729685278:138608
    updateComponent http://localhost:8000/assets/scripts/main.js?1729685278:138729
    get http://localhost:8000/assets/scripts/main.js?1729685278:139143
    Watcher http://localhost:8000/assets/scripts/main.js?1729685278:139132
    mountComponent http://localhost:8000/assets/scripts/main.js?1729685278:138736
main.js:133407:14

Comment on lines 27 to 30
getGeoTiffOverlayUrlTemplate: {
method: 'GET',
url: 'api/v1/volumes{/id}/geo-overlays/geotiff/url',
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
getGeoTiffOverlayUrlTemplate: {
method: 'GET',
url: 'api/v1/volumes{/id}/geo-overlays/geotiff/url',
},

let data = new FormData();
data.append('geotiff', event.target.files[0]);
data.append('volumeId', this.volumeId);
this.upload(data)
.then(this.handleSuccess, this.handleError)
.finally(this.finishLoading);
.finally(this.$emit('upload', false));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.finally(this.$emit('upload', false));
.finally(() => this.$emit('upload', false));

let data = new FormData();
data.append('url', event.target[0].value);
data.append('volumeId', this.volumeId);
geoApi.saveWebMap({id: this.volumeId}, data)
.then(this.handleSuccess, this.handleError)
.finally(this.finishLoading)
.finally(this.$emit('upload', false))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.finally(this.$emit('upload', false))
.finally(() => this.$emit('upload', false))

@@ -11,13 +11,13 @@ export default {
},
mixins: [
LoaderMixin,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need the mixin any more?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need the LoaderMixin any more?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The panel would look better if you disable the margin-bottom of the <ul> or <table> at the bottom. Otherwise there is a strange gap.

<template>
<div class="table-responsive">
<table v-if="overlays.length !== 0" class="table table-sm" v-cloak>
<caption><b><slot name="title"></slot></b></caption>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a caption, really. The panel in the volume edit view already has a title.

Comment on lines 10 to 12
<div class="alert alert-success" v-if="success" v-cloak>
The geoTIFF-file was successfully uploaded.
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the highlighted element in the table below is enough of a success indication. No need for an additional message.

Comment on lines 24 to 26
<div class="alert alert-success" v-if="success" v-cloak>
The web-map-service was successfully embedded.
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same than above.

</span>
</td>
<td>
<button type="button" class="close" :title="title" v-on:click="remove" v-once><span aria-hidden="true">&times;</span></button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please center this in the column?

@mtiessen1175
Copy link
Collaborator Author

When I upload a GeoTIFF, I get JS errors (see below). The upload seems to succeed, though.

I get it as well, I'll have a look where it comes from.

When I upload the DEM_Rest_2014 file (you sent me?), I can't find it at the same location than QGIS tells me.

This is most certainly due to the transformation error in the proj4php package, as discussed here.

Also, the tile files produced by Vips are binary (i.e. only #000 and #FFF colors).

Yes, I created a normalization of the color-band (as geoTIFF's often contain more color-information that can be set/adjusted manually by the user). So the discussed solution for now was to normalize the color-band to 0 - 255 in case it differs from that range (see code).

@mzur
Copy link
Member

mzur commented Oct 23, 2024

This is most certainly due to the transformation error in the proj4php package, as discussed #47 (comment).

Did you find the overlay? Where do I have to look? 😃

Yes, I created a normalization of the color-band (as geoTIFF's often contain more color-information that can be set/adjusted manually by the user). So the #47 (comment) solution for now was to normalize the color-band to 0 - 255 in case it differs from that range (see code).

I saw that but I expected this to produce something else than the black/white image. There is no 0-255 range in the tiled image, just 0 and 255.

@mtiessen1175
Copy link
Collaborator Author

Did you find the overlay? Where do I have to look? 😃

Ahh, yeah it is a fairly small example-TIFF! The coordinates in EPSG:3857 are: -325165.2, 7779955.1 (Loch Davan close to Dinnet, Scotland)

I saw that but I expected this to produce something else than the black/white image. There is no 0-255 range in the tiled image, just 0 and 255.

I see, so I should check what goes wrong in the normalization.

@mtiessen1175
Copy link
Collaborator Author

I saw that but I expected this to produce something else than the black/white image. There is no 0-255 range in the tiled image, just 0 and 255.

I see, so I should check what goes wrong in the normalization.

The formula used for image normalization should be working. It seems that the derived min- and max-values from libvips are not providing the correct min/max colour-band values as I expected them to be (i.e. they are different to what I see in the QGIS colour settings). Moreover, I tested with two different geoTIFF's and surprisingly the min/max of the two geoTIFF's were identical (min: -3.4028230607371E+38, max: 162.15870666504).
So I need to find a different approach to get the min/max colour-value information from the image.

@mzur
Copy link
Member

mzur commented Oct 31, 2024

You should try it with the Vips CLI too. If this does not show the expected values you can ask in the Vips repo. The maintainer is extremely responsive and helpful if you provide a good description of the problem and an example file.

@mtiessen1175
Copy link
Collaborator Author

You should try it with the Vips CLI too. If this does not show the expected values you can ask in the Vips repo. The maintainer is extremely responsive and helpful if you provide a good description of the problem and an example file.

I tried with the CLI and get the correct max() value but an incorrect min(). This must be due to the NoData values of the geoTIFF images (the black frame around the geoTIFF when converting it to an image). So the min() always returns this value (e.g. -99999) instead of the desired min-value (e.g. -4123.31).

@mzur
Copy link
Member

mzur commented Nov 5, 2024

(please use @mzur, otherwise I don't get notified of activity here)

If this can be fixed by creating the geoTIFF in any other way then we could add an explanation to the manual and just expect geoTIFFs with the correct format. Then there is no need for special handling of edge cases (for now).

@mzur
Copy link
Member

mzur commented Nov 6, 2024

I tested the WMS now and it works fine.

I noticed an error on the geo map of a volume (not the map in the filter modal). When I open the label trees tab there, it says Error in event handler for "sidebar.toggle": "TypeError: this.map is undefined".

@mtiessen1175
Copy link
Collaborator Author

@mzur,

If this can be fixed by creating the geoTIFF in any other way then we could add an explanation to the manual and just expect geoTIFFs with the correct format. Then there is no need for special handling of edge cases (for now).

I've implemented the color normalization such that NoData values of -99999 will get excluded in order to calculate the true min (see conversation on libvips discussion). I therefore would add an excerpt to the manual stating that color-band normalization should either be done beforehand or the NoData values of the geoTIFF should be set to -99999 in order to be handled correctly by BIIGLE.

@mzur
Copy link
Member

mzur commented Nov 12, 2024

Sounds good 👍

@mtiessen1175
Copy link
Collaborator Author

@mzur,

I noticed an error on the geo map of a volume (not the map in the filter modal). When I open the label trees tab there, it says Error in event handler for "sidebar.toggle": "TypeError: this.map is undefined".

That's fixed now.

When I upload a GeoTIFF, I get JS errors (see below). The upload seems to succeed, though.

14:31:59.876 [Vue warn]: $listeners is readonly.

found in

---> <Portal>
       <Tab>
         <Tabs>
           <Root> volumes.js:3924:15 

Regarding the latter, I tried to find where the warning is coming from by debugging the code, but I couldn't figure out what causes it. It is still unclear to me...

  1. where the readonly is allegedly violated and
  2. to what kind of object the attributes refer to

I looked into the whole upload process of the geoTIFF files, comprised of:

and

commenting lines step by step to see where the warning stems from, but it's still not obvious to me. Do you have any idea or instinct what could cause such warning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Geospatial browsing visualisation
2 participants