Giter Club home page Giter Club logo

gdal's People

Contributors

andreweland avatar anees-a avatar bayuemu avatar bnoon avatar bradewing avatar byteplane avatar duswie avatar edalevol avatar helmi03 avatar icholy avatar julienr avatar martende avatar mathuin avatar mtfelian avatar ningfc avatar pioneer23 avatar plant99 avatar snamber avatar tbonfort avatar theaschr avatar victor9011 avatar xqueezeme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gdal's Issues

Better document Windows build process?

I would really appreciate it if you filled in some blanks on install of your library. In particular, the GDAL / Go build process on Windows. I can't find pre-built MinGW GDAL builds out there, and Go's linker doesn't appear to support Visual Studio's .lib files. Do you build GDAL from source?

Cannot build on Go 1.17 amd64 Linux - "could not determine kind of name for C.OAMS..."

I'm attempting to build a Go program using this gdal lib on an Amazon EC2 Ubunutu 18.04 instance. I've installed Go directly via downloading Go 1.17.8 from the Go downloads page, and have installed GDAL via sudo apt-get install libgdal-dev. Note, my program builds and runs fine on Mac. I believe I am using the latest go package, my go.mod has:

	github.com/lukeroth/gdal v0.0.0-20211109203239-b571df3ee436

Here's what I get when I do go build:

# github.com/lukeroth/gdal
../../../go/pkg/mod/github.com/lukeroth/[email protected]/osr.go:18:49: could not determine kind of name for C.OAMS_AUTHORITY_COMPLIANT
../../../go/pkg/mod/github.com/lukeroth/[email protected]/osr.go:19:49: could not determine kind of name for C.OAMS_CUSTOM
../../../go/pkg/mod/github.com/lukeroth/[email protected]/osr.go:17:49: could not determine kind of name for C.OAMS_TRADITIONAL_GIS_ORDER
../../../go/pkg/mod/github.com/lukeroth/[email protected]/osr.go:39:39: could not determine kind of name for C.OSRAxisMappingStrategy
../../../go/pkg/mod/github.com/lukeroth/[email protected]/osr.go:39:2: could not determine kind of name for C.OSRSetAxisMappingStrategy

Any guidance on what I may be missing or not doing right would be appreciated. And/or let me know what other info to provide to help. Thanks.

Can't determine if OGR return value is null/nil

In ogr.go, I don't see an exported way to determine if a Feature, Geometry, etc. contains a nil cval. In some functions (e.g. func (layer Layer) NextFeature() Feature) the only way to check for an error or last result is by checking for a nil/null value.

I'm happy to create a pull request if this is just an omission.

Apologies if this is just user error.

Thanks!

OGR Examples of usage

Good day, I am quite new to GIS as a developer, I came across this library as I am somewhat familiar with the Gdal CLI (using ogr2ogr).

I would like to make use of this library but I find it a bit difficult to find some examples of implementation use cases. I currently would like use some of the OGR functions (based of the CLI tool) to make my geometries valid.

I don't know if it would be better on using a database for this operation but one concern I have is that I will be doing this operation for multiple files at the same time, so it might contest my db

nil dereference in reading metadata

In func (dataset *Dataset) Metadata(domain string) []string (gdal.go:687) when the execution reaches the end of the list it panics with nil dereference. For some reason I have observed this behavior on OSX only, but not on linux:

➜  Downloads hdf2tiff HDF4_EOS:EOS_GRID:"MYD10A1.A2008006.h19v02.006.2016142113721.hdf":MOD_Grid_Snow_500m:NDSI_Snow_Cover foo.tiff
unexpected fault address 0xb01dfacedebac1e
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x4005d6e]

goroutine 1 [running]:
runtime.throw(0x40ecae4, 0x5)
	/usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc0000b3af0 sp=0xc0000b3ac0 pc=0x40370d2
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:741 +0x276 fp=0xc0000b3b28 sp=0xc0000b3af0 pc=0x404bf36
indexbytebody(0x554c4f4341544144, 0xebc, 0x0, 0xc0000b3b78, 0xebc, 0x0, 0x554c4f4341544144, 0x554c4f4341544144, 0xebc, 0xc0000b3bd0, ...)
	/usr/local/go/src/internal/bytealg/indexbyte_amd64.s:124 +0xce fp=0xc0000b3b30 sp=0xc0000b3b28 pc=0x4005d6e
runtime.findnull(0x554c4f4341544144, 0x0)
	/usr/local/go/src/runtime/string.go:438 +0x87 fp=0xc0000b3b88 sp=0xc0000b3b30 pc=0x4051d27
runtime.gostring(0x554c4f4341544144, 0x0, 0x0)
	/usr/local/go/src/runtime/string.go:320 +0x2f fp=0xc0000b3be0 sp=0xc0000b3b88 pc=0x4065daf
github.com/lukeroth/gdal._Cfunc_GoString(...)
	_cgo_gotypes.go:3002
github.com/lukeroth/gdal.(*Dataset).Metadata(0xc0000b3d88, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/osklyar/Library/Go/pkg/mod/github.com/osklyar/[email protected]/gdal.go:687 +0x109 fp=0xc0000b3c78 sp=0xc0000b3be0 pc=0x40b3929
github.com/nordicsense/modis/dataset.Open(0x7ffeefbffaf9, 0x62, 0x40eb200, 0xc00008c101, 0xc000082480, 0xc0000486c0)
	/Users/osklyar/Library/Go/pkg/mod/github.com/nordicsense/[email protected]/dataset/file.go:46 +0x45e fp=0xc0000b3e58 sp=0xc0000b3c78 pc=0x40b833e
main.convert(0x7ffeefbffaf9, 0x62, 0x7ffeefbffb5c, 0x8, 0x0, 0x0)
	/Users/osklyar/src/github.com/nordicsense/lstproxy/hdf2tiff/hdf2tiff.go:18 +0x70 fp=0xc0000b3f38 sp=0xc0000b3e58 pc=0x40ba150
main.main()
	/Users/osklyar/src/github.com/nordicsense/lstproxy/hdf2tiff/hdf2tiff.go:12 +0x67 fp=0xc0000b3f88 sp=0xc0000b3f38 pc=0x40ba067
runtime.main()
	/usr/local/go/src/runtime/proc.go:225 +0x256 fp=0xc0000b3fe0 sp=0xc0000b3f88 pc=0x40398f6
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc0000b3fe8 sp=0xc0000b3fe0 pc=0x4068e61

The patch #70 is ready and tested and I will submit a PR separately. It should work equally on linux as it only adds another nil check.

License Clarification and PRs

First off, thanks for this repo! Works great right out of the box! Couple of things:

  1. Can you clarify the license a little? It grants permission to redistribute and extend with attribution but any thoughts on using a more standard MIT or Apache and then adding that clause? Just want to make sure I understand the intent.

  2. There are some good PR's outstanding (specifically the VSI one) to which I've extended on my own branch but wondering if there is active dev going on here or should I fork the repo and continue dev there.

  3. Any thoughts about approaching OSGeo about integrating this into the GDAL baseline? SWIG seems hopelessly broken for golang atm....

Error in go get github.com/lukeroth/gdal

Hi

When I type "go get github.com/lukeroth/gdal" in windows machine, I am getting an error it says
" ..go\src\github.com\lukeroth\gdal\algorithms.go:4:
./go_gdal.h:8:10: fatal error: gdal.h: No such file or directory
#include <gdal.h>
^~~~~~~~
compilation terminated."

However, in cmd window, I can see that gdal is installed and when I type "gdalinfo --version", I can get result that says "GDAL 2.4.1, released 2019/03/15".

I cannot import "github.com/lukeroth/gdal" into my code. How can I solve this problem?

Thanks

Latest commit Gives errorin lines: ogr.go:192 and ogr.go:309

Error details: cannot use pabyData (type unsafe.Pointer) as type *_Ctype_uchar in argument to func literal

The latest commit (6 days ago from this post date) generate these errors when installing/updating:
go get -u github.com/lukeroth/gdal

OS: Ubuntu Bionic 18.04
libgdal-dev: 2.2.3+dfsg-2

Unclear on how to use MajorObject methods (e.g. SetDescription)

Hi, hopefully just a quick question. I'm trying to set the description of a raster layer. In Python you can just call SetDescription on the raster band. But in GDAL/this library, I see SetDescription is a method on MajorObject. I'm not clear how I'd convert the RasterBand or what my path is to setting the description for the band. Can you clue me in?

constant 2147483649 overflows GeometryType

for gdal 1.9.1 from source

go build
...
ogr.go:40[/tmp/go-build455994692/github.com/lukeroth/gdal_go/_obj/ogr.cgo1.go:39]: constant 2147483649 overflows GeometryType
...

ogr.go geometry.ToJSON risks memory leak

// Convert a geometry to JSON format
func (geom Geometry) ToJSON() string {
val := C.OGR_G_ExportToJson(geom.cval)
defer C.free(unsafe.Pointer(val)) // this line maybe is missing
return C.GoString(val)
}

BuildVrt

Thank you for providing the GDAL API. Can you provide me with some examples? I was not successful in using gdal.BuildVRT() from the examples. I want to achieve the following effect:

fn warped_vrt(&self, sp_ref: &SpatialRef) -> Result<Dataset, Box<dyn Error>> {
    let src_wkt = CString::new(self.ds.spatial_ref()?.to_wkt()?)?;
    let target_wkt = CString::new(sp_ref.to_wkt()?)?;

    let mut str_opts = CslStringList::new();
    str_opts.set_name_value("INIT_DEST", "NO_DATA")?;
    str_opts.set_name_value("NUM_THREADS", "1")?;

    let mut options = unsafe { GDALCreateWarpOptions() };
    
    unsafe { (*options).dfWarpMemoryLimit = 2048. * 1024. * 1024. };
    unsafe {
        (*options).papszWarpOptions = str_opts.as_ptr();
    }

    let vrt: GDALDatasetH = unsafe {
        GDALAutoCreateWarpedVRT(
            self.ds.c_dataset(),
            src_wkt.as_ptr(),
            target_wkt.as_ptr(),
            GDALResampleAlg::GRA_NearestNeighbour,
            0. as c_double,
            options,
        )
    };

    if vrt.is_null() {
        return Err(String::from("could not create WarpedVRT").into());
    }

    let gdal_dataset = unsafe { GDALDataset::from_c_dataset(vrt) };
    Ok(Dataset { ds: gdal_dataset })
}

There is a bug with data type conversion during install

../work/src/github.com/lukeroth/gdal/ogr.go:1252: cannot use C.GIntBig(fid) (type C.GIntBig) as type C.long in argument to _Cfunc_OGR_F_SetFID
../work/src/github.com/lukeroth/gdal/ogr.go:1343: cannot use C.GIntBig(index) (type C.GIntBig) as type C.long in argument to _Cfunc_OGR_L_SetNextByIndex
../work/src/github.com/lukeroth/gdal/ogr.go:1348: cannot use C.GIntBig(index) (type C.GIntBig) as type C.long in argument to _Cfunc_OGR_L_GetFeature
../work/src/github.com/lukeroth/gdal/ogr.go:1364: cannot use C.GIntBig(index) (type C.GIntBig) as type C.long in argument to _Cfunc_OGR_L_DeleteFeature

Why does it say `Unimplemented: PointOn Surface (until 2.0)`?

The following code is commented out.

// Unimplemented: PointOn Surface (until 2.0)
// Return a point guaranteed to lie on the surface
// func (geom Geometry) PointOnSurface() Geometry {
//  newGeom := C.OGR_G_PointOnSurface(geom.cval)
//  return Geometry{newGeom}
// }

As per gdal, the API is supported since 1.0. I am confused as to why this is the case here. @lukeroth Can you please shed some light?

More tutorials needed

It's good to see the package is still under development,
to reach a higher popularity definitely more tutorial needed :)

Feature request: clip vector layers using OGR

Hello everyone,

I'm planning to clip a vector layer using a raster extent using this library. However, I noticed in this line that it is currently unimplemented.

This is my original command when using ogr2ogr

$ ogr2ogr out.shp in.shp  -clipsrc <extent>

I would like to ask:

  1. When will the OGR Clip feature be implemented?
  2. Is it possible to achieve the task above with the current feature set?

Thank you very much @lukeroth and I appreciate your effort for this library!

Error installing: could not determine kind of name for C.OPTGetParameterInfo

Hello! I am having difficulty running go get github.com/lukeroth/gdal and I was hoping you'd be able to help. Below is the output:

zacharymanesiotis@MacBook-Pro ~ $ go get github.com/lukeroth/gdal
# github.com/lukeroth/gdal
go/src/github.com/lukeroth/gdal/osr.go:1256:13: could not determine kind of name for C.OPTGetParameterInfo
go/src/github.com/lukeroth/gdal/osr.go:1220:7: could not determine kind of name for C.OPTGetParameterList
go/src/github.com/lukeroth/gdal/osr.go:1198:7: could not determine kind of name for C.OPTGetProjectionMethods
go/src/github.com/lukeroth/gdal/osr.go:115:9: could not determine kind of name for C.OSRFixup
go/src/github.com/lukeroth/gdal/osr.go:110:9: could not determine kind of name for C.OSRFixupOrdering
go/src/github.com/lukeroth/gdal/osr.go:120:9: could not determine kind of name for C.OSRStripCTParms

