On mardi 19 mai 2020 13:03:07 CEST Frank Warmerdam wrote:
> 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.
Yes, or use the gdal.Warp() Java function. I'm not sure to have tested it
myself with the Java
bindings, but works fine for the Python ones.
should be something like (please fix to use correct Java syntax!)
options = new WarpOptions( new Vector() { "-of", "VRT", "-t_srs",
"EPSG:4326","-tr", ... } );
vrt_ds = gdal.Warp("", new Dataset[] { src_ds }, options );
>
> Best regards,
> Frank
>
> On Tue, May 19, 2020 at 12:37 PM Pham Huu Bang <[email protected]> wrote:
> > @Even Rouault <[email protected]>
> >
> > 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 <[email protected]>
> >
> > 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
--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev