EOxServer / eoxserver

EOxServer is a Python application and framework for presenting Earth Observation (EO) data and metadata.
https://eoxserver.org
Other
40 stars 18 forks source link

RGB with 3 bands failed #428

Open Mikiya83 opened 4 years ago

Mikiya83 commented 4 years ago

Sorry to spam issues recently.

I have a problem to display an RGB GTiff. Docs i can found talks about "range type", and coverage type seems to replace it but options are not exactly the same.... I created an "RGB" coverage type with field 0 as "Red" (UInt16), 1 as "Green" (UInt16) , 2 as "Blue" (UInt16). I tried with fields index 1,2,3 also, without succeed. I merged 3 Landsat bands (4 3 2) with gdalmerge to have an RGB Gtiff with 3 bands. I register this Gtiff as coverage with coverage type "RGB". In admin panel, i can see "bands count = 3", "field index =0", "bands interpretation = fields". When i open it with openev, it's in RGB as expected, but when i open it in Web Client, it's only a white image :(

Whad did i miss ?

Thanks again

constantinius commented 4 years ago

This may be due to the fact that the values are scaled quite differently. Pure RGB values are between 0 and 255, but Landsat has a Uint 16 data type which has a very different range of values.

You can adjust the rendering range using the values range parameter in the browse type fields.

For this to work you need to properly set up a coverage type, a product type with a browse type:

To create a product type do the following (link it to the RGB coverage type as-well):

python manage.py producttype create MyProductType -c RGB

Now create a browse type (with default name):

python manage.py browsetype create MyProductType \
        --red "Red" \
        --green "Green" \
        --blue "Blue" \
        --red-range 1 3000 \
        --green-range 1 3000 \
        --blue-range 1 3000 \
        --red-nodata 0 \
        --green-nodata 0 \
        --blue-nodata 0

You can adjust the ranges in the admin client afterwards to play around and see what appropriate values are.

Now create a product with the aforementioned product type:

python manage.py product register -t MyProductType -i MyProduct

When you re-register your coverage

python manage.py coverage register \
    # ... your values from before
     --replace \
     --product MyProduct

Now you should be able to see the rendered product in the Web Client.

Mikiya83 commented 4 years ago

Ok i see the idea. But i just try it in this order :

RGB coverage type is from json file in autotest, i just change "red" identifier to "Red", ect....

And i still get a white image, i just notice some pink or blue pixels at the border.

layer

rgb

PS : i also tried to adjust max range in browsetype according to max values get by gdalinfo -mm, without succeed.

Mikiya83 commented 4 years ago

Does the name of the properties in browsetype ( --green "Green" for example) has to match exactly with values in field "identifier" in the RGB coverage type ? I cannot get a colored image for now.

constantinius commented 4 years ago

Yes, this has to be the exact identifier. So it should be Green as you already do.

You are using the web client interface, so I'm not sure if you actually see the correct layers.

Maybe you can try to use QGis or a similar client?

Mikiya83 commented 4 years ago

Hi I try multiple combinations of images and everytime i use Int16 (or UInt16), i can't get a working image by WMS requests in web client or QGIS client. The only solution i find is to translate it to Byte values, but i lost info so it's not a very good one. I even try to import a single band (for example B02 for a Sentinel2 image, or B02 of Landsat8), and it's not working. Do you have any idea ? Thanks

constantinius commented 4 years ago

@Mikiya83

I'm sorry for your troubles setting this up. Currently both the webclient and the services documentation are in transition, so I guess it is frustrating to get the service running.

First off: the webclient images you show are from the old version. This lacks some features and you will likely not get any decent results from that. Using the QGIS as a WMS client is more suitable, as you can actually select all the available layers so it is better to use that.

To help out I think I need more information of what you actually did.

I'll try to quickly explain the concepts involved, so maybe you have a better understanding of how to solve the issue.

I'll begin top down with the "Type" models: there is the CoverageType and the ProductType (and also the CollectionType if you use Collections). Each Coverage is associated with a CoverageType as is each Product with a ProductType (and also Collection with CollectionType, you get the idea).

The Coverage serves as a more raw data source and the CoverageType as a description of said data.

The Product combines multiple Coverages to a single entity and adds additional information in the shape of Browses and Masks. Browses are important here, as they give you a "view" into the coverage data which may not be visual. Here you have basically two options:

Example:

Say for instance you have a ProductType "PT" that has four CoverageTypes with each a single band: CT1 (band: red), CT2 (green), CT3 (blue) and CT4 (nir) all in Uint 16.

For the ProductType you can create three BrowseTypes:

Now you register a Product "P1" associated with the above ProductType and register four Coverages: C1, C2, C3 and C4

In WMS you should now see the root layer P1 with a couple of sub layers: P1__outlines, P1__outlined, P1__TRUE_COLOR, P1__FALSE_COLOR and P1__NDVI (and possibly more).

If you access one of these: P1__TRUE_COLOR, P1__FALSE_COLOR and P1__NDVI in QGIS, you should see something visible.

You can now also create a CollectionType "CT1" referencing the ProductType above. Now you can create a collection CO1 and insert the P1 Product from above (and many more). Now there should be the same layers as above just with CO1.

Please let me know if was helpful.