From 74d8882942e3d904ae16e70dab3f49582bc0dbed Mon Sep 17 00:00:00 2001 From: Pericles Telemachou Date: Thu, 5 Oct 2023 10:37:06 +1100 Subject: [PATCH] Add `GCPSpatialRef` and `GCPProjection` options for `setGCPsOpts` --- options.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/options.go b/options.go index f85747e..8c41008 100644 --- a/options.go +++ b/options.go @@ -1256,6 +1256,8 @@ type NearblackOption interface { type setGCPsOpts struct { errorHandler ErrorHandler + projString string + sr *SpatialRef } // SetGCPsOption is an option that can be passed to Dataset.SetGCPs() @@ -1263,6 +1265,38 @@ type SetGCPsOption interface { setSetGCPsOpt(sgOpt *setGCPsOpts) } +type gcpProjStringOpt struct { + projString string +} + +// GCPProjection sets the projection string as an option for SetGCPs +// +// NOTE: A non-nil `sr` takes precedence over `projString` +func GCPProjection(projStr string) interface { + SetGCPsOption +} { + return gcpProjStringOpt{projString: projStr} +} +func (gps gcpProjStringOpt) setSetGCPsOpt(sgOpt *setGCPsOpts) { + sgOpt.projString = gps.projString +} + +type gcpSpatialRefOpt struct { + sr *SpatialRef +} + +// GCPSpatialRef sets the *SpatialRef as an option for SetGCPs +// +// NOTE: A non-nil `sr` takes precedence over `projString +func GCPSpatialRef(sr *SpatialRef) interface { + SetGCPsOption +} { + return gcpSpatialRefOpt{sr: sr} +} +func (gsr gcpSpatialRefOpt) setSetGCPsOpt(sgOpt *setGCPsOpts) { + sgOpt.sr = gsr.sr +} + // RasterizeGeometryOption is an option that can be passed tp Dataset.RasterizeGeometry() type RasterizeGeometryOption interface { setRasterizeGeometryOpt(o *rasterizeGeometryOpts)