Skip to content

Examples of using the API in QGIS

Flow of how to use the API in QGIS

  1. Launch QGIS on your computer.
  2. Click Browser → XYZ tiles → OpenStreetMap to fix CRS (Coordinate Reference System) to EPSG3857 and to detect bounding box.
  3. Zoom up/down to set your region of interest.
  4. Open Plugins → Python Console.
  5. In Python console, click Show Editor icon to open editor.
  6. In editor window, make a new script or open your Python script.
  7. Execute your Python script by clicking Run Script icon.

Get and show an image in QGIS

Check the location of the installed module:

pip show jaxa.earth

The location will be similar to:

C:\users\UserName\appdata\local\packages\...\site-packages

If you have not installed the module, add the path to the unzipped folder:

import sys
sys.path.append("C://YOUR-FOLDER-PATH/jaxa-earth-0.1.6")

Note

Use / instead of \\ in module path text.

Instead of show_images, use show_images_qgis in QGIS to acquire raster files. The raster files are saved in a temporary folder — quit QGIS with saving to keep the data.

import sys
sys.path.append("C://YOUR-FOLDER-PATH/jaxa-earth-0.1.4")

from jaxa.earth import je

# Get an image (ppu and bbox are auto-detected from the QGIS view if omitted)
data = je.ImageCollection(ssl_verify=True) \
         .filter_date() \
         .filter_resolution() \
         .filter_bounds() \
         .select() \
         .get_images()

# Show in QGIS as a raster layer
img = je.ImageProcess(data) \
        .show_images_qgis()

FigureQGIS01

Warning

show_images_qgis is only valid in a QGIS Python Console environment.