[gdal-dev] clip raster to one cell at coordinates

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Fri Jan 27 06:07:14 PST 2023


Hi,

There is also a brand new option to query pixel values with ogrinfo (sic!) by using SQL function "gdal_get_pixel_value". See usage example and some discussion https://lists.osgeo.org/pipermail/gdal-dev/2023-January/056759.html. Of course the function can be reached without ogrinfo from other code.

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta Alan Snow
Lähetetty: perjantai 27. tammikuuta 2023 15.19
Vastaanottaja: karsten <karsten at terragis.net>
Kopio: gdal dev <gdal-dev at lists.osgeo.org>
Aihe: Re: [gdal-dev] clip raster to one cell at coordinates

This example may be helpful: https://gis.stackexchange.com/questions/358036/extracting-data-from-a-raster/358058<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgis.stackexchange.com%2Fquestions%2F358036%2Fextracting-data-from-a-raster%2F358058&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C85a22789f1314481619808db00692763%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638104223860873847%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=zHbA%2Bz0krbTg16Xro6TPqZAZfSqNm7ah9GuH99n7m0c%3D&reserved=0>

On Fri, Jan 27, 2023, 12:00 AM karsten <karsten at terragis.net<mailto:karsten at terragis.net>> wrote:
Hi All,

in an application I have a user click on a map and I need to programmatically clip a raster layer
to the one raster cell for those coordinates at the click location.
I was looking e.g. at https://gdal.org/programs/gdal_rasterize.html<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgdal.org%2Fprograms%2Fgdal_rasterize.html&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C85a22789f1314481619808db00692763%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638104223861030112%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=C3%2Fwd85eQsvtguEBYnm24gwmpgjo8Ohuetmetn0Sx%2Fw%3D&reserved=0> to run as a command
line tool, but so far could not figure out if I can some can "feed" that a vector point to the tool as an input
without first writing a shape file with the point onto disk.

Does somebody have any pointers to a command line tool (or a python example) I could use to achieve this ?

Thanks
Karsten

Karsten Vennemann
Principal

Terra GIS LTD
2119 Boyer Ave E
Seattle, WA  98112
USA
www.terragis.net<https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.terragis.net%2F&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C85a22789f1314481619808db00692763%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638104223861030112%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=U59b7t3bd5QtQe%2B%2FA%2FXkw15Y7du%2B%2Fy5m4YJnclBbJ%2F0%3D&reserved=0>
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C85a22789f1314481619808db00692763%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C1%7C638104223861030112%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=%2BuSDGL4mSlw%2Bs%2BD0XmImGT%2BKjJGG%2Flokh%2F99qjnr8A0%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230127/84b4ed8f/attachment.htm>


More information about the gdal-dev mailing list