Difference between revisions of "Tratamento de imagens Sentinel"

From Geomaster, Lda
Jump to navigation Jump to search
(Created page with " http://copernicus.eu/news/copernicus-free-open-source-community https://medium.com/sentinel-hub/control-sentinel-hub-from-within-qgis-2a83eb7f13db")
 
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
== Sinergise Sentinel Hub==
 +
 +
Sinergise is headquartered in Ljubljana, Slovenia
  
 
http://copernicus.eu/news/copernicus-free-open-source-community
 
http://copernicus.eu/news/copernicus-free-open-source-community
  
 
https://medium.com/sentinel-hub/control-sentinel-hub-from-within-qgis-2a83eb7f13db
 
https://medium.com/sentinel-hub/control-sentinel-hub-from-within-qgis-2a83eb7f13db
 +
 +
Criar uma conta
 +
 +
Entrar em https://www.sentinel-hub.com/ e criar uma conta.
 +
 +
https://www.sentinel-hub.com/
 +
 +
[[File:Sentinel configurator instance id.png]]
 +
 +
== Sentinel 2 ==
 +
 +
Bibliografia:
 +
 +
* http://qgis.pt/blog/2016/12/14/detecao-remota-com-o-qgis/
 +
* https://sentinel.esa.int/web/sentinel/technical-guides/sentinel-2-msi/level-1c/algorithm
 +
* http://semiautomaticclassificationmanual-v4.readthedocs.io/en/latest/remote_sensing.html
 +
* http://step.esa.int/main/third-party-plugins-2/sen2cor/
 +
 +
=== Parte 1 ===
 +
 +
Criar conta
 +
 +
Download imagens através de: maps.mundialis.de + portal
 +
 +
S2A_OPER_PRD_MSIL1C_PDMC_20161011T163333_R080_V20161010T113312_20161010T113455.zip
 +
 +
Extrair ficheiros
 +
 +
[[File:Pasta imagens sentinel-2.png]]
 +
 +
=== Parte 2 ===
 +
 +
CAOP
 +
* Concelho de Estarreja
 +
* Buffer 500m à volta de Estarreja
 +
 +
=== Parte 3 ===
 +
 +
==== Recortar as imagens para o concelho de Estarreja ====
 +
 +
Com o plugin SCP → Preprocessing → Clip multiple rasters
 +
* Eventualmente, atualizar a lista de raster clicando no botão de refresh
 +
* Selecionar todos os rasters
 +
* Use shapefile for clipping (escolher a camada com o beuffer calculado previamente)
 +
 +
[[File:Recortar imagens sentinel-2 com um poligono.png]]
 +
 +
* Guardar as imagens na pasta S2A_OPER_PRD_MSIL1C_PDMC_20161011T163333_R080_V20161010T113312_20161010T113455.SAFE/GRANULE/S2A_OPER_MSI_L1C_TL_MTI__20161011T141846_A006798_T29TNF_N02.04/IMG_DATA_ESTARREJA, ao mesmo nível da pasta IMG_DATA
 +
 +
[[File:Pasta com imagens recortadas.png]]
 +
 +
Organizar as camadas do QGIS, com dois grupos:
 +
* imagens sentinel-2 originals (antes do clicp)
 +
* imagens sentinel-2 da área do concelho (após o clip)
 +
 +
[[File:Imagens sentinel recortadas.png]]
 +
 +
==== Correção da refletância ====
 +
 +
Sensors measure the radiance, which corresponds to the brightness in a given direction toward the sensor; it useful to define also the reflectance as the ratio of reflected versus total power energy.
 +
 +
As imagens Sentinel-2 indicam os valor da refletância no topo da atmosfera, com um dado fator de escala. É preciso corrigir esses valores para a refletância na base da atmosfera (correção atmosférica).
 +
 +
