Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
GDAL-RASTER-PIXEL-INFO(1)	     GDAL	     GDAL-RASTER-PIXEL-INFO(1)

NAME
       gdal-raster-pixel-info  -  Return  information  on  a pixel of a	raster
       dataset

       Added in	version	3.11.

SYNOPSIS
	  Usage: gdal raster pixel-info	[OPTIONS] <INPUT> [<column,line> or <X,Y>]

	  Return information on	a pixel	of a raster dataset.

	  Positional arguments:
	    -i,	--dataset, --input <INPUT>			 Input raster dataset [required]
	    -p,	--pos, --position <column,line>	or <X,Y>	 Pixel position	[may be	repeated]

	  Common Options:
	    -h,	--help						 Display help message and exit
	    --json-usage					 Display usage as JSON document	and exit
	    --config <KEY>=<VALUE>				 Configuration option [may be repeated]

	  Options:
	    -f,	--of, --format,	--output-format	<OUTPUT-FORMAT>	 Output	format.	OUTPUT-FORMAT=geojson|csv (default: geojson)
	    -b,	--band <BAND>					 Input band(s) (1-based	index) [may be repeated]
	    --overview <OVERVIEW>				 Which overview	level of source	file must be used
	    --position-crs <POSITION-CRS>			 CRS of	position (default: pixel)
	    -r,	--resampling <RESAMPLING>			 Resampling algorithm for interpolation. RESAMPLING=nearest|bilinear|cubic|cubicspline (default: nearest)

	  Advanced Options:
	    --oo, --open-option	<KEY>=<VALUE>			 Open options [may be repeated]
	    --if, --input-format <INPUT-FORMAT>			 Input formats [may be repeated]

DESCRIPTION
       gdal raster pixel-info provide a	mechanism to query information about a
       pixel given its location	in one of a variety of coordinate systems.

       It supports outputting either as	GeoJSON	or CSV.

       The following items will	be reported (when known):

        Input coordinates

        Input coordinates converted to	column,	line

        Pixel value per selected band(s), with	unscaled value

        For VRT files,	which file(s) contribute to the	pixel value.

       The following options are available:

   Standard options
       -f, --of, --format, --output-format geojson|csv
	      Which output format to use. Default is GeoJSON.

       --oo <NAME>=<VALUE>
	      Dataset open option (format specific).

	      May be repeated.

       --if <format>
	      Format/driver name to be attempted to open the input file(s). It
	      is generally not necessary to specify it,	but it can be used  to
	      skip automatic driver detection, when it fails to	select the ap-
	      propriate	 driver.  This option can be repeated several times to
	      specify several candidate	drivers.  Note that it does not	 force
	      those  drivers  to open the dataset. In particular, some drivers
	      have requirements	on file	extensions.

	      May be repeated.

       -b <band>
	      Selects a	band to	query. Multiple	bands can be  listed.  By  de-
	      fault all	bands are queried.

       -p, --pos, --position <column,line> or <X,Y>
	      Required.	  This	can  be	specified either as an option, a posi-
	      tional value after the dataset name, or when called  from	 gdal,
	      as (space	separated) values provided on the standard input.

	      By  default,  when  --position-crs  is  not specified, or	set to
	      pixel, this is a column, line tuple  (possibly  with  fractional
	      part).  If --position-crs	is set to dataset, this	is a georefer-
	      enced  coordinate	 expressed  in	the  CRS  of  the dataset.  If
	      --position-crs is	specified to a CRS definition, this is a  geo-
	      referenced coordinate expressed in this CRS.

	      X	 means always longitude	or easting, Y means always latitude or
	      northing.

	      Several x,y tuples may be	specified.

       --position-crs pixel|dataset|<crs-def>
	      CRS of position, or one of two following special values:

	      	pixel means that the position is set as	column,	line (default)

	      	dataset	means that the position	is a georeferenced  coordinate
		expressed in the CRS of	the dataset.

       -r, --resampling	nearest|bilinear|cubic|cubicspline
	      Select a sampling	algorithm. The default is nearest.

	      The available methods are:

	      	nearest	applies	a nearest neighbour.

	      	bilinear applies a bilinear convolution	kernel.

	      	cubic applies a	cubic convolution kernel.

	      	cubicspline applies a B-Spline convolution kernel.

       --ovr, --overview <index>
	      Query  the  (overview_level)th overview (overview_level=0	is the
	      1st overview), instead of	the base band. Note that the x,y loca-
	      tion (if the coordinate system  is  pixel/line)  must  still  be
	      given with respect to the	base band.

EXAMPLES
   Example 1: Reporting	on pixel column=5, line=10 on the file byte.tif
	  $ gdal raster	pixel-info byte.tif 5 10
	  {
	    "type":"FeatureCollection",
	    "crs":{
	      "type":"name",
	      "properties":{
		"name":"urn:ogc:def:crs:EPSG::26711"
	      }
	    },
	    "features":[
	      {
		"type":"Feature",
		"properties":{
		  "input_coordinate":[
		    5.0,
		    10.0
		  ],
		  "column":5.0,
		  "line":10.0,
		  "bands":[
		    {
		      "band_number":1,
		      "raw_value":132,
		      "unscaled_value":132.0
		    }
		  ]
		},
		"geometry":{
		  "type":"Point",
		  "coordinates":[
		    441020.0,
		    3750720.0
		  ]
		}
	      }
	    ]
	  }

   Example  2:	Reporting  on  point at	UTM 11N	coordinates easting=441320 and
       northing=3750720	on the file byte.tif
	  $ gdal raster	pixel-info --position-crs=dataset byte.tif 441320 3750720
	  {
	    "type":"FeatureCollection",
	    "crs":{
	      "type":"name",
	      "properties":{
		"name":"urn:ogc:def:crs:EPSG::26711"
	      }
	    },
	    "features":[
	      {
		"type":"Feature",
		"properties":{
		  "input_coordinate":[
		    441320.0,
		    3750720.0
		  ],
		  "column":10.0,
		  "line":10.0,
		  "bands":[
		    {
		      "band_number":1,
		      "raw_value":115,
		      "unscaled_value":115.0
		    }
		  ]
		},
		"geometry":{
		  "type":"Point",
		  "coordinates":[
		    441320.0,
		    3750720.0
		  ]
		}
	      }
	    ]
	  }

   Example 3: Reporting	on point at WGS84 coordinates longitude=-117.6355  and
       latitude=33.8970	on the file byte.tif, with CSV output format
	  $ gdal raster	pixel-info --of=csv --position-crs=WGS84 byte.tif -117.6355 33.8970
	  input_x,input_y,extra_input,column,line,band_1_raw_value,band_1_unscaled_value
	  -117.63549999999999,33.896999999999998,"",10.020546288988044,9.9833047347492538,115,115

   Example 4: Reporting	on point at WGS84 coordinates provided on the standard
       input with longitude, latitude order.
	  $ echo -117.6355 33.8970 | gdal raster pixel-info --of=csv --position-crs=WGS84 byte.tif
	  -117.6355 33.8970 | gdal raster pixel-info --of=csv --position-crs=WGS84 byte.tif

AUTHOR
       Even Rouault <even.rouault@spatialys.com>

COPYRIGHT
       1998-2025

				 Jul 12, 2025	     GDAL-RASTER-PIXEL-INFO(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=gdal-raster-pixel-info&sektion=1&manpath=FreeBSD+Ports+15.0>

home | help