gdal 3.* version cannot be compiled

The gdal 3.* version cannot be compiled, and the error is as follows:
.\osr.go:1256:13: could not determine kind of name for C.OPTGetParameterInfo
.\osr.go:1220:7: could not determine kind of name for C.OPTGetParameterList
.\osr.go:1198:7: could not determine kind of name for C.OPTGetProjectionMethods
.\osr.go:115:9: could not determine kind of name for C.OSRFixup
.\osr.go:110:9: could not determine kind of name for C.OSRFixupOrdering
.\osr.go:120:9: could not determine kind of name for C.OSRStripCTParms

Call PrimeMeridian& AngularUnits & AngularUnits... *** Error in `/tmp/go-build1686810055/b001/exe/main': free(): invalid pointer: 0x00000000012d41f8 ***

goroutine 1 [syscall]:
runtime.cgocall(0x4ab8f0, 0xc000046db8)
/usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc000046d90 sp=0xc000046d58 pc=0x415cfc
github.com/lukeroth/gdal._Cfunc_free(0x12d41f8)
_cgo_gotypes.go:7683 +0x45 fp=0xc000046db8 sp=0xc000046d90 pc=0x4a9785
github.com/lukeroth/gdal.SpatialReference.PrimeMeridian.func2.1()
/home/goproject/pkg/mod/github.com/tingold/[email protected]/osr.go:319 +0x3b fp=0xc000046df0 sp=0xc000046db8 pc=0x4aa0bb

RegenerateOverviews use have error

I am using RegenerateOverviews when running when this error occurs, the following is my code, has been gdal error message, this is because of what caused?

func ScaleQueryToTile() NextTileJobFunc {
	return func(next TileJobFunc) TileJobFunc {
		return func(info *GeoQueryGdalJobInfo) error {
			fmt.Printf("[3/5] ScaleQueryToTile\n")
			for i := 0; i < info.BandCount; i++ {
				dsQueryBand := info.dsQuery.RasterBand(i + 1)
				dstBand := info.dsTile.RasterBand(i + 1)
				err := dsQueryBand.RegenerateOverviews(4, &dstBand, "average", gdal.DummyProgress, nil)
				if err != nil {
					return err
				}
			}
			return next(info)
		}
	}
}
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x54 pc=0x10248cee8]

GCPs not supported

Hi,

it likes like from gdal.go that GCPs are not supported:
// Unimplemented: GDALGetGCPProjection // Unimplemented: GDALGetGCPs // Unimplemented: GDALSetGCPs

Is there a reason for this? Is this on the todo list, or is there no interest in doing it or have I screwed up and missed where they are handled?

Thanks,

Matt

Examples available for reading from RasterBand?

Hi, not an issue, but having trouble getting any guidance elsewhere on the web (probably due to the small and esoteric group who need this functionality), so apologies for that. I'm trying to read from a band consisting of float64/DOUBLE values… the Python example here is analogous to what I'm trying to accomplish. The closest equivalent, I'm guessing, to their library's ReadAsArray method is the RasterBand.ReadBlock(…) function, which I cannot get to work without causing a panic. I know the documentation is sparse (and understand why) but is there a gist or other example somewhere that might get me over that gap? Many thanks.

another small problem

Idea plugin dont understand name difference

"github.com/lukeroth/gdal_go"

and

gdal as package

i should write

import "github.com/lukeroth/gdal_go/gdal"

but i kant build it ofcourse

if i fix package name to gdal
all works perfect

gdal.SpatialReference.Destroy() panics (possible memory leak)

After creating a SpatialReference with gdal.CreateSpatialReference(), the SpatialReference cannot be destroyed without a panic. The error message is "error for object 0x760f760: pointer being freed was not allocated".

I'm not sure why this won't work since the SpatialReference seems to store the handle from the underlying OSRNewSpatialReference function and use it in the call to OSRDestroySpatialReference:

sref := gdal.CreateSpatialReference("")
... use the spatial reference ...
sref.Destroy() // panics

fatal error: gdal.h: No such file or directory

Hi! I have erorr:

go build cmd/main.go
# github.com/lukeroth/gdal
/root/go/pkg/mod/github.com/lukeroth/[email protected]/gdal.go:44:11: cannot define new methods on non-local type C.CPLErr
/root/go/pkg/mod/github.com/lukeroth/[email protected]/gdal.go:60:11: cannot define new methods on non-local type C.OGRErr
In file included from /root/go/pkg/mod/github.com/lukeroth/[email protected]/algorithms.go:4:0:
./go_gdal.h:8:10: fatal error: gdal.h: No such file or directory
 #include <gdal.h>
          ^~~~~~~~
compilation terminated.

I tried to solve this problem, like here https://stackoverflow.com/questions/72887400/install-gdal-on-linux-ubuntu-20-04-4lts-for-python but it didnt help.

I tried to fix troubles with gdall library, I installed on OS:

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin
sudo apt-get install libgdal-dev

But it didnt help.

Whitch GDAL version I have at present time:

apt list --installed | grep "gdal"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

gdal-bin/bionic,now 2.2.3+dfsg-2 arm64 [installed]
gdal-data/bionic,now 2.2.3+dfsg-2 all [installed,automatic]
libgdal-dev/bionic,now 2.2.3+dfsg-2 arm64 [installed]
libgdal20/bionic,now 2.2.3+dfsg-2 arm64 [installed,automatic]


gdalinfo --version
GDAL 2.2.3, released 2017/11/20

If we speak about another libraries, which we need to install near GDAL, I installed them in Docker container via command:

RUN apt-get update && apt-get upgrade -yy && apt-get install -yy \
    wget \
    git \
    build-essential \
    git \
    clang-3.8 \
    libpng-dev \
    libopencv-dev \
    libgeos-dev \
    libproj-dev && \
    apt remove cmake -y && \
    pip3 install --upgrade pip && \
    pip3 install cmake --upgrade && \
    apt autoremove -y

Version of Ubuntu:

 lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic

get fails for gdal 2.0

[documentation states only gdal 1.11 has been tested; this is just a warning note to users of current 2.0]
June 2015 GDAL/OGR 2.0.0 release

# github.com/lukeroth/gdal
lukeroth/gdal/gdal.go: In function ‘_cgo_6a4191d94aa1_Cfunc_GDALGetDefaultHistogram’:
lukeroth/gdal/gdal.go:760:2: warning: ‘GDALGetDefaultHistogram’ is deprecated [-Wdeprecated-declarations]
# github.com/lukeroth/gdal
lukeroth/gdal/ogr.go:1238: cannot use C.long(fid) (type C.long) as type C.GIntBig in argument to _Cfunc_OGR_F_SetFID
lukeroth/gdal/ogr.go:1329: cannot use C.long(index) (type C.long) as type C.GIntBig in argument to _Cfunc_OGR_L_SetNextByIndex
lukeroth/gdal/ogr.go:1334: cannot use C.long(index) (type C.long) as type C.GIntBig in argument to _Cfunc_OGR_L_GetFeature
lukeroth/gdal/ogr.go:1350: cannot use C.long(index) (type C.long) as type C.GIntBig in argument to _Cfunc_OGR_L_DeleteFeature

https://svn.osgeo.org/gdal/branches/2.0/gdal/MIGRATION_GUIDE.TXT

GDALTriangulationCreateDelaunay() unavailable since GDAL built without QHull support

When running go test -v,

the following error is raised:

=== RUN   TestGridCreate
Calling gdal.GridCreate
ERROR 6: GDALTriangulationCreateDelaunay() unavailable since GDAL built without QHull support
    TestGridCreate: algorithms_test.go:75: GridCreate: Failure Error
--- FAIL: TestGridCreate (0.06s)
=== RUN   TestTiffDriver
--- PASS: TestTiffDriver (0.00s)
=== RUN   TestMissingMetadata
--- PASS: TestMissingMetadata (0.01s)
=== RUN   TestVectorTranslate
--- PASS: TestVectorTranslate (0.01s)
=== RUN   TestRasterize
--- PASS: TestRasterize (0.00s)
=== RUN   TestWarp
--- PASS: TestWarp (0.33s)
=== RUN   TestTranslate
--- PASS: TestTranslate (0.05s)
FAIL
exit status 1
FAIL    github.com/lukeroth/gdal        0.508s

i have some funcs added

can i also write in your repo ? im writing now one app with gdal and on the fly add / change bugs in your lib . i think it can be useffull

BUILD on Mac M1, Return ERROR: ld: symbol(s) not found for architecture arm64

OS version = macOS Big Sur 11.6
CPU = Apple M1

$go get github.com/lukeroth/gdal
# github.com/lukeroth/gdal
Undefined symbols for architecture arm64:
"_CPLGetConfigOption", referenced from:
__cgo_20816c41b399_Cfunc_CPLGetConfigOption in _x003.o
(maybe you meant: __cgo_20816c41b399_Cfunc_CPLGetConfigOption)
"_CPLSetConfigOption", referenced from:
__cgo_20816c41b399_Cfunc_CPLSetConfigOption in _x003.o
(maybe you meant: __cgo_20816c41b399_Cfunc_CPLSetConfigOption)
"_GDALAddBand", referenced from:
__cgo_20816c41b399_Cfunc_GDALAddBand in _x003.o
(maybe you meant: __cgo_20816c41b399_Cfunc_GDALAddBand)
"_GDALAllRegister", referenced from:
__cgo_20816c41b399_Cfunc_GDALAllRegister in _x003.o
(maybe you meant: __cgo_20816c41b399_Cfunc_GDALAllRegister)
..................
"_VSIFOpenL", referenced from:
__cgo_20816c41b399_Cfunc_VSIFOpenL in _x003.o
(maybe you meant: __cgo_20816c41b399_Cfunc_VSIFOpenL)
"_VSIFReadL", referenced from:
__cgo_20816c41b399_Cfunc_VSIFReadL in _x003.o
(maybe you meant: __cgo_20816c41b399_Cfunc_VSIFReadL)
"_VSIReadDirRecursive", referenced from:
__cgo_20816c41b399_Cfunc_VSIReadDirRecursive in _x003.o
(maybe you meant: __cgo_20816c41b399_Cfunc_VSIReadDirRecursive)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

examples of usage

Good night, I liked the library and I think it will serve me well. Could you share an example of using this function with the InverseDistanceToAPowerNearestNeighbor algorithm? wanted to return to see the result and saved the result in a .geojson file

func GridCreate(

Should be use C.CPLFree to release some pointer malloced by GDAL it self.

I got an exception when debug with function ToWKT,
// Fetch geometry as WKT func (geom Geometry) ToWKT() (string, error) { var p *C.char err := C.OGR_G_ExportToWkt(geom.cval, &p).Err() wkt := C.GoString(p) defer C.free(unsafe.Pointer(p)) // <--- Exception at this line return wkt, err }
image
I think this pointer should be release by use CPLFree. And I try to change C.free to C.CPLFree, it works.

docker cant`t run

I get osgeo/gdal:alpine-ultrasmall-3.0.2 from dockerhub.

when i docker run , it loading shared library libgdal.so.26, but osgeo/gdal:alpine-ultrasmall-3.0.2 has`t this dynamic library.

libgdal.so libgdal.so.3 libgdal.so.3.0.2

Change Dataset Property C++

Hi everyone,

I m loading an image as "JPG" and convert to "BMP" with saving hard drive. But I need that is without saving harddrive. I would like to do read "JPG" image and convert GDALDataset without saving hard drive?

Has any idea about it ?

install bindings on debian 9 and fedora 32

Trying to build example results in this error (go 1.7)

root@02fa1aeeeb6f:/5/src/github.com/lukeroth/gdal/examples/test_tiff# go build
# github.com/lukeroth/gdal
could not determine kind of name for C.OGR_G_Distance3D
root@02fa1aeeeb6f:/5/src/github.com/lukeroth/gdal/examples/test_tiff# gdal-config --version    
2.1.2
root@02fa1aeeeb6f:/5/src/github.com/lukeroth/gdal/examples/test_tiff# echo $GOPATH
/5

Fedora 32 (go v1.14) gives more errors:

> go build
# github.com/lukeroth/gdal
../../osr.go:1256:13: could not determine kind of name for C.OPTGetParameterInfo
../../osr.go:1220:7: could not determine kind of name for C.OPTGetParameterList
../../osr.go:1198:7: could not determine kind of name for C.OPTGetProjectionMethods
../../osr.go:115:9: could not determine kind of name for C.OSRFixup
../../osr.go:110:9: could not determine kind of name for C.OSRFixupOrdering
../../osr.go:120:9: could not determine kind of name for C.OSRStripCTParms
>  gdalinfo --version
GDAL 3.0.4, released 2020/01/28

What I do wrong? How I can fix it?

hi, i go get it find some error? how can i deal with that? thanks

github.com/lukeroth/gdal

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQcmdStatus@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQfname@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQsetNoticeProcessor@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQftable@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQstatus@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQftablecol@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQconnectdb@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQescapeStringConn@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to lo_close@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQputCopyEnd@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQgetvalue@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQgetisnull@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQftype@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQfmod@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to lo_creat@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQresultStatus@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to lo_read@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQexec@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQsetClientEncoding@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQgetlength@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQputCopyData@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQgetResult@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to lo_write@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQfinish@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQclear@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQerrorMessage@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQnfields@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to lo_open@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQexecParams@RHPG_9.6' /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to PQntuples@RHPG_9.6'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libgdal.so: undefined reference to `PQresultErrorMessage@RHPG_9.6'

