[gdal-dev] Python/Java GDAL - How to estimate the geo coordinates and width / height without warping dataset?

Pham Huu Bang a09550 at gmail.com
Tue May 19 09:36:53 PDT 2020


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

Unfortunately, this method is not enough to solve my problem as I *also
have a given geo X, Y resolutions *in target CRS (EPSG:4326) as input.

Below is what I've with Python GDAL:

    src_ds = gdal.GetDriverByName("VRT").Create("", 1830, 1830)
    src_ds.SetGeoTransform([600000.000, 60, 0,  5900040, 0, -60])

     // source CRS EPSG:32632
    src_srs = osr.SpatialReference()
    src_srs.ImportFromEPSG(32632)
    src_wkt = src_srs.ExportToWkt()

     // destination CRS EPSG:4326
    dst_srs = osr.SpatialReference()
    dst_srs.ImportFromEPSG(4326)
    dst_wkt = dst_srs.ExportToWkt()

   // This method doesn't have the possibility to add the given geo X, Y
resolutions in EPSG:4326  (!)
    dst_ds = gdal.AutoCreateWarpedVRT(src_ds,
                                      src_wkt,
                                      dst_wkt,
                                      gdal.GRA_NearestNeighbour,
                                      0.125)

On Tue, 19 May 2020 at 18:14, Even Rouault <even.rouault at spatialys.com>
wrote:

> On mardi 19 mai 2020 12:01:58 CEST Frank Warmerdam wrote:
>
> > Pham,
>
> >
>
> > I have sometimes taken the approach of doing a "gdalwarp to VRT" which
>
> > creates the configuration of the target dataset in VRT format, but does
> not
>
> > actually resample any imagery. The you can open the VRT and query it's
>
> > configuration. There are also lower level apis to get this information
> but
>
> > they are not normally exposed through SWIG in Java, Python, etc as far
> as I
>
> > know.
>
> >
>
>
>
> gdal.AutoCreateWarpedVRT() is available in Java bindings:
>
>
>
> https://gdal.org/java/org/gdal/gdal/gdal.html
>
>
>
> Even
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200519/15d71253/attachment.html>


More information about the gdal-dev mailing list