[gdal-dev] Using GDALTranslateOptions with '-a_ullr' doesn't work

Paul Meems bontepaarden at gmail.com
Tue Jan 17 04:13:35 PST 2017


Thanks Even for your reply, it helped me great.

For future reference here's the working C# code:

var options =
    new GDALTranslateOptions(new[]
    {
        "-of", "GTiff",
        "-a_nodata", "65535",
        "-a_srs", "+proj=stere +lat_0=90 +lon_0=0 +lat_ts=60 +a=6378.14
+b=6356.75 +x_0=0 y_0=0",
        "-a_ullr", "0.0", "-3650.000", "800.000", "-4415.000"
    });
var newDs = Gdal.wrapper_GDALTranslate(outputFile, ds, options, null, null);


Regards,


Paul

*Paul Meems *
Release manager, configuration manager
and forum moderator of MapWindow GIS.
www.mapwindow.org

Owner of MapWindow.nl - Support for
Dutch speaking users.
www.mapwindow.nl


*The MapWindow GIS project has moved to GitHub
<https://github.com/MapWindow>!*


Download the latest MapWinGIS mapping engine.
<https://github.com/MapWindow/MapWinGIS/releases>

Download the latest MapWindow 5 open source desktop application.
<https://github.com/MapWindow/MapWindow5/releases>

2017-01-17 9:05 GMT+01:00 Even Rouault <even.rouault at spatialys.com>:

> On mardi 17 janvier 2017 08:59:30 CET Paul Meems wrote:
>
> > Hi list,
>
> >
>
> > I'm using GDAL v2.1.2 from GisInternals.com on Win10 with the
> C#-bindings.
>
> >
>
> > I'm trying to recreate this gdal_translate command in C#:
>
> > gdal_translate -of GTiff -a_nodata 65535 -a_srs "+proj=stere +lat_0=90
>
> > +lon_0=0 +lat_ts=60 +a=6378.14 +b=6356.75 +x_0=0 y_0=0" -a_ullr 0.0,
>
> > -3650.000, 800.000, -4415.000 "HDF5:\"in.h5\"://image1/image_data"
> "out.tif"
>
> >
>
> > This is my C#-code:
>
> > var options =
>
> > new GDALTranslateOptions(new[]
>
> > {
>
> > "-of", "GTiff",
>
> > "-a_nodata", "65535",
>
> > // "-a_srs", "\"+proj=stere +lat_0=90 +lon_0=0 +lat_ts=60
>
> > +a=6378.14 +b=6356.75 +x_0=0 y_0=0\"",
>
>
>
> Remvoe the \" in the proj.4 string. This is just needed for invokation
> from a shell, not when passing arguments as a string
>
>
>
> > //"-a_ullr", "0.0, -3650.000, 800.000, -4415.000"
>
>
>
> Split the four values as 4 separate strings.
>
>
>
> > });
>
> > var newDs = Gdal.wrapper_GDALTranslate(outputFile, ds, options, null,
> null);
>
> >
>
> > The above code works, because I commented the last two
> GDALTranslateOptions.
>
> >
>
> > When I enable the -a_srs option I get this error: Failed to process SRS
>
> > definition
>
> > When I enable the -a_ullr option I get Unknown option name '-a_ullr'
>
> >
>
> > So it seems I'm not doing it right. I tried looking for examples but
>
> > couldn't find any.
>
> > Can anybody assist?
>
> >
>
> > Thanks,
>
> >
>
> > Paul
>
>
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170117/cefb179d/attachment.html>


More information about the gdal-dev mailing list