postgis
Version, currently master branch1 version
- master branchlatestAug 5, 2026
github.com/jgaskins/postgis
PostGIS extensions for the Crystal Postgres client
Installation
# Add this to your shard.yml
dependencies:
postgis:
github: jgaskins/postgis
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 0.36, < 2.0.0- License
- MIT
- Author
- Jamie Gaskins
Dependencies
Runtime Dependencies
- pg*github: will/crystal-pg
README
postgis
PostGIS data types and encoders/decoders for the Crystal Postgres driver.
Installation
-
Add the dependency to your
shard.yml:dependencies: postgis: github: jgaskins/postgis -
Run
shards install
Usage
Ensure that your database has the postgis extension enabled:
CREATE EXTENSION postgis
Load PostGIS into your application
require "postgis"
After connecting to your database, run PostGIS.register_decoder(db):
db = DB.open(ENV["DATABASE_URL"])
PostGIS.register_decoder db
If you're writing raw SQL queries, you can specify the type of the result:
db.query_one "SELECT 'point(1 2 3)'::geography", as: PostGIS::Point3D
If you're using DB::Serializable, you can use PostGIS types for the models:
struct Address
include DB::Serializable
# ...
getter coordinates : PostGIS::Point2D
end
Currently supported GIS types:
| GIS Type | Crystal type |
|---|---|
POINT | PostGIS::Point2D, PostGIS::Point3D |
POLYGON | PostGIS::Polygon2D |
More will be added in the future.
Contributing
- Fork it (https://github.com/jgaskins/postgis/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
Contributors
- Jamie Gaskins - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Aug 5, 2026
- Crystal
>= 0.36, < 2.0.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/jgaskins/postgis
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 1