This is a very thin crystal wrapper for GDAL.
This library provides a very thin wrapper for GDAL. It does not provide any abstraction on top of the C API so you end up writing C code in crystal, i.e. you need to do all the memory management (see the GDAL API documentation for more info).
The GDAL library error handling mechanism by default logs stuff to stdout. You can silence these messages by setting GDAL::CPL.silence_failures to true (see sample.cr). I also provide a couple of functions to wrap calls to GDAL that turn errors into exceptions.
See sample.cr for a couple of use cases.
-
Install the GDAL libraries (and optionally binaries). The build require that
gdal-config
be in your path. On Ubuntu you can runsudo apt-get install libgdal-dev gdal-bin gdal-data
-
Add the dependency to your
shard.yml
:dependencies: gdal.cr: github: ricardog/gdal.cr
-
Run
shards install
require "gdal.cr"
See sample.cr
for some example of how to interface with the GDAL API.
I use vagrant to create and run docker containers for development and testing but YMMV. If vagrant doesn't work for you, you can run docker directly. I develop on Ubuntu-based containers, c.f. Dockerfile.
- Create and start a container.
vagrant up
The container run the play server (on port 8080). Go to
http://${DOCKER_HOST}:8080/
to see the playgorund.
- Run a shell in the docker container
vagrant docker-exec -it -- /bin/bash
- RUn the compiler in the container
cd gdal.cr
crystal src/sample.cr
- Fork it (https://github.com/your-github-user/gdal.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Ricardo E. Gonzalez - creator and maintainer