Pham,

My point was that I use gdalwarp itself along with all the options (such as
setting the target resolution), but to VRT format.  I imagine the
"commandline gdalwarp API" interface would be able to do this from Java.
  If often just shell out and run the command.

Best regards,
Frank


On Tue, May 19, 2020 at 12:37 PM Pham Huu Bang <a09...@gmail.com> wrote:

> @Even Rouault <even.roua...@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.roua...@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
>>
>

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmer...@pobox.com
light and sound - activate the windows | +1 650-701-7823
and watch the world go round - Rush    | Geospatial Software Developer
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to