Nota: Em alterativa, usar o [http://step.esa.int/main/third-party-plugins-2/sen2cor/ sen2cor] para correções mais precisas.
 +
 +
[[File:Correcao atmosferica.png]]
 +
 +
Cálculo da refletância com o Plugin SCP:
 +
* Preprocessing → Sentinel-2
 +
* Selecionar pasta com imagens (a pasta IMG_DATA_ESTARREJA)
 +
* Selecionar metadata
 +
 +
[[File:Sentinel-2 metadata.png]]
 +
 +
* Apply DOS1 atmospheric correction
 +
* Create Band set and use Band set tools
 +
* Correr e criar uma nova pasta REFLETANCIA para guardar o resultado
 +
 +
[[File:Pasta refletancia.png]]
 +
 +
==== Organizar as camadas QGIS ====
 +
 +
Criar grupo com as bandas criadas(que começam por RT_clip_)
 +
 +
Confirmar que os valores são números muito pequenos, entre 0 e 1
 +
 +
=== Parte 4: Visualização ===
 +
 +
Plugin SCP → Band set
 +
 +
Selecionar as bandas RT_clip... 2, 3, 4, 5, 6, 7, 8, 8A, 11 e 12, por esta ordem
 +
 +
Quick wavelength setting: Escolher Sentinel-2 [bands 2, 3, 4, 5, 6, 7, 8, 8A, 11, 12]
 +
 +
Create virtual raster band set
 +
 +
Gravar na pasta Sentinel
 +
 +
É criada a camada RT_clip_S2A_OPER_MSI_L1C_TL_MTI__20161011T141846_A006798_T29TNF_B0virt_rast.vrt
 +
 +
==== Organizar as camadas do QGIS ====
 +
 +
==== Outras visualizações ====
 +
 +
Na barra do plugin, em RGB, escolher a visualização 3-2-1, só com as bandas RGB. É a imagem mais parecida com o que o olho humano veria do satélite.
 +
 +
[[File:Visualizacao RGB de uma imagem sentinel-2 de estarreja.png]]
 +
 +
Na barra do plugin, em RGB, escolher a visualização 7-3-2 (escrever na barra 7-3-2, pois pode não estar disponível nas opções). É uma visualização falsa cor, que torna a clorofila o mais visível.
 +
 +
[[File:Visualizacao falsa cor de uma imagem sentinel-2 de estarreja.png]]
 +
 +
==== Visualização terra/água ====
 +
 +
Cf. maps.mundialis.de
 +
 +
camadas: Land/Water
 +
 +
False Color useful for discriminating land and water (RGB = 8A 11 4) → (8, 9, 3)
 +
 +
=== Parte 5: Classificação não supervisionada por clusters ===
 +
 +
=== Old ===
 +
 +
[[File:Captura de ecrã de 2016-12-13 12-51-19.png]]
 +
 +
=== Command line ===
 +
 +
<syntaxhighlight language="bash">
 +
wget --no-check-certificate --user=jgrocha --password=copernicus --output-document=query_results.txt "https://scihub.copernicus.eu/dhus/search?q=*&rows=25"
 +
https://scihub.copernicus.eu/apihub
 +
</syntaxhighlight>
 +
 +
 +
<syntaxhighlight language="bash">
 +
wget --no-check-certificate --user=jgrocha --password=copernicus --output-document=query_results.txt "https://scihub.copernicus.eu/dhus/search?q=ingestiondate:[NOW-1DAY TO NOW] AND producttype:SLC&rows=100&start=0&format=json"
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight language="bash">
 +
wget --user=jgrocha --password=copernicus --output-document=query_results.txt 'https://scihub.copernicus.eu/dhus/search?q=footprint:"Intersects(POLYGON((-4.53%2029.85,26.75%2029.85,26.75%2046.80,-4.53%2046.80,-4.53%2029.85)))"'
 +
</syntaxhighlight>
 +
 +
 +
wget --user=jgrocha --password=copernicus https://scihub.copernicus.eu/dhus/odata/v1/Products('62efa1fa-e60d-49f1-b06c-720a0b314326')/$value
 +
 +
wget --no-check-certificate --continue --user=jgrocha --password=copernicus "https://scihub.copernicus.eu/dhus/odata/v1/Products('62efa1fa-e60d-49f1-b06c-720a0b314326')/$value"
 +
 +
curl -g -f -s -S -k --user jgrocha:copernicus --cookie-jar ./cookie "https://scihub.copernicus.eu/dhus/odata/v1/Products('62efa1fa-e60d-49f1-b06c-720a0b314326')/\$value"
 +
 +
curl -JO --user jgrocha:copernicus --cookie-jar ./cookie "https://scihub.copernicus.eu/dhus/odata/v1/Products('62efa1fa-e60d-49f1-b06c-720a0b314326')/\$value"
 +
 +
http://www.qgistutorials.com/en/index.html
 +
 +
http://www.qgistutorials.com/en/docs/downloading_osm_data.html
 +
 +
== Adicionar camadas ao Geoserver ==
 +
 +
Instalar a extensão Importer do Geoserver
 +
 +
No servidor:
 +
 +
<syntaxhighlight lang="json">
 +
{
 +
  "import": {
 +
      "targetWorkspace": {
 +
        "workspace": {
 +
            "name": "cm-agueda"
 +
        }
 +
      },
 +
      "data": {
 +
        "type": "directory",
 +
        "location": "/home/jgr/geoserver_data_dir/sentinel"
 +
      }
 +
  }
 +
}
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang="bash">
 +
curl -u admin:geomaster2k14 -XPOST -H "Content-type: application/json" -d @import.json "https://server.geomaster.pt:8443/geoserver/rest/imports"
 +
curl -u admin:geomaster2k14 -XPOST "https://server.geomaster.pt:8443/geoserver/rest/imports/2"
 +
curl -u admin:geomaster2k14 -XGET "https://server.geomaster.pt:8443/geoserver/rest/imports/2"
 +
</syntaxhighlight>
 +
 +
== Instalação em Windows ==
 +
 +
=== Testar se já está instalado ===
 +
 +
<syntaxhighlight lang="python">
 +
Python Console
 +
Use iface to access QGIS API interface or Type help(iface) for more info
 +
import scipy;
 +
print scipy.__version__
 +
0.14.0
 +
</syntaxhighlight>
 +
 +
https://nathanw.net/2012/12/19/installing-python-setuptools-into-osgeo4w-python/
 +
 +
http://peak.telecommunity.com/dist/
 +
 +
Download ez_setup.py
 +
 +
Run OSGeo4W Console as Administrator
 +
 +
<syntaxhighlight lang="bash">
 +
cd \Users\Jorge\Downloads
 +
python ez_setup.py
 +
 +
easy_install scipy
 +
</syntaxhighlight>

Latest revision as of 05:27, 11 June 2018

Sinergise Sentinel Hub

Sinergise is headquartered in Ljubljana, Slovenia

http://copernicus.eu/news/copernicus-free-open-source-community

https://medium.com/sentinel-hub/control-sentinel-hub-from-within-qgis-2a83eb7f13db

Criar uma conta

Entrar em https://www.sentinel-hub.com/ e criar uma conta.

https://www.sentinel-hub.com/

Sentinel configurator instance id.png

Sentinel 2

Bibliografia:

Parte 1

Criar conta

Download imagens através de: maps.mundialis.de + portal

S2A_OPER_PRD_MSIL1C_PDMC_20161011T163333_R080_V20161010T113312_20161010T113455.zip

Extrair ficheiros

File:Pasta imagens sentinel-2.png

Parte 2

CAOP

  • Concelho de Estarreja
  • Buffer 500m à volta de Estarreja

Parte 3

Recortar as imagens para o concelho de Estarreja

Com o plugin SCP → Preprocessing → Clip multiple rasters

  • Eventualmente, atualizar a lista de raster clicando no botão de refresh
  • Selecionar todos os rasters
  • Use shapefile for clipping (escolher a camada com o beuffer calculado previamente)

File:Recortar imagens sentinel-2 com um poligono.png

  • Guardar as imagens na pasta S2A_OPER_PRD_MSIL1C_PDMC_20161011T163333_R080_V20161010T113312_20161010T113455.SAFE/GRANULE/S2A_OPER_MSI_L1C_TL_MTI__20161011T141846_A006798_T29TNF_N02.04/IMG_DATA_ESTARREJA, ao mesmo nível da pasta IMG_DATA

File:Pasta com imagens recortadas.png

Organizar as camadas do QGIS, com dois grupos:

  • imagens sentinel-2 originals (antes do clicp)
  • imagens sentinel-2 da área do concelho (após o clip)

File:Imagens sentinel recortadas.png

Correção da refletância

Sensors measure the radiance, which corresponds to the brightness in a given direction toward the sensor; it useful to define also the reflectance as the ratio of reflected versus total power energy.

As imagens Sentinel-2 indicam os valor da refletância no topo da atmosfera, com um dado fator de escala. É preciso corrigir esses valores para a refletância na base da atmosfera (correção atmosférica).

Nota: Em alterativa, usar o sen2cor para correções mais precisas.

File:Correcao atmosferica.png

Cálculo da refletância com o Plugin SCP:

  • Preprocessing → Sentinel-2
  • Selecionar pasta com imagens (a pasta IMG_DATA_ESTARREJA)
  • Selecionar metadata

File:Sentinel-2 metadata.png

  • Apply DOS1 atmospheric correction
  • Create Band set and use Band set tools
  • Correr e criar uma nova pasta REFLETANCIA para guardar o resultado

File:Pasta refletancia.png

Organizar as camadas QGIS

Criar grupo com as bandas criadas(que começam por RT_clip_)

Confirmar que os valores são números muito pequenos, entre 0 e 1

Parte 4: Visualização

Plugin SCP → Band set

Selecionar as bandas RT_clip... 2, 3, 4, 5, 6, 7, 8, 8A, 11 e 12, por esta ordem

Quick wavelength setting: Escolher Sentinel-2 [bands 2, 3, 4, 5, 6, 7, 8, 8A, 11, 12]

Create virtual raster band set

Gravar na pasta Sentinel

É criada a camada RT_clip_S2A_OPER_MSI_L1C_TL_MTI__20161011T141846_A006798_T29TNF_B0virt_rast.vrt

Organizar as camadas do QGIS

Outras visualizações

Na barra do plugin, em RGB, escolher a visualização 3-2-1, só com as bandas RGB. É a imagem mais parecida com o que o olho humano veria do satélite.

File:Visualizacao RGB de uma imagem sentinel-2 de estarreja.png

Na barra do plugin, em RGB, escolher a visualização 7-3-2 (escrever na barra 7-3-2, pois pode não estar disponível nas opções). É uma visualização falsa cor, que torna a clorofila o mais visível.

File:Visualizacao falsa cor de uma imagem sentinel-2 de estarreja.png

Visualização terra/água

Cf. maps.mundialis.de

camadas: Land/Water

False Color useful for discriminating land and water (RGB = 8A 11 4) → (8, 9, 3)

Parte 5: Classificação não supervisionada por clusters

Old

File:Captura de ecrã de 2016-12-13 12-51-19.png

Command line

wget --no-check-certificate --user=jgrocha --password=copernicus --output-document=query_results.txt "https://scihub.copernicus.eu/dhus/search?q=*&rows=25"
https://scihub.copernicus.eu/apihub


wget --no-check-certificate --user=jgrocha --password=copernicus --output-document=query_results.txt "https://scihub.copernicus.eu/dhus/search?q=ingestiondate:[NOW-1DAY TO NOW] AND producttype:SLC&rows=100&start=0&format=json"
wget --user=jgrocha --password=copernicus --output-document=query_results.txt 'https://scihub.copernicus.eu/dhus/search?q=footprint:"Intersects(POLYGON((-4.53%2029.85,26.75%2029.85,26.75%2046.80,-4.53%2046.80,-4.53%2029.85)))"'


wget --user=jgrocha --password=copernicus https://scihub.copernicus.eu/dhus/odata/v1/Products('62efa1fa-e60d-49f1-b06c-720a0b314326')/$value

wget --no-check-certificate --continue --user=jgrocha --password=copernicus "https://scihub.copernicus.eu/dhus/odata/v1/Products('62efa1fa-e60d-49f1-b06c-720a0b314326')/$value"

curl -g -f -s -S -k --user jgrocha:copernicus --cookie-jar ./cookie "https://scihub.copernicus.eu/dhus/odata/v1/Products('62efa1fa-e60d-49f1-b06c-720a0b314326')/\$value"

curl -JO --user jgrocha:copernicus --cookie-jar ./cookie "https://scihub.copernicus.eu/dhus/odata/v1/Products('62efa1fa-e60d-49f1-b06c-720a0b314326')/\$value"

http://www.qgistutorials.com/en/index.html

http://www.qgistutorials.com/en/docs/downloading_osm_data.html

Adicionar camadas ao Geoserver

Instalar a extensão Importer do Geoserver

No servidor:

{
   "import": {
      "targetWorkspace": {
         "workspace": {
            "name": "cm-agueda"
         }
      },
      "data": {
        "type": "directory",
        "location": "/home/jgr/geoserver_data_dir/sentinel"
      }
   }
}
curl -u admin:geomaster2k14 -XPOST -H "Content-type: application/json" -d @import.json "https://server.geomaster.pt:8443/geoserver/rest/imports"
curl -u admin:geomaster2k14 -XPOST "https://server.geomaster.pt:8443/geoserver/rest/imports/2"
curl -u admin:geomaster2k14 -XGET "https://server.geomaster.pt:8443/geoserver/rest/imports/2"

Instalação em Windows

Testar se já está instalado

Python Console 
Use iface to access QGIS API interface or Type help(iface) for more info
import scipy;
print scipy.__version__
0.14.0

https://nathanw.net/2012/12/19/installing-python-setuptools-into-osgeo4w-python/

http://peak.telecommunity.com/dist/

Download ez_setup.py

Run OSGeo4W Console as Administrator

cd \Users\Jorge\Downloads
python ez_setup.py 

easy_install scipy