Skip to content

Commit

Permalink
run gdalallregister during module initialisation (#124)
Browse files Browse the repository at this point in the history
* Added `gdaldestroy` at exit and commented `cplseterrorhandler(C_NULL)` and trial wih `gdaldumpopendatasets` at exit

* Suppressed comments in epilogue.jl

* put changes into GDAL.jl, bump patch version

* run gdalallregister in init

Co-authored-by: Martijn Visser <[email protected]>
  • Loading branch information
mathieu17g and visr authored Oct 10, 2021
1 parent 10815fd commit 3838e93
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "add2ef01-049f-52c4-9ee2-e494f65e021a"
keywords = ["GDAL", "IO"]
license = "MIT"
desc = "Wrapper for GDAL - Geospatial Data Abstraction Library"
version = "1.2.4"
version = "1.2.5"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

Julia wrapper for [GDAL - Geospatial Data Abstraction Library](http://gdal.org/). This
package is a binding to the C API of GDAL/OGR. It provides only a C style usage, where
resources must be closed manually, and datasets are pointers. *Note: this also means that
before being able to use any drivers (for input/output of different formats), they must be
registered first using `GDAL.gdalallregister()`.*
resources must be closed manually, and datasets are pointers.

Other packages can build on top of this to provide a more Julian user experience. See for
example [ArchGDAL.jl](https://github.com/yeesian/ArchGDAL.jl).
Expand Down
4 changes: 3 additions & 1 deletion gen/epilogue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function __init__()
# register custom error handler
funcptr = @cfunction(gdaljl_errorhandler, Ptr{Cvoid}, (CPLErr, Cint, Cstring))
cplseterrorhandler(funcptr)
atexit(() -> cplseterrorhandler(C_NULL))

# get GDAL version number
versionstring = gdalversioninfo("RELEASE_NAME")
Expand All @@ -31,4 +30,7 @@ function __init__()
# set PROJ_LIB location, this overrides setting the environment variable
PROJ_LIB[] = joinpath(PROJ_jll.artifact_dir, "share", "proj")
osrsetprojsearchpaths([PROJ_LIB[]])

# register all known configured GDAL drivers
gdalallregister()
end
1 change: 1 addition & 0 deletions src/GDAL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33010,6 +33010,7 @@ function __init__()
end
PROJ_LIB[] = joinpath(PROJ_jll.artifact_dir, "share", "proj")
osrsetprojsearchpaths([PROJ_LIB[]])
gdalallregister()
end

end
3 changes: 0 additions & 3 deletions test/tutorial_raster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ using GDAL
utmsmall = joinpath(@__DIR__, "data/utmsmall.tif")
utmsmall_copy = joinpath(@__DIR__, "tmp/utmsmall.tif")

# needed to actually load tifs
GDAL.gdalallregister()

# Opening the File
dataset = GDAL.gdalopen(utmsmall, GDAL.GA_ReadOnly) # file from GDAL SVN

Expand Down

2 comments on commit 3838e93

@visr
Copy link
Member

@visr visr commented on 3838e93 Oct 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/46442

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.5 -m "<description of version>" 3838e938642712cf8a98c52df5937dcfdb19221e
git push origin v1.2.5

Please sign in to comment.