Skip to content

Commit

Permalink
add RasterizeInto and Description (#107)
Browse files Browse the repository at this point in the history
* add RasterizeInto and Description

* fix failing test

* add rasterizeinto test coverage

* update ci workflows to current versions

* revert update ci workflows to current versions for osx
  • Loading branch information
tbonfort authored Apr 19, 2023
1 parent 29f4bb1 commit 2de9714
Show file tree
Hide file tree
Showing 8 changed files with 450 additions and 308 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.19
- name: Tests
run: go test . -race
12 changes: 6 additions & 6 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
GODEBUG: cgocheck=2
strategy:
matrix:
go: [ '1.18', '1.19' ]
go: [ '1.19', '1.20' ]
name: Go ${{ matrix.go }} + GDAL on ubuntu 20.04 test
steps:
- name: APT
Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
gdal: [ 'release/3.3', 'release/3.4', 'release/3.5', 'master' ]
gdal: [ 'release/3.4', 'release/3.5', 'release/3.6', 'master' ]
steps:
- name: optgdal
run: sudo mkdir /optgdal && sudo chown -R $USER /optgdal
Expand All @@ -52,8 +52,8 @@ jobs:
GODEBUG: cgocheck=2
strategy:
matrix:
go: [ '1.18', '1.19' ]
gdal: [ 'release/3.3', 'release/3.4', 'release/3.5', 'master' ]
go: [ '1.19', '1.20' ]
gdal: [ 'release/3.4', 'release/3.5', 'release/3.6', 'master' ]
name: Go ${{ matrix.go }} + GDAL ${{ matrix.gdal }} test
steps:
- name: APT
Expand Down Expand Up @@ -91,12 +91,12 @@ jobs:
env:
PKG_CONFIG_PATH: /optgdal/lib/pkgconfig/
- name: Send coverage
if: ${{ matrix.go == '1.19' && matrix.gdal == 'master' }}
if: ${{ matrix.go == '1.20' && matrix.gdal == 'master' }}
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov
- name: golangci-lint
if: ${{ matrix.go == '1.19' && matrix.gdal == 'master' }}
if: ${{ matrix.go == '1.20' && matrix.gdal == 'master' }}
uses: reviewdog/action-golangci-lint@v1
env:
PKG_CONFIG_PATH: /optgdal/lib/pkgconfig/
Expand Down
8 changes: 8 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ func ErrLogger(fn ErrorHandler) interface {
PolygonizeOption
RasterizeGeometryOption
RasterizeOption
RasterizeIntoOption
SetColorInterpOption
SetColorTableOption
SetDescriptionOption
SetGeometryOption
SetFieldValueOption
SetNoDataOption
Expand Down Expand Up @@ -263,6 +265,9 @@ func (ec errorCallback) setIntersectionOpt(o *intersectionOpts) {
func (ec errorCallback) setMetadataOpt(o *metadataOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setDescriptionOpt(o *setDescriptionOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setNewFeatureOpt(o *newFeatureOpts) {
o.errorHandler = ec.fn
}
Expand All @@ -281,6 +286,9 @@ func (ec errorCallback) setRasterizeGeometryOpt(o *rasterizeGeometryOpts) {
func (ec errorCallback) setRasterizeOpt(o *rasterizeOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setRasterizeIntoOpt(o *rasterizeIntoOpts) {
o.errorHandler = ec.fn
}
func (ec errorCallback) setSetColorInterpOpt(ndo *setColorInterpOpts) {
ndo.errorHandler = ec.fn
}
Expand Down
10 changes: 7 additions & 3 deletions godal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ void godalClearMetadata(cctx *ctx, GDALMajorObjectH mo, char *cdom) {
}
godalUnwrap();
}
void godalSetDescription(cctx *ctx, GDALMajorObjectH mo, char *desc) {
godalWrap(ctx);
GDALSetDescription(mo,desc);
godalUnwrap();
}

void godalSetRasterColorInterpretation(cctx *ctx, GDALRasterBandH bnd, GDALColorInterp ci) {
godalWrap(ctx);
Expand Down Expand Up @@ -735,7 +740,7 @@ void godalFillNoData(cctx *ctx, GDALRasterBandH in, GDALRasterBandH mask, int ma
godalUnwrap();
}

GDALDatasetH godalRasterize(cctx *ctx, char *dstName, GDALDatasetH ds, char **switches) {
GDALDatasetH godalRasterize(cctx *ctx, char *dstName, GDALDatasetH dstDS, GDALDatasetH ds, char **switches) {
godalWrap(ctx);
GDALRasterizeOptions *ropts = GDALRasterizeOptionsNew(switches,nullptr);
if(failed(ctx)) {
Expand All @@ -744,7 +749,7 @@ GDALDatasetH godalRasterize(cctx *ctx, char *dstName, GDALDatasetH ds, char **sw
return nullptr;
}
int usageErr=0;
GDALDatasetH ret = GDALRasterize(dstName, nullptr, ds, ropts, &usageErr);
GDALDatasetH ret = GDALRasterize(dstName, dstDS, ds, ropts, &usageErr);
GDALRasterizeOptionsFree(ropts);
if(ret==nullptr || usageErr!=0) {
forceError(ctx);
Expand Down Expand Up @@ -1679,7 +1684,6 @@ void VSIInstallGoHandler(cctx *ctx, const char *pszPrefix, size_t bufferSize, si
godalUnwrap();
}


void test_godal_error_handling(cctx *ctx) {
godalWrap(ctx);
CPLDebug("godal","this is a debug message");
Expand Down
Loading

0 comments on commit 2de9714

Please sign in to comment.