[gdal-dev] Specify Grid Rotation for gdal.Warp() with Geolocation Arrays

Even Rouault even.rouault at spatialys.com
Sat Nov 5 02:36:38 PDT 2022


Le 05/11/2022 à 04:33, Michael Sumner a écrit :
> yes I see, well you can probably set a target GeoTIFF with the 
> geotransform that you want - and gdalwarp to that as the target.

something like

out_ds = gdal.GetDriverByName("GTiff").Create("output.tif", width, 
height, number_of_bands, data_type, options = ["TILED=YES"])

out_ds.SetGeoTransform([ some geotransform with rotational terms ])

srs = osr.SpatialReference()

srs.ImportFromEPSG( xxx ) / srs.ImportFromWkt( xxx )

out_ds.SetSpatialRef( srs )

gdal.Warp(out_ds, src_ds, .... )



> I don't believe you can do that with gdalwarp directly, and I have no 
> idea with python - and finally I'm sorry to add irrelevant discussion 
> - but this is interesting and I'm going to try it out in R and C++ and 
> would love to see a python example too.
>
> Cheers, Mike
>
>
>
>
>
> On Sat, Nov 5, 2022 at 2:21 PM Brendan Heberlein <bheberlein at wisc.edu> 
> wrote:
>
>     Hi Mike,
>
>     regardless of the map projection, it may be desirable to have the
>     grid oriented in one direction or another, e.g. due to the spatial
>     distribution of data points. Although the CRS/SRS designates the
>     coordinate axes, these are not always aligned with the desired
>     grid orientation.
>
>     So, basically I want to be able to specify an arbitrary
>     geotransform array for the output grid. This would allow the grid
>     to be assigned an arbitrary orientation within the CRS frame.
>
>     Thanks,
>     Brendan
>     ------------------------------------------------------------------------
>     *From:* Michael Sumner <mdsumner at gmail.com>
>     *Sent:* Friday, November 4, 2022 6:57 PM
>     *To:* Brendan Heberlein <bheberlein at wisc.edu>
>     *Cc:* gdal-dev <gdal-dev at lists.osgeo.org>
>     *Subject:* Re: [gdal-dev] Specify Grid Rotation for gdal.Warp()
>     with Geolocation Arrays
>     well, the map projection does this - there are many possibilities.
>     Or, do you have another geolocation array you want as the target?
>
>     If you have an example I'm happy to try a few things, but I'd
>     assumed you had a target map projection in mind. What kind of crs
>     to choose depends on your goal, or is purely to not have north up?
>
>     Perhaps there's something terminology wise I'm missing ...
>
>     Mike
>
>     On Sat, 5 Nov 2022, 10:50 Brendan Heberlein, <bheberlein at wisc.edu>
>     wrote:
>
>         Hi Mike,
>
>         thanks for the response.
>
>         Can you clarify how I would go about specifying the grid
>         orientation for the output raster? None of -te, -ts or -t_srs
>         address this.
>
>
>         ------------------------------------------------------------------------
>         *From:* Michael Sumner <mdsumner at gmail.com>
>         *Sent:* Friday, November 4, 2022 6:41 PM
>         *To:* Brendan Heberlein <bheberlein at wisc.edu>
>         *Cc:* gdal-dev <gdal-dev at lists.osgeo.org>
>         *Subject:* Re: [gdal-dev] Specify Grid Rotation for
>         gdal.Warp() with Geolocation Arrays
>         that's exactly what the warper does with geolocation arrays,
>         set the target extent, dimension, and crs with -te, -ts,
>         -t_srs with gdalwarp.
>
>         python will have those analogous controls for the warper.
>
>         Cheers, Mike
>
>
>
>         On Sat, 5 Nov 2022, 01:23 Brendan Heberlein via gdal-dev,
>         <gdal-dev at lists.osgeo.org> wrote:
>
>             Hello,
>
>             I would like to be able to warp an image dataset using a
>             geolocation array, while specifying the grid to which the
>             output dataset is sampled. Specifically, I want to be able
>             to warp the dataset to a grid which is not oriented North-up.
>
>             Can GDAL support this currently? Or, what is the
>             likelihood this could be supported in the future?
>
>             I primarily rely on the Python bindings, so a solution
>             within that framework would be ideal for me.
>
>             Thanks!
>                — Brendan
>
>
>             _______________________________________________
>             gdal-dev mailing list
>             gdal-dev at lists.osgeo.org
>             https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
> -- 
> Michael Sumner
> Software and Database Engineer
> Australian Antarctic Division
> Hobart, Australia
> e-mail: mdsumner at gmail.com
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221105/8d408263/attachment.htm>


More information about the gdal-dev mailing list