Skip to main content
added 17 characters in body
Source Link
Hugolpz
  • 2.7k
  • 3
  • 29
  • 52

YouWith bash alone, you can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the string Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed both the digits after decimal point and the spaces in case via cut -d <separator> -f <selected_field> and tr -d ' ', respectively. Adapt as needed.

You can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the string Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed both the digits after decimal point and the spaces in case via cut -d <separator> -f <selected_field> and tr -d ' ', respectively. Adapt as needed.

With bash alone, you can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the string Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed both the digits after decimal point and the spaces in case via cut -d <separator> -f <selected_field> and tr -d ' ', respectively. Adapt as needed.

added 2 characters in body; added 43 characters in body
Source Link
Hugolpz
  • 2.7k
  • 3
  • 29
  • 52

You can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the linestring Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed both the digits after decimal point and the spaces in case via cut -d <separator> -f <selected_field> and tr -d ' ', respectively. Adapt as needed.

You can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the line Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed digits after decimal point and spaces in case via cut -d <separator> -f <selected_field>. Adapt as needed.

You can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the string Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed both the digits after decimal point and the spaces in case via cut -d <separator> -f <selected_field> and tr -d ' ', respectively. Adapt as needed.

deleted 10 characters in body
Source Link
Hugolpz
  • 2.7k
  • 3
  • 29
  • 52

You can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the line Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif 2>&1 | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif 2>&1 | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed digits after decimal point and spaces in case via cut -d <separator> -f <selected_field>. Adapt as needed.

You can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the line Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif 2>&1 | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif 2>&1 | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed digits after decimal point and spaces in case via cut -d <separator> -f <selected_field>. Adapt as needed.

You can use :

gdalinfo -mm input.tif

It returns a range of infos within which is the line Computed Min/Max=-425.000,8771.000, for my Eurasian raster.

Some cleanup and you get your vertical min/max variables:

$zMin=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 1 | cut -d . -f 1`
$zMax=`gdalinfo -mm ./input.tif | sed -ne 's/.*Computed Min\/Max=//p'| tr -d ' ' | cut -d "," -f 2 | cut -d . -f 1`
$echo $zMin $zMax
>-425 8771

I trimed digits after decimal point and spaces in case via cut -d <separator> -f <selected_field>. Adapt as needed.

added 43 characters in body
Source Link
Hugolpz
  • 2.7k
  • 3
  • 29
  • 52
Loading
added 445 characters in body
Source Link
Hugolpz
  • 2.7k
  • 3
  • 29
  • 52
Loading
Source Link
Hugolpz
  • 2.7k
  • 3
  • 29
  • 52
Loading