[gdal-dev] How to use wrapper_GDALRasterizeDestName with C# bindings
Even Rouault
even.rouault at spatialys.com
Tue Mar 14 08:03:42 PDT 2017
On mardi 14 mars 2017 15:57:31 CET Paul Meems wrote:
> Thanks Even,
>
> I now have
> using (var ds = Gdal.OpenEx(input, 1, null, null, null))
> I couldn't find GDAL_OF_VECTOR in the C# bindings.
Constants are defined in swig/include/gdalconst.i as:
// Open flags
%constant OF_ALL = GDAL_OF_ALL;
%constant OF_RASTER = GDAL_OF_RASTER;
%constant OF_VECTOR = GDAL_OF_VECTOR;
%constant OF_GNM = GDAL_OF_GNM;
%constant OF_READONLY = GDAL_OF_READONLY;
%constant OF_UPDATE = GDAL_OF_UPDATE;
%constant OF_SHARED = GDAL_OF_SHARED;
%constant OF_VERBOSE_ERROR = GDAL_OF_VERBOSE_ERROR;
> I'm assuming it must be
> 1 since GDAL_OF_RASTER is 0.
/** Allow raster and vector drivers to be used.
* Used by GDALOpenEx().
* @since GDAL 2.0
*/
#define GDAL_OF_ALL 0x00
/** Allow raster drivers to be used.
* Used by GDALOpenEx().
* @since GDAL 2.0
*/
#define GDAL_OF_RASTER 0x02
/** Allow vector drivers to be used.
* Used by GDALOpenEx().
* @since GDAL 2.0
*/
#define GDAL_OF_VECTOR 0x04
1 is working since :
/** Open in update mode.
* Used by GDALOpenEx().
* @since GDAL 2.0
*/
#define GDAL_OF_UPDATE 0x01
And as no explicit GDAL_OF_RASTER or GDAL_OF_VECTOR is specified, GDAL_OF_ALL is
assumed. But you probably don't need/want to open in update mode.
>
> It is now working.
>
>
>
>
> 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-03-14 15:23 GMT+01:00 Even Rouault <even.rouault at spatialys.com>:
> > On mardi 14 mars 2017 15:12:20 CET Paul Meems wrote:
> > > I'm trying to use this gdal_rasterize command in my C# application:
> > >
> > > gdal_rasterize -a DN -a_srs "EPSG:28992" -tr 5 5 -a_nodata 0 -l test
> > >
> > > test.shp test.shp
> > >
> > >
> > >
> > > My goal is to convert a shapefile to a tiff-file. The above command does
> > >
> > > what I want.
> > >
> > > I need to call it from within my C# application.
> > >
> > > I'm already successfully using wrapper_GDALTranslate
> > >
> > > and wrapper_GDALWarpDestName but I'm struggling
> > >
> > > with wrapper_GDALRasterizeDestName.
> > >
> > >
> > >
> > > I have this code:
> > >
> > > using (var ds = Ogr.Open(shapefile, 0)) // 0 means read-only. 1
> > >
> > > means writeable.
> > >
> > > {
> > >
> > > if (ds == null)
> > >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170314/81c3c745/attachment-0001.html>
More information about the gdal-dev
mailing list