Support M Value Geometry Types

Upon trying to create a feature from a wkt geometry definition it appears this gdal wrapper doesn't support M dimensions. I'd love to make a pull if its just some mapping of type definitions but I don't know where to start. Basically when I use

geomw,err := gdal.CreateFromWKT(wkt,srs)

The type always get mutated to 3002 normal LineString no matter what the wkt is which it is a LINESTRING ZM. I glanced at the code and it looks like right now I'd have to mess with some CGO definitions to support this. Any tips on where to start? Or is it a GDAL config thing?

Problem on Ubuntu with pkg-config

It seems Ubuntu doesn't install a gdal.pc into /usr/lib/pkgconfig/

This worked for me (values obtained from gdal-config):

$ cat /usr/lib/pkgconfig/gdal.pc 
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${exec_prefix}/include
datadir=/usr/share/gdal/1.9

Name: libgdal
Description: Geospatial Data Abstraction Library
Version: 1.9.0
Libs: -L/usr/lib -lgdal
Cflags: -I/usr/include/gdal

Here's a gist that'll install a gdal.pc

Go 1.21 issue

Hello this error popped up after I upgraded to go 1.21

github.com/lukeroth/[email protected]/algorithms.go:528:4: unknown field nSizeOfStructure in struct literal of type _Ctype_struct___3

