------------- About ------------- The gdal.go package provides a go wrapper for GDAL, the Geospatial Data Abstraction Library. More information about GDAL can be found at http://www.gdal.org ------------- Installation ------------- 1) go get github.com/lukeroth/gdal 2) Set the GDAL library and include directories to the appropriate locations. 3) go build ------------- Compatibility ------------- This software has been tested most recently on Ubuntu 18.10, GDAL version 2.3.2. ------------- Examples ------------- ------------- Status (3/08/2019) ------------- The majority of GDAL functionality exposed by the C API is available, as well as much of the OGR API. Most functionality is not covered by tests or benchmarks.
Go (golang) wrapper for GDAL, the Geospatial Data Abstraction Library
Comments
-
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?
-
ComputeProximity returns "Failure Error"
https://github.com/mathuin/terroir/blob/map-package/carto/bathy.go
I'm getting "Failure Error" with no text, which according to the source code for GDAL 1.11.0 means there's something wrong with my buffers. I can't figure out what's wrong.
I'm trying to make a simpler test case, if I can, I'll attach it to this issue.
-
removed methods that are no longer supported in 3.x versions of GDAL
Removed references to methods no longer supported in GDAL 3.x. Recommend pinning the version of this library to the version of the underling gdal library.
-
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:
- When will the OGR Clip feature be implemented?
- 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!
-
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
-
GIntBig => long
Installing on OS X. gdal installed with brew
gdal git:(master) brew info gdal gdal: stable 1.11.3 (bottled), HEAD GDAL: Geospatial Data Abstraction Library http://www.gdal.org/ /usr/local/Cellar/gdal/1.11.2_3 (230 files, 32.0M) * Poured from bottle From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/gdal.rb ==> Dependencies Required: libpng ✘, jpeg ✔, giflib ✔, libtiff ✘, libgeotiff ✔, proj ✘, geos ✘, sqlite ✘, freexl ✔, libspatialite ✘ Optional: postgresql ✘, mysql ✘ ==> Options --with-armadillo Build with Armadillo accelerated TPS transforms. --with-complete Use additional Homebrew libraries to provide more drivers. --with-java Build with java support --with-libkml Build with Google's libkml driver (requires libkml --HEAD or >= 1.3) --with-mdb Build with Access MDB driver (requires Java 1.6+ JDK/JRE, from Apple or Oracle). --with-mysql Build with mysql support --with-opencl Build with OpenCL acceleration. --with-postgresql Build with postgresql support --with-python3 Build with python3 support --with-swig-java Build the swig java bindings --with-unsupported Allow configure to drag in any library it can find. Invoke this at your own risk. --without-python Build without python2 support --HEAD Install HEAD version
Got
go get github.com/lukeroth/gdal # github.com/lukeroth/gdal ../../../lukeroth/gdal/ogr.go:1252: cannot use C.GIntBig(fid) (type C.GIntBig) as type C.long in argument to _Cfunc_OGR_F_SetFID ../../../lukeroth/gdal/ogr.go:1343: cannot use C.GIntBig(index) (type C.GIntBig) as type C.long in argument to _Cfunc_OGR_L_SetNextByIndex ../../../lukeroth/gdal/ogr.go:1348: cannot use C.GIntBig(index) (type C.GIntBig) as type C.long in argument to _Cfunc_OGR_L_GetFeature ../../../lukeroth/gdal/ogr.go:1364: cannot use C.GIntBig(index) (type C.GIntBig) as type C.long in argument to _Cfunc_OGR_L_DeleteFeature
-
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 nilcval
. 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!
-
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)
-
License Clarification and PRs
First off, thanks for this repo! Works great right out of the box! Couple of things:
-
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.
-
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.
-
Any thoughts about approaching OSGeo about integrating this into the GDAL baseline? SWIG seems hopelessly broken for golang atm....
-
-
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 :sweat_smile:
-
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
-
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
-
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 theRasterBand.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. -
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.
-
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
-
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 onMajorObject
. I'm not clear how I'd convert theRasterBand
or what my path is to setting the description for the band. Can you clue me in? -
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 }
I think this pointer should be release by use CPLFree. And I try to change C.free to C.CPLFree, it works.
Related tags
Real-time Geospatial and Geofencing
Tile38 is an open source (MIT licensed), in-memory geolocation data store, spatial index, and realtime geofence. It supports a variety of object types
Publish Your GIS Data(Vector Data) to PostGIS and Geoserver
GISManager Publish Your GIS Data(Vector Data) to PostGIS and Geoserver How to install: go get -v github.com/hishamkaram/gismanager Usage: testdata fol
General purpose library for reading, writing and working with OpenStreetMap data
osm This package is a general purpose library for reading, writing and working with OpenStreetMap data in Go (golang). It has the ability to read OSM
A library provides spatial data and geometric algorithms
Geoos Our organization spatial-go is officially established! The first open source project Geoos(Using Golang) provides spatial data and geometric alg
Go package to quick and easy create json data in geojson format.
#GEOJSON Go package to easy and quick create datastructure which can be serialized to geojson format INSTALLATION $ go get github.com/kpawlik/geojson
Geometry/geography library in Go, DEPRECATED, use ->
go.geo (deprecated) Go.geo is a geometry/geography library in Go. The primary use case is GIS geometry manipulation on the server side vs. in the brow
Go bindings for the Cartographic Projections Library PROJ.4
The Go package proj provides a limited interface to the Cartographic Projections Library PROJ. For PROJ version 5 and beyond, see also: https://github
geoserver is a Go library for manipulating a GeoServer instance via the GeoServer REST API.
Geoserver geoserver Is a Go Package For Manipulating a GeoServer Instance via the GeoServer REST API. How to install: go get -v gopkg.in/hishamkaram/g
S2 geometry library in Go
Overview S2 is a library for spherical geometry that aims to have the same robustness, flexibility, and performance as the best planar geometry librar
Efficient 2D geometry library for Go.
geometry An efficient 2D geometry library for Go. Features Point, Rect, Line, and Polygon geometry types Operations such as Intersects, Contains, and
Types and utilities for working with 2d geometry in Golang
orb Package orb defines a set of types for working with 2d geo and planar/projected geometric data in Golang. There are a set of sub-packages that use
Bidirectional UTM-WGS84 converter for golang :earth_africa: :globe_with_meridians:
UTM Bidirectional UTM-WGS84 converter for golang. It use logic from UTM python version by Tobias Bieniek Usage go get github.com/im7mortal/UTM Conver
OpenStreetMap PBF golang parser
pbf OpenStreetMap PBF golang encoder/decoder A golang based OpenStreetMap PBF encoder/decoder with a handy command line utility, pbf. pbf Command Line
Golang bindings for GDAL
Golang bindings for GDAL Goals Godal aims at providing an idiomatic go wrapper around the GDAL library: Function calls return a result and an error.
High abstraction wrapper for Golang Rabbit MQ Client
GRMQ Go Rabbit MQ What are the typical use-cases of RabbitMQ broker ? We create
BuntDB is an embeddable, in-memory key/value database for Go with custom indexing and geospatial support
BuntDB is a low-level, in-memory, key/value store in pure Go. It persists to disk, is ACID compliant, and uses locking for multiple readers and a sing
Package geom implements efficient geometry types for geospatial applications.
go-geom Package geom implements efficient geometry types for geospatial applications. Key features OpenGeo Consortium-style geometries. Support for 2D
Real-time Geospatial and Geofencing
Tile38 is an open source (MIT licensed), in-memory geolocation data store, spatial index, and realtime geofence. It supports a variety of object types
Real-time Geospatial and Geofencing
Tile38 is an open source (MIT licensed), in-memory geolocation data store, spatial index, and realtime geofence. It supports a variety of object types
Real-time Geospatial and Geofencing
Tile38 is an open source (MIT licensed), in-memory geolocation data store, spatial index, and realtime geofence. It supports a variety of object types