Use GDAL/OGR for raster/vector operations - osgeo
Recorded lecture: 1:28:45 - 2:19:43
Setting working directory for the OSGeoLive
GDAL is a translator library for raster and vector geospatial data formats that is released under an X/MIT style Open Source License by the Open Source Geospatial Foundation. As a library, it presents a single raster abstract data model and single vector abstract data model to the calling application for all supported formats. It also comes with a variety of useful command line utilities for data translation and processing (source https://gdal.org/).
Open the bash terminal, migrate in the directory, and open the jupter-notebook.ipynb
cd /media/sf_LVM_shared/my_SE_data/exercise
jupyter-lab gdal_osgeo.ipynb
We are going to use the jupyter-notebook as an editor for running gdal commands. The beauty of using gdal in the bash environment is that we can combine it with other bash utilities such awk, sed, and other.
Start to use GDAL commands
Explor the files
Change directory and list all the files with the extension .tif
[2]:
!ls /media/sf_LVM_shared/my_SE_data/exercise/geodata/*/*.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/cloud/SA_intra.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/cloud/SA_meanannual.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/dem/GMTED2010.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/dem/SA_all_dep_1km.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/dem/SA_are_1km_msk.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/dem/SA_elevation_mn_GMTED2010_mn_msk.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/dem/SA_elevation_mn_GMTED2010_mn.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/875_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/876_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/877_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/878_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/879_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/880_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/881_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/882_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/883_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/884_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/885_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/886_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/887_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/888_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/889_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/890_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/891_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/892_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/893_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/894_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/895_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/896_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/897_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/898_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/899_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/900_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/901_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/902_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/903_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/904_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/905_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/906_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/907_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/908_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/909_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/910_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/911_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/912_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/913_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/914_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/915_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/916_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/917_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/918_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/919_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/920_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/921_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/922_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/923_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/924_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/925_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/926_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/927_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/928_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/929_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/930_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/931_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/932_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/933_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/934_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/935_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/936_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/937_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/938_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/939_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/940_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/941_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/942_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/glad_ard/943_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/landsat_ct/071W_41N_med_B1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/landsat_ct/071W_42N_med_B1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/landsat_ct/072W_40N_med_B1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/landsat_ct/072W_41N_med_B1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/landsat_ct/072W_42N_med_B1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/landsat_ct/073W_40N_med_B1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/landsat_ct/073W_41N_med_B1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/landsat_ct/073W_42N_med_B1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month10.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month11.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month12.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month1.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month2.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month3.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month4.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month5.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month6.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month7.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month8.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/LST/LST_MOYDmax_month9.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/mask/msk_1km.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/SDM/eBirdSampling_filtered_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/SDM/eBirdSampling_filtered.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/temperature/ug_bio_3.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/vegetation/ETmean08-11_01_msk.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/vegetation/ETmean08-11_crop.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/vegetation/ETmean08-11.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/vegetation/ETstdev08-11.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/vegetation/GPPmean08-11.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/vegetation/GPPstdev08-11.tif
/media/sf_LVM_shared/my_SE_data/exercise/geodata/vegetation/SA_tree_mn_percentage_GFC2013.tif
Retrive the characteristic of the one tif file
[8]:
!gdalinfo geodata/cloud/SA_intra.tif
Driver: GTiff/GeoTIFF
Files: geodata/cloud/SA_intra.tif
Size is 5880, 8400
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-83.000000000000000,14.000000000000000)
Pixel Size = (0.008333333333333,-0.008333333333333)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=DEFLATE
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( -83.0000000, 14.0000000) ( 83d 0' 0.00"W, 14d 0' 0.00"N)
Lower Left ( -83.0000000, -56.0000000) ( 83d 0' 0.00"W, 56d 0' 0.00"S)
Upper Right ( -34.0000000, 14.0000000) ( 34d 0' 0.00"W, 14d 0' 0.00"N)
Lower Right ( -34.0000000, -56.0000000) ( 34d 0' 0.00"W, 56d 0' 0.00"S)
Center ( -58.5000000, -21.0000000) ( 58d30' 0.00"W, 21d 0' 0.00"S)
Band 1 Block=5880x1 Type=UInt16, ColorInterp=Gray
NoData Value=65535
[9]:
! gdalinfo /home/user/jupyter/notebook_gallery/Rasterio/data/RGB.byte.tif
Driver: GTiff/GeoTIFF
Files: /home/user/jupyter/notebook_gallery/Rasterio/data/RGB.byte.tif
Size is 791, 718
Coordinate System is:
PROJCRS["UTM Zone 18, Northern Hemisphere",
BASEGEOGCRS["Unknown datum based upon the WGS 84 ellipsoid",
DATUM["Not_specified_based_on_WGS_84_spheroid",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1],
ID["EPSG",7030]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433,
ID["EPSG",9122]]]],
CONVERSION["Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",-75,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",0.9996,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",500000,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["easting",east,
ORDER[1],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
AXIS["northing",north,
ORDER[2],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]]]
Data axis to CRS axis mapping: 1,2
Origin = (101985.000000000000000,2826915.000000000000000)
Pixel Size = (300.037926675094809,-300.041782729804993)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 101985.000, 2826915.000) ( 78d57'31.14"W, 25d30'21.91"N)
Lower Left ( 101985.000, 2611485.000) ( 78d53'53.28"W, 23d33'53.97"N)
Upper Right ( 339315.000, 2826915.000) ( 76d35'57.98"W, 25d33' 3.15"N)
Lower Right ( 339315.000, 2611485.000) ( 76d34'29.73"W, 23d36'21.41"N)
Center ( 220650.000, 2719200.000) ( 77d45'28.46"W, 24d33'41.70"N)
Band 1 Block=791x3 Type=Byte, ColorInterp=Red
Min=0.000 Max=255.000
Minimum=0.000, Maximum=255.000, Mean=29.948, StdDev=52.341
NoData Value=0
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=29.947726688477
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=52.340921626611
Band 2 Block=791x3 Type=Byte, ColorInterp=Green
Min=0.000 Max=255.000
Minimum=0.000, Maximum=255.000, Mean=44.516, StdDev=56.934
NoData Value=0
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=44.516147889382
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=56.934318291876
Band 3 Block=791x3 Type=Byte, ColorInterp=Blue
Min=0.000 Max=255.000
Minimum=0.000, Maximum=255.000, Mean=48.113, StdDev=60.113
NoData Value=0
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=48.113056354743
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=60.112778509941
Visualize the image
[11]:
! /usr/bin/openev/bin/openev geodata/vegetation/*.tif
Default software rendering mode (use -h if accelerated video card installed).
Loading tools from /usr/bin/openev/tools/Tool_Export.py
Loading tools from /usr/bin/openev/tools/Tool_ShapesGrid.py
Loading tools from /usr/bin/openev/tools/Tool_DriverList.py
Understanding data type
Numerical System Decimal vs Binary. Recorded lecture: 1:28:45 - 1:48:00
Ranges of GDAL data types |
base^bit |
Precision |
Image Size |
||
---|---|---|---|---|---|
GDAL data type |
Minimum |
Maximum |
|||
Byte |
0 |
255 |
2^8 |
39M |
|
UInt16 |
0 |
65,535 |
2^16 |
78M |
|
Int16, CInt16 |
-32,768 |
32,767 |
2^16 |
78M |
|
UInt32 |
0 |
4,294,967,295 |
2^32 |
155M |
|
Int32, CInt32 |
-2,147,483,648 |
2,147,483,647 |
2^32 |
155M |
|
Float32, CFloat32 |
-3.4E38 |
3.4E38 |
2^38 |
Integer -16777216 16777216 (2^24) |
155M |
Float64, CFloat64 |
-1.79E308 |
1.79E308 |
2^308 |
309M |
Understanding NoData Value Recorded lecture: 1:47:55 - 2:06:00
[12]:
!gdalinfo -mm geodata/vegetation/ETmean08-11.tif
Driver: GTiff/GeoTIFF
Files: geodata/vegetation/ETmean08-11.tif
Size is 720, 600
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (29.000000000000000,4.000000004000000)
Pixel Size = (0.008333333340000,-0.008333333340000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 29.0000000, 4.0000000) ( 29d 0' 0.00"E, 4d 0' 0.00"N)
Lower Left ( 29.0000000, -1.0000000) ( 29d 0' 0.00"E, 1d 0' 0.00"S)
Upper Right ( 35.0000000, 4.0000000) ( 35d 0' 0.00"E, 4d 0' 0.00"N)
Lower Right ( 35.0000000, -1.0000000) ( 35d 0' 0.00"E, 1d 0' 0.00"S)
Center ( 32.0000000, 1.5000000) ( 32d 0' 0.00"E, 1d30' 0.00"N)
Band 1 Block=720x2 Type=Float32, ColorInterp=Gray
Computed Min/Max=0.547,7.492
NoData Value=-3.39999995214436425e+38
[13]:
!gdal_edit.py -a_nodata -9999 geodata/vegetation/ETmean08-11.tif
[14]:
!gdalinfo -mm geodata/vegetation/ETmean08-11.tif
Driver: GTiff/GeoTIFF
Files: geodata/vegetation/ETmean08-11.tif
Size is 720, 600
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (29.000000000000000,4.000000004000000)
Pixel Size = (0.008333333340000,-0.008333333340000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 29.0000000, 4.0000000) ( 29d 0' 0.00"E, 4d 0' 0.00"N)
Lower Left ( 29.0000000, -1.0000000) ( 29d 0' 0.00"E, 1d 0' 0.00"S)
Upper Right ( 35.0000000, 4.0000000) ( 35d 0' 0.00"E, 4d 0' 0.00"N)
Lower Right ( 35.0000000, -1.0000000) ( 35d 0' 0.00"E, 1d 0' 0.00"S)
Center ( 32.0000000, 1.5000000) ( 32d 0' 0.00"E, 1d30' 0.00"N)
Band 1 Block=720x2 Type=Float32, ColorInterp=Gray
Computed Min/Max=-339999995214436424907732413799364296704.000,7.492
NoData Value=-9999
[15]:
!gdal_edit.py -a_nodata -339999995214436424907732413799364296704.000 geodata/vegetation/ETmean08-11.tif
[16]:
!gdalinfo -mm geodata/vegetation/ETmean08-11.tif
Driver: GTiff/GeoTIFF
Files: geodata/vegetation/ETmean08-11.tif
Size is 720, 600
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (29.000000000000000,4.000000004000000)
Pixel Size = (0.008333333340000,-0.008333333340000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 29.0000000, 4.0000000) ( 29d 0' 0.00"E, 4d 0' 0.00"N)
Lower Left ( 29.0000000, -1.0000000) ( 29d 0' 0.00"E, 1d 0' 0.00"S)
Upper Right ( 35.0000000, 4.0000000) ( 35d 0' 0.00"E, 4d 0' 0.00"N)
Lower Right ( 35.0000000, -1.0000000) ( 35d 0' 0.00"E, 1d 0' 0.00"S)
Center ( 32.0000000, 1.5000000) ( 32d 0' 0.00"E, 1d30' 0.00"N)
Band 1 Block=720x2 Type=Float32, ColorInterp=Gray
Computed Min/Max=0.547,7.492
NoData Value=-3.39999995214436425e+38
Recorded lecture: 2:06:00 - 2:19:43 + Recorded lecture: 42:18 - 1:46:40
Calculate minimum and maximum values for all the images
[1]:
%%bash
for file in geodata/vegetation/*.tif ; do
gdalinfo -mm $file | grep Computed
done
Computed Min/Max=-10.000,5.000
Computed Min/Max=0.638,6.957
Computed Min/Max=0.547,7.492
Computed Min/Max=0.209,3.332
Computed Min/Max=0.000,9.738
Computed Min/Max=0.000,4.220
Computed Min/Max=0.000,10000.000
Create a Coefficient of variation
[18]:
%%bash
gdal_calc.py --type=Float32 --overwrite -A geodata/vegetation/GPPstdev08-11.tif -B geodata/vegetation/GPPmean08-11.tif \
--co=COMPRESS=DEFLATE --co=ZLEVEL=9 --calc="( A.astype(float) / ( B.astype(float) + 0.000000001 ) )" --outfile=geodata/vegetation/GPPcv08-11.tif
0.. 0.. 0.. 1.. 1.. 1.. 2.. 2.. 2.. 3.. 3.. 3.. 4.. 4.. 4.. 5.. 5.. 5.. 6.. 6.. 6.. 7.. 7.. 7.. 8.. 8.. 8.. 9.. 9.. 9.. 10.. 10.. 10.. 11.. 11.. 11.. 12.. 12.. 12.. 13.. 13.. 13.. 14.. 14.. 14.. 15.. 15.. 15.. 16.. 16.. 16.. 17.. 17.. 17.. 18.. 18.. 18.. 19.. 19.. 19.. 20.. 20.. 20.. 21.. 21.. 21.. 22.. 22.. 22.. 23.. 23.. 23.. 24.. 24.. 24.. 25.. 25.. 25.. 26.. 26.. 26.. 27.. 27.. 27.. 28.. 28.. 28.. 29.. 29.. 29.. 30.. 30.. 30.. 31.. 31.. 31.. 32.. 32.. 32.. 33.. 33.. 33.. 34.. 34.. 34.. 35.. 35.. 35.. 36.. 36.. 36.. 37.. 37.. 37.. 38.. 38.. 38.. 39.. 39.. 39.. 40.. 40.. 40.. 41.. 41.. 41.. 42.. 42.. 42.. 43.. 43.. 43.. 44.. 44.. 44.. 45.. 45.. 45.. 46.. 46.. 46.. 47.. 47.. 47.. 48.. 48.. 48.. 49.. 49.. 49.. 50.. 50.. 50.. 51.. 51.. 51.. 52.. 52.. 52.. 53.. 53.. 53.. 54.. 54.. 54.. 55.. 55.. 55.. 56.. 56.. 56.. 57.. 57.. 57.. 58.. 58.. 58.. 59.. 59.. 59.. 60.. 60.. 60.. 61.. 61.. 61.. 62.. 62.. 62.. 63.. 63.. 63.. 64.. 64.. 64.. 65.. 65.. 65.. 66.. 66.. 66.. 67.. 67.. 67.. 68.. 68.. 68.. 69.. 69.. 69.. 70.. 70.. 70.. 71.. 71.. 71.. 72.. 72.. 72.. 73.. 73.. 73.. 74.. 74.. 74.. 75.. 75.. 75.. 76.. 76.. 76.. 77.. 77.. 77.. 78.. 78.. 78.. 79.. 79.. 79.. 80.. 80.. 80.. 81.. 81.. 81.. 82.. 82.. 82.. 83.. 83.. 83.. 84.. 84.. 84.. 85.. 85.. 85.. 86.. 86.. 86.. 87.. 87.. 87.. 88.. 88.. 88.. 89.. 89.. 89.. 90.. 90.. 90.. 91.. 91.. 91.. 92.. 92.. 92.. 93.. 93.. 93.. 94.. 94.. 94.. 95.. 95.. 95.. 96.. 96.. 96.. 97.. 97.. 97.. 98.. 98.. 98.. 99.. 99.. 99.. 100 - Done
[19]:
! gdalinfo -mm geodata/vegetation/GPPcv08-11.tif
Driver: GTiff/GeoTIFF
Files: geodata/vegetation/GPPcv08-11.tif
Size is 720, 600
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (29.000000000000000,4.000000004000000)
Pixel Size = (0.008333333340000,-0.008333333340000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=DEFLATE
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 29.0000000, 4.0000000) ( 29d 0' 0.00"E, 4d 0' 0.00"N)
Lower Left ( 29.0000000, -1.0000000) ( 29d 0' 0.00"E, 1d 0' 0.00"S)
Upper Right ( 35.0000000, 4.0000000) ( 35d 0' 0.00"E, 4d 0' 0.00"N)
Lower Right ( 35.0000000, -1.0000000) ( 35d 0' 0.00"E, 1d 0' 0.00"S)
Center ( 32.0000000, 1.5000000) ( 32d 0' 0.00"E, 1d30' 0.00"N)
Band 1 Block=720x2 Type=Float32, ColorInterp=Gray
Computed Min/Max=0.000,1.476
NoData Value=3.40282346600000016e+38
Change pixel resolution
Looping trough the images
[20]:
%%bash
for file in geodata/LST/LST_MOYDmax_month?.tif geodata/LST/LST_MOYDmax_month??.tif; do
filename=$(basename $file .tif )
gdalwarp -overwrite -te 29 -1 35.0000000048 4.000000004 -tr 0.008333333340000 0.008333333340000 -co COMPRESS=DEFLATE -co ZLEVEL=9 $file geodata/LST/${filename}_crop.tif
done
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month1.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month1.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month1.tif to destination geodata/LST/LST_MOYDmax_month1_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month2.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month2.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month2.tif to destination geodata/LST/LST_MOYDmax_month2_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month3.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month3.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month3.tif to destination geodata/LST/LST_MOYDmax_month3_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month4.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month4.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month4.tif to destination geodata/LST/LST_MOYDmax_month4_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month5.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month5.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month5.tif to destination geodata/LST/LST_MOYDmax_month5_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month6.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month6.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month6.tif to destination geodata/LST/LST_MOYDmax_month6_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month7.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month7.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month7.tif to destination geodata/LST/LST_MOYDmax_month7_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month8.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month8.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month8.tif to destination geodata/LST/LST_MOYDmax_month8_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month9.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month9.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month9.tif to destination geodata/LST/LST_MOYDmax_month9_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month10.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month10.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month10.tif to destination geodata/LST/LST_MOYDmax_month10_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month11.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month11.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month11.tif to destination geodata/LST/LST_MOYDmax_month11_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Creating output file that is 720P x 600L.
Processing geodata/LST/LST_MOYDmax_month12.tif [1/1] : 0Using internal nodata values (e.g. -9999) for image geodata/LST/LST_MOYDmax_month12.tif.
Copying nodata values from source geodata/LST/LST_MOYDmax_month12.tif to destination geodata/LST/LST_MOYDmax_month12_crop.tif.
...10...20...30...40...50...60...70...80...90...100 - done.
Get value at one pixel/line image-location
Looping trough the images
[21]:
%%bash
for file in geodata/LST/LST_MOYDmax_month?.tif geodata/LST/LST_MOYDmax_month??.tif; do
gdallocationinfo $file 1079 0
done
Report:
Location: (1079P,0L)
Band 1:
Value: 50.8218383789062
Report:
Location: (1079P,0L)
Band 1:
Value: 52.4714660644531
Report:
Location: (1079P,0L)
Band 1:
Value: 50.2210998535156
Report:
Location: (1079P,0L)
Band 1:
Value: 45.1343078613281
Report:
Location: (1079P,0L)
Band 1:
Value: 43.8952941894531
Report:
Location: (1079P,0L)
Band 1:
Value: 45.8667602539062
Report:
Location: (1079P,0L)
Band 1:
Value: 47.9639892578125
Report:
Location: (1079P,0L)
Band 1:
Value: 49.0910339355469
Report:
Location: (1079P,0L)
Band 1:
Value: 49.9898986816406
Report:
Location: (1079P,0L)
Band 1:
Value: 47.5579528808594
Report:
Location: (1079P,0L)
Band 1:
Value: 45.6031494140625
Report:
Location: (1079P,0L)
Band 1:
Value: 47.5201110839844
Get value at lat/long image-location
Looping trough the images
[22]:
%%bash
for file in geodata/LST/LST_MOYDmax_month?.tif geodata/LST/LST_MOYDmax_month??.tif; do
gdallocationinfo -valonly -geoloc $file 33.3 2
done
37.4764404296875
40.2584228515625
38.2513122558594
33.0213928222656
30.0732116699219
29.0838928222656
28.9105224609375
29.6008605957031
31.0305480957031
30.5758056640625
30.636962890625
33.5576171875
[23]:
%%bash
# Create the lat long file
echo 32.5 2.5 > geodata/LST/x_y.txt
echo 31.1 2.1 >> geodata/LST/x_y.txt
# looping trough the images
for file in geodata/LST/LST_MOYDmax_month?.tif geodata/LST/LST_MOYDmax_month??.tif; do
gdallocationinfo -valonly -geoloc $file < geodata/LST/x_y.txt
echo ""
done
37.4022827148438
35.0345764160156
40.3694458007812
37.824951171875
38.5549926757812
36.6663208007812
32.7738952636719
32.6803283691406
29.0351257324219
30.0338134765625
29.025634765625
29.3355102539062
29.0183715820312
29.4237365722656
29.1660461425781
29.3502197265625
29.6674194335938
29.7001647949219
28.8177490234375
29.066650390625
29.2975463867188
29.015869140625
32.8586730957031
31.3289184570312
From Image to text and from txt to image
[24]:
%%bash
# from tif to 3 col txt XYZ
gdal_translate -of XYZ geodata/vegetation/ETmean08-11.tif geodata/vegetation/ETmean08-11_crop.txt
# masking
awk '{if ($3>2 && $3<4) {print $1,$2,50 } else {print}}' geodata/vegetation/ETmean08-11_crop.txt > geodata/vegetation/ETmean08-11_crop_trh.txt
# back to tif
gdal_translate -co COMPRESS=DEFLATE -co ZLEVEL=9 -ot Byte geodata/vegetation/ETmean08-11_crop_trh.txt geodata/vegetation/ETmean08-11_crop_trh.tif
Input file size is 720, 600
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 720, 600
0...10...20...30...40...50...60...70...80...90...100 - done.
The use of VRT to stack images and tiling
[25]:
%%bash
# stck the tif
gdalbuildvrt -overwrite -separate geodata/vegetation/stack.vrt geodata/vegetation/ETmean08-11.tif geodata/vegetation/ETstdev08-11.tif
gdalinfo geodata/vegetation/stack.vrt
0...10...20...30...40...50...60...70...80...90...100 - done.
Driver: VRT/Virtual Raster
Files: geodata/vegetation/stack.vrt
geodata/vegetation/ETmean08-11.tif
geodata/vegetation/ETstdev08-11.tif
Size is 720, 600
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (29.000000000000000,4.000000004000000)
Pixel Size = (0.008333333340000,-0.008333333340000)
Corner Coordinates:
Upper Left ( 29.0000000, 4.0000000) ( 29d 0' 0.00"E, 4d 0' 0.00"N)
Lower Left ( 29.0000000, -1.0000000) ( 29d 0' 0.00"E, 1d 0' 0.00"S)
Upper Right ( 35.0000000, 4.0000000) ( 35d 0' 0.00"E, 4d 0' 0.00"N)
Lower Right ( 35.0000000, -1.0000000) ( 35d 0' 0.00"E, 1d 0' 0.00"S)
Center ( 32.0000000, 1.5000000) ( 32d 0' 0.00"E, 1d30' 0.00"N)
Band 1 Block=128x128 Type=Float32, ColorInterp=Undefined
NoData Value=-3.39999995214436387e+38
Band 2 Block=128x128 Type=Float32, ColorInterp=Undefined
NoData Value=-3.39999995214436387e+38
[26]:
%%bash
# split in tiles
gdal_translate -srcwin 0 0 360 300 geodata/vegetation/stack.vrt geodata/vegetation/stack_UL.tif
gdal_translate -srcwin 0 300 360 300 geodata/vegetation/stack.vrt geodata/vegetation/stack_UR.tif
gdal_translate -srcwin 360 0 360 300 geodata/vegetation/stack.vrt geodata/vegetation/stack_LL.tif
gdal_translate -srcwin 360 300 360 300 geodata/vegetation/stack.vrt geodata/vegetation/stack_LR.tif
# recompose the image
gdalbuildvrt -overwrite geodata/vegetation/ETmosaic.vrt geodata/vegetation/stack_UL.tif geodata/vegetation/stack_UR.tif geodata/vegetation/stack_LL.tif geodata/vegetation/stack_LR.tif
gdal_translate -co COMPRESS=DEFLATE -co ZLEVEL=9 geodata/vegetation/ETmosaic.vrt geodata/vegetation/ETmosaic.tif
Input file size is 720, 600
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 720, 600
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 720, 600
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 720, 600
0...10...20...30...40...50...60...70...80...90...100 - done.
0...10...20...30...40...50...60...70...80...90...100 - done.
Input file size is 720, 600
0...10...20...30...40...50...60...70...80...90...100 - done.
Create shp border tiles
[27]:
%%bash
rm -f geodata/vegetation/tiles.*
gdaltindex geodata/vegetation/tiles.shp geodata/vegetation/stack_??.tif
Creating new index file...
Surface distance/buffer
[28]:
%%bash
# Continues distance surface
gdal_proximity.py -co COMPRESS=DEFLATE -co ZLEVEL=9 -values 0 -distunits PIXEL -ot UInt32 geodata/vegetation/ETmean08-11_crop_trh.tif geodata/vegetation/ETmean08-11_crop_proximity.tif
0...10...20...30...40...50...60...70...80...90...100 - done.
[29]:
%%bash
# Fix buffer surface
gdal_proximity.py -fixed-buf-val 4 -maxdist 4 -nodata 10 -co COMPRESS=DEFLATE -co ZLEVEL=9 -values 0 -distunits PIXEL -ot Byte geodata/vegetation/ETmean08-11_crop_trh.tif geodata/vegetation/ETmean08-11_crop_buffer.tif
0...10...20...30...40...50...60...70...80...90...100 - done.
Topography variables
[30]:
%%bash
# calculate slope
gdaldem slope -s 111120 -co COMPRESS=DEFLATE -co ZLEVEL=9 geodata/dem/GMTED2010.tif geodata/dem/slope.tif
# calculate apect
gdaldem aspect -zero_for_flat -co COMPRESS=DEFLATE -co ZLEVEL=9 geodata/dem/GMTED2010.tif geodata/dem/aspect.tif
# calculate Terrain Ruggedness Index TRI
gdaldem TRI -co COMPRESS=DEFLATE -co ZLEVEL=9 geodata/dem/GMTED2010.tif geodata/dem/tri.tif
# calculate Topographic Position Index TPI
gdaldem TPI -co COMPRESS=DEFLATE -co ZLEVEL=9 geodata/dem/GMTED2010.tif geodata/dem/tpi.tif
# calculate Roughness
gdaldem roughness -co COMPRESS=DEFLATE -co ZLEVEL=9 geodata/dem/GMTED2010.tif geodata/dem/roughness.tif
0...10...20...30...40...50...60...70...80...90...100 - done.
0...10...20...30...40...50...60...70...80...90...100 - done.
0...10...20...30...40...50...60...70...80...90...100 - done.
0...10...20...30...40...50...60...70...80...90...100 - done.
0...10...20...30...40...50...60...70...80...90...100 - done.
Start to use OGR Commands
Select a polygon and create a new shape file
[31]:
%%bash
ogrinfo -al -geom=NO geodata/shp/TM_WORLD_BORDERS.shp | head -80
INFO: Open of `geodata/shp/TM_WORLD_BORDERS.shp'
using driver `ESRI Shapefile' successful.
Layer name: TM_WORLD_BORDERS
Metadata:
DBF_DATE_LAST_UPDATE=2021-02-09
Geometry: Polygon
Feature Count: 246
Extent: (-180.000000, -90.000000) - (180.000000, 83.623596)
Layer SRS WKT:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["latitude",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["longitude",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
FIPS: String (2.0)
ISO2: String (2.0)
ISO3: String (3.0)
UN: Integer (3.0)
NAME: String (50.0)
AREA: Integer (7.0)
POP2005: Integer64 (10.0)
REGION: Integer (3.0)
SUBREGION: Integer (3.0)
LON: Real (8.3)
LAT: Real (7.3)
OGRFeature(TM_WORLD_BORDERS):0
FIPS (String) = AC
ISO2 (String) = AG
ISO3 (String) = ATG
UN (Integer) = 28
NAME (String) = Antigua and Barbuda
AREA (Integer) = 44
POP2005 (Integer64) = 83039
REGION (Integer) = 19
SUBREGION (Integer) = 29
LON (Real) = -61.783
LAT (Real) = 17.078
OGRFeature(TM_WORLD_BORDERS):1
FIPS (String) = AG
ISO2 (String) = DZ
ISO3 (String) = DZA
UN (Integer) = 12
NAME (String) = Algeria
AREA (Integer) = 238174
POP2005 (Integer64) = 32854159
REGION (Integer) = 2
SUBREGION (Integer) = 15
LON (Real) = 2.632
LAT (Real) = 28.163
OGRFeature(TM_WORLD_BORDERS):2
FIPS (String) = AJ
ISO2 (String) = AZ
ISO3 (String) = AZE
UN (Integer) = 31
NAME (String) = Azerbaijan
AREA (Integer) = 8260
POP2005 (Integer64) = 8352021
REGION (Integer) = 142
SUBREGION (Integer) = 145
LON (Real) = 47.395
LAT (Real) = 40.430
OGRFeature(TM_WORLD_BORDERS):3
FIPS (String) = AL
ISO2 (String) = AL
ISO3 (String) = ALB
UN (Integer) = 8
[32]:
%%bash
# base on an attribute
rm -f shp/TM_UGANDA_BORDERS-0.3.*
ogr2ogr -overwrite -f "ESRI Shapefile" -where "NAME = 'Uganda'" geodata/shp/TM_UGANDA_BORDERS-0.3.shp geodata/shp/TM_WORLD_BORDERS.shp
/usr/bin/openev/bin/openev geodata/shp/TM_UGANDA_BORDERS-0.3.shp
Default software rendering mode (use -h if accelerated video card installed).
Loading tools from /usr/bin/openev/tools/Tool_Export.py
Loading tools from /usr/bin/openev/tools/Tool_ShapesGrid.py
Loading tools from /usr/bin/openev/tools/Tool_DriverList.py
[33]:
%%bash
# base on dimension of the polygons
rm -f geodata/shp/TM_LARGE_BORDERS.*
ogr2ogr -overwrite -f "ESRI Shapefile" -sql "SELECT * FROM TM_WORLD_BORDERS WHERE OGR_GEOM_AREA > 100 " geodata/shp/TM_LARGE_BORDERS.shp geodata/shp/TM_WORLD_BORDERS.shp
/usr/bin/openev/bin/openev geodata/shp/TM_LARGE_BORDERS.shp
Default software rendering mode (use -h if accelerated video card installed).
Loading tools from /usr/bin/openev/tools/Tool_Export.py
Loading tools from /usr/bin/openev/tools/Tool_ShapesGrid.py
Loading tools from /usr/bin/openev/tools/Tool_DriverList.py
Remove all the output
[35]:
%%bash
rm -f geodata/shp/polygons.sqlite geodata/shp/point-buf_stat.csv geodata/shp/point_stat.csv geodata/vegetation/GPPcv08-11.tif LST/*_crop.tif geodata/vegetation/ETmean08-11_crop_trh.tif geodata/vegetation/ETmean08-11_crop_trh.txt vegetation/ETmean08-11_crop.txt geodata/vegetation/ETmosaic.vrt geodata/vegetation/ETmosaic.tif geodata/vegetation/stack_??.tif geodata/vegetation/stack.vrt geodata/vegetation/tiles.* geodata/vegetation/ETmean08-11_crop_proximity.tif geodata/vegetation/ETmean08-11_crop_buffer.tif geodata/dem/slope.tif geodata/dem/aspect.tif geodata/dem/tri.tif geodata/dem/tpi.tif geodata/dem/roughness.tif geodata/vegetation/ETmean08-11_01_trh?.tif geodata/LST/LST_MOYDmax_month1-msk.tif geodata/LST/LST_MOYDmax_monthStdev.tif geodata/LST/LST_MOYDmax_monthMean.tif geodata/LST/LST_MOYDmax_month_mean_stdev.tif geodata/LST/LST_MOYDmax_month.vrt geodata/LST/LST_MOYDmax_monthMean_aggreate10mean.tif geodata/LST/LST_MOYDmax_monthMean_circular11mean.tif geodata/temperature/reclass_ug_bio_3.tif geodata/temperature/reclass_ug_bio_3.txt geodata/shp/polygons_stat.csv geodata/shp/polygons_stat.* geodata/shp/TM_LARGE_BORDERS.shp.* geodata/shp/TM_UGANDA_BORDERS-0.3.* geodata/vegetation/ETmean08-11_crop.txt