I tried to clear my mod cache and go mod tidy again but I keep getting the same error.

Thanks!

go_vet tools/extract.go: invalid syntax

Hi,

I'm indexing go packages at http://libs.club/golang and during the code quality report phase (using this) the following error appeared:

(go_vet) strconv.ParseInt: parsing "lukeroth/gdal/tools/extract.go": invalid syntax

This file looks mostly useless so there's no consequence whatsoever but I thought I'd let you know.

PS: Your package is not up on the aforementioned website because I've not published the category related to geocoding yet 😅

RasterBand IO() fails to deduce buffer data type, aborts

The type swtich at the top of RasterBand IO() (gdal.go:1130) used to guess the appropriate GDAL data type for the buffer fails if passed a sized array, aborting the IO() function and returning an error string.

This can be verified by using the examples/test_tiff code to try to write a dataset using this function. No data will be written.

The following code demonstrates the failure of a type switch in this situation. You can see that the reflect package gets it right, while the type switch fails to identify the type of the sized array buffer. However, if declared as an array of unknown size then assigned a slice the type switch will work as intended.

package main

import (
	"fmt"
	"reflect"
)

func readType(buffer interface{}) {
	fmt.Println("reflect got ", reflect.TypeOf(buffer))
	
	switch buffer.(type) {
	case []uint8:
		fmt.Println("switch got []uint8")
	case []float32:
		fmt.Println("switch got []float32")
	default:
		fmt.Println("switch got unknown?")
	}
}

