Re: [gdal-dev] How to locate where the raster min and max values are?

2024-10-29 Thread Ujaval Gandhi via gdal-dev
Another approach using rasterio import rasterio import numpy as np dataset = rasterio.open('P3412A.tif') band1 = dataset.read(1) rows, cols = np.where(band1 == np.max(band1)) lon, lat = rasterio.transform.xy(dataset.transform, row[0], col[0]) print(lat, lon) --- Ujaval Gandhi Spatial Thoughts w

[gdal-dev] How to locate where the raster min and max values are?

2024-10-29 Thread Rahkonen Jukka via gdal-dev
Hi, I would like to know the georeferenced coordinates of the min and max values of a DEM file. Even better if I could forward them into a vector file. If the minimum or maximum happens to be on a flat area like seabed I would be happy with the first pixel at the moment. By copy-pasting from H

Re: [gdal-dev] How to locate where the raster min and max values are?

2024-10-29 Thread Scott via gdal-dev
It ain't pretty or efficient, but it's cheap. Here's min value. Remove 'r' from sort for max value: gdal2xyz.py -csv -skipnodata source.tif /dev/stdout | grep -v done | sort -rnk 3,3 -t "," | tail -1 result: -116.9916667,36.5417,46 On 10/29/24 17:31, Rahkonen Jukka via gdal-dev wrote: H

Re: [gdal-dev] How to locate where the raster min and max values are?

2024-10-29 Thread Even Rouault via gdal-dev
if you are just interested in any point where the minimum is reached: import numpy as np from osgeo import gdal ds = gdal.Open('P3412A.tif', gdal.GA_ReadOnly) rb = ds.GetRasterBand(1) img_array = rb.ReadAsArray() vmin = img_array.min() (line, col) = np.where(img_array==vmin) line = line[0] col =

Re: [gdal-dev] How to locate where the raster min and max values are?

2024-10-29 Thread Even Rouault via gdal-dev
Slightly less tricky using gdal.ApplyGeoTransform() (note the explicit cast of line[0]/col[0]) as a int, to avoid a numpy type to be used, which confuses gdal.ApplyGeoTransform) : import numpy as np from osgeo import gdal ds = gdal.Open('byte.tif', gdal.GA_ReadOnly) rb = ds.GetRasterBand(1) img

Re: [gdal-dev] GDAL 3.10.0 release candidate is available

2024-10-29 Thread Sean Gillies via gdal-dev
Hi Even, Rasterio still has a problem with the lock-down of MEM:: datasets. I missed a few spots where GDAL warp utilities open the datasets behind the scenes. I think I should be able to make a new release by the end of the week. On Tue, Oct 29, 2024 at 7:14 AM Even Rouault via gdal-dev < gdal-d

Re: [gdal-dev] OGC services and credentials

2024-10-29 Thread Even Rouault via gdal-dev
Michał, Why service credentials (username & password) can not be entered with open options (*-oo UserPwd=user:pass*) when working with OGC services (tested against WMS)? The usual answer: because nobody has implemented that yet / contributions welcome.  The bulk of the development of the WM

Re: [gdal-dev] OGC services and credentials

2024-10-29 Thread Michał Kowalczuk via gdal-dev
Dear Laurentiu, I don't use command line tools. I use GDAL API. I only used them here to show the problem. For similar reasons I wouldn't even like to use global configuration options :-) In my opinion, the most clean way to do it is to hide credentials in dataset instance. Michał wt., 29 paź 202

Re: [gdal-dev] OGC services and credentials

2024-10-29 Thread Laurențiu Nicola via gdal-dev
Hi, It's unlikely to be a problem for you, but credential passing via command-line arguments is considered an anti-pattern because they're visible by other users who might be looking at the running process list. Environment variables are better because other users can't inspect them. Of course

Re: [gdal-dev] Abou R sf library and GDAL

2024-10-29 Thread Roger Bivand via gdal-dev
On Tue, 29 Oct 2024, Even Rouault wrote: We'll try, but GDAL 3.9 needs to be more stable than 4 3.9 releases in five months suggests for it to be easy to ask for. 3.9.3 will be the the last in the 3.9 series, with whatever bugs it has. Thanks! That'll be enough, I think; I just need to try t

Re: [gdal-dev] OGC services and credentials

