albertov / bindings-gdal Goto Github PK
View Code? Open in Web Editor NEWHaskell bindings to the GDAL library
License: BSD 3-Clause "New" or "Revised" License
Haskell bindings to the GDAL library
License: BSD 3-Clause "New" or "Revised" License
To prevent issues like #6
Conduit addCleanup
function was removed in conduit-1.3.0
, as discussed here:
However bindings-gdal still use them in GDAL/Internal/Layer.chs
https://github.com/albertov/bindings-gdal/blob/master/src/GDAL/Internal/Layer.chs#L380
$ gdal-config --version
2.2.1
$ stack build --flag bindings-gdal:examples
bindings-gdal-2.1.1.1: build (lib + exe)
Preprocessing library bindings-gdal-2.1.1.1...
Preprocessing executable 'ogrinfo-hs' for bindings-gdal-2.1.1.1...
Preprocessing executable 'rasterstats-hs' for bindings-gdal-2.1.1.1...
Linking .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0/build/rasterstats-hs/rasterstats-hs ...
/home/greghorn/hslibs/bindings-gdal/.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0/build/libHSbindings-gdal-2.1.1.1-4fDT7HjJSKi7IYJavM3faa.a(overviews.o): In function `hs_gdal_create_overview_dataset':
/home/greghorn/hslibs/bindings-gdal/cbits/overviews.cpp:41:0: error:
undefined reference to `GDALCreateOverviewDataset(GDALDataset*, int, int)'
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
-- While building package bindings-gdal-2.1.1.1 using:
/home/greghorn/hslibs/bindings-gdal/.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.2.0 build lib:bindings-gdal exe:ogrinfo-hs exe:rasterstats-hs --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Any clue why this is happening? An older version of bindings-gdal
works fine for me.
Here's the upstream issue: haskell/c2hs#192. This is affecting many projects.
The ongoing saga:
visq/language-c#39
visq/language-c#43
Not sure if there is a workaround but posting in case anyone else is tripped up by this.
Based on this pull request: #18, I setup the following patch: https://github.com/guibou/bindings-gdal/tree/gdal_2_3_1_failure. Theses commands are failing (segmentation fault apparently):
nix-build -A bindings-gdal_2_3_1
nix-build -A bindings-gdal_2_4_0
However nix-build -A bindings-gdal_1_11
and nix-build -A bindings-gdal
(without the patch) are building and tests are passing correctly.
I suspect a change in gdal-2.3.1
is responsible for the failure.
this build failed - https://travis-ci.org/meteogrid/bindings-gdal/jobs/111403295 - because of this function
worth investigating why; as when you just re-run the tests it doesn't fail.
Could you upload a version on hackage? It will ease the use of bindings-gdal
with tools such as cabal
, stack
or nix
.
For some reason I can't get this to build on OS X, the issue seems to be with cbits/errorhandler.h
, but I can't see (or find out) why. It doesn't appear to be a problem with finding the gdal libs and headers (I've tried explicitly setting them with --extra-{include, lib}-dirs=
, both with my gdal install from homebrew and using the version installed with the install_gdal.sh
script. stack-output.txt is the output from running stack build -v
. Happy to help debug this if you have any ideas.
Hello, I'm trying to do some SQL requests against a shapefile, but I'm not sure how to do it.
main :: IO ()
main = do
withGDAL $ runGDAL_ $ do
ds <- OGR.openReadOnly "ne_10m_admin_0_countries.shp"
let src = sourceLayer_ $ executeSQL DefaultDialect "SELECT * FROM fondo" Nothing ds
(fs :: [Feature]) <- runOGR (src $$ CL.consume)
This throws me a compilation error:
Couldn't match type ‘l0’ with ‘l’
because type variable ‘l’ would escape its scope
This (rigid, skolem) type variable is bound by
a type expected by the context: OGR s l [Feature]
at app/Main.hs:45:28-53
Expected type: Source (OGR s l) Feature
Actual type: OGRSource s l0 Feature
Relevant bindings include
src :: OGRSource s l0 Feature (bound at app/Main.hs:44:11)
In the first argument of ‘($$)’, namely ‘src’
In the first argument of ‘runOGR’, namely ‘(src $$ CL.consume)’
I'm probably doing something wrong.
I have been trying to build the lib with Cabal, with the following specifications:
cabal-install: 3.8.1.0
ghc: 9.2.4 (also tried with 8.6.5)
By pulling the commit 331a6e2 (master) I have ran
cabal configure -f examples
and then
cabal build
and ran on the following problem:
exe/OGRInfo.hs:21:3: error:
• No instance for (MonadFail (GDAL s))
arising from a do statement
with the failable pattern ‘[fname, nameStr]’
• In a stmt of a 'do' block: [fname, nameStr] <- liftIO getArgs
In the second argument of ‘($)’, namely
‘do [fname, nameStr] <- liftIO getArgs
let name = T.pack nameStr
ds <- OGR.openReadOnly fname
l <- OGR.getLayerByName name ds
....’
In the second argument of ‘($)’, namely
‘runGDAL_
$ do [fname, nameStr] <- liftIO getArgs
let name = T.pack nameStr
ds <- OGR.openReadOnly fname
l <- OGR.getLayerByName name ds
....’
|
21 | [fname, nameStr] <- liftIO getArgs
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I think this is easy to fix this but I am not yet proficient with Haskell. I couldn't find the correct pattern.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.