func main() {
	const bufsize = 256

	// Declaring the buffer as a sized array (as done in test_tiff.go)
	// will result in the type switch failing.
	var buffer [bufsize]uint8
	readType(buffer)

	// Declaring the buffer as an array of unknown size then assigning
	// it a sized slice will allow the type switch to work as intended.
	var buffer2 []uint8
	buffer2 = make([]uint8, bufsize)
	readType(buffer2)
}

err as nil

I would suggest all functions that return error write in go style

if no error return err = nil

what do you think ?

More compile issues.

go get github.com/lukeroth/gdal

github.com/lukeroth/gdal

../go/pkg/mod/github.com/lukeroth/[email protected]/ogr.go:1278:55: cannot use _cgo3 (type *_Ctype_uchar) as type unsafe.Pointer in argument to _Cfunc_OGR_F_SetFieldBinary

libgdal-dev/focal,focal,now 3.0.4+dfsg-1build3 amd64 [installed]

go version 1.16.2

Thanks,
Matt

Undefined reference to gzopen64

I'm getting the following error when running go build

# github.com/lukeroth/gdal
//usr/lib/x86_64-linux-gnu/libxml2.so.2: undefined reference to `gzopen64@ZLIB_1.2.3.3'
collect2: error: ld returned 1 exit status

I'm on ubuntu 14.04:

gdal packages I have installed

gdal            1.10.1-1            
gdal-bin        1.10.0-1~precise2   
libgdal-dev     1.10.0-1~precise2   
libgdal1        1.9.0-3.1~pgdg12.4+1
libgdal1-1.7.0  1.7.3-6ubuntu3      
libgdal1-dev    1.10.0-1~precise2   
libgdal1h       1.10.0-1~precise2   

libxml2 packages I have installed

libxml2:amd64      2.9.1+dfsg1-3ubuntu4           
libxml2:i386       2.9.1+dfsg1-3ubuntu4           
libxml2-dev:amd64  2.9.1+dfsg1-3ubuntu4           
libxml2-utils      2.8.0+dfsg1-5ubuntu2.2~precise1 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.