2024-10-29 Thread Michał Kowalczuk via gdal-dev
OK, I understand. I'm not a C/C++ programmer, but I might try to contribute to GDAL in the future. Last time I gave up trying to build GDAL from source. The CMAKE setup was beyond me, so i started to use conda binaries. regards Michał wt., 29 paź 2024 o 14:35 Even Rouault napisał(a): > Michał,

[gdal-dev] GDAL 3.9 updates for SWIG 4.3 and libarrow 18

2024-10-29 Thread Even Rouault via gdal-dev
Hi, this is for packagers that will still ship 3.9.3 for some time before switching to 3.10.0 You may want to cherry-pick the following commits that have just been pushed to the release/3.9 branch: - libarrow 18 compatiblity: https://github.com/OSGeo/gdal/commit/59916e2179406b19cc99f90f4bf

[gdal-dev] GDAL 3.10.0 release candidate is available

2024-10-29 Thread Even Rouault via gdal-dev
Hi, I have prepared a GDAL/OGR 3.10.0 release candidate. I'll call for a vote promoting it later this week if no serious problems are reported before. NEWS at:   https://github.com/OSGeo/gdal/blob/v3.10.0RC1/NEWS.md Pick up an archive among the following ones (by ascending size):   https://d

[gdal-dev] OGC services and credentials

2024-10-29 Thread Michał Kowalczuk via gdal-dev
Hi GDAL friends! Why service credentials (username & password) can not be entered with open options (*-oo UserPwd=user:pass*) when working with OGC services (tested against WMS)? I know there is a config option *GDAL_HTTP_USERPWD=value* but it's not clean solution in my opinion. Credential should

Re: [gdal-dev] Abou R sf library and GDAL

2024-10-29 Thread Andrew C Aitchison via gdal-dev
On Mon, 28 Oct 2024, Abel Pau via gdal-dev wrote: Hi Michael, Thank you for your response. I am working on a Windows 10 or 11 system (though I believe this detail is not particularly relevant). I am looking for the simplest method to install GDAL, as RStudio requires it as a dependency for th

Re: [gdal-dev] proj.db and other resource files when building with vcpkg

2024-10-29 Thread Thomas Sevaldrud via gdal-dev
Thank you Even, then I'll add some post-build magic. Looking forward to Proj 9.6 then! :-D - Thomas On Tue, Oct 29, 2024 at 12:33 PM Even Rouault wrote: > Thomas, > > (that would be more a question for the proj-dev mailing list) > > quickly looking at the vcpkg PROJ recipe at > https://githu

[gdal-dev] proj.db and other resource files when building with vcpkg

2024-10-29 Thread Thomas Sevaldrud via gdal-dev
Hi, We are using gdal/proj through vcpkg, specifically the projections framework with OGRSpatialReference, and everything builds nicely, but when running our application we get errors related to missing proj.db. Now, I understand that we can fix it by setting the PROJ_LIB environment variable or

Re: [gdal-dev] Abou R sf library and GDAL

2024-10-29 Thread Roger Bivand via gdal-dev
Abel: You write: >I am working on a Windows 10 or 11 system (though I > believe this detail is not particularly relevant). I am looking > for the simplest method to install GDAL, as RStudio > requires it as a dependency for the "sf" package. Windows (or macOS) as compared to all other systems

Re: [gdal-dev] Abou R sf library and GDAL

2024-10-29 Thread Even Rouault via gdal-dev
>We'll try, but GDAL 3.9 needs to be more stable than 4 3.9 releases in five months suggests for it to be easy to ask for. 3.9.3 will be the the last in the 3.9 series, with whatever bugs it has. Even -- http://www.spatialys.com My software is free, but my time generally not. Butcher of all k

Re: [gdal-dev] proj.db and other resource files when building with vcpkg

2024-10-29 Thread Even Rouault via gdal-dev
Thomas, (that would be more a question for the proj-dev mailing list) quickly looking at the vcpkg PROJ recipe at https://github.com/microsoft/vcpkg/tree/master/ports/proj I don't see they do anything particular related to automated setting PROJ_DATA (PROJ_LIB is now a deprecated name), so yo

Re: [gdal-dev] Mollweide to plate_carree

2024-10-29 Thread Rahkonen Jukka via gdal-dev
Hi, I tried to go from a Natural Earth world map in EPSG:4326 into Mollweide this way: gdalwarp -t_srs "+proj=moll +lon_0=0 +datum=WGS84" HYP_50M_SR_W.tif molltest.tif The warped image has corner coordinates: Corner Coordinates: Upper Left (-18040095.696, 9020047.848) Lower Left (-18040095.696