GEOALCHEMYhttp://erilem.net/talks/foss4g2013/geoalchemy.html
USE SQL SPATIAL DATABASES
FROM PYTHON
We have PostGIS. Hooray!
We have Python. Horray!
We need good ways/tools to
use PostGIS from Python.
That's the reason we're
developing GeoAlchemy
Wait! There's Django, and
GeoDjango!
YES (it's great), BUT...
There's a life outside Web and
Django!
Has anyone heard about Flask,
Bottle, Pyramid?
They're great frameworks, with lots of users.
They all love the SQLAlchemy
toolkit.
For good reasons!
SQLALCHEMY
The Database Toolkit for Python
SQLALCHEMY PHILOSOPHY
It's not about abstracting the DB
Abstracting is Hiding
It's about Automation
Instruct SQLA to do th...
SQLALCHEMY CORE / ORM
SQLAlchemy has two distinct areas:
Core (SQL expression system)
Object Relational Mapper (ORM)
SQLALCHEMY QUERY EXAMPLE
The user whose email address is jack@google.com.
user = session.query(User).join(Address).
filter...
GEOALCHEMY
Thin layer above SQLAlchemy
With the same philosophy
GEOALCHEMY QUERY EXAMPLE
The lakes whose buffers have areas greater than 33.
It looks like SQLA!
It looks like PostGIS SQL...
SHAPELY INTEGRATION
to_shapeand from_shapefunctions
lake = session.query(Lake).filter(
Lake.geom.ST_Buffer(2).ST_Area() > ...
STATUS
Version 2 released 6 months ago (03/17/2013)
Benefits from SQLALchemy's latest advances
Improved API
Works both wit...
EXPOSURE
Used in production
Many client projects by Camptocamp
The SkyLines project ( )
By Tobias Bieniek (@Turbo87)
https...
THANKS!
Upcoming SlideShare
Loading in …5
×

Geoalchemy

1,847 views

Published on

Theme: Development: presentation is focused on a specific technology, demonstrating either a new product or new developments in an existing product.

GeoAlchemy is a powerful toolkit to use SQL spatial databases from Python.

GeoAlchemy helps you use spatial databases from Python. GeoAlchemy provides extensions to SQLAlchemy, the Python SQL toolkit and ORM. GeoAlchemy builds on SQLAlchemy's extreme flexibility, and can be used for different types of applications, from simple scripts to complex web applications. In this talk we will present GeoAlchemy and SQLAlchemy. We will describe when and how SQLAlchemy and GeoAlchemy can be useful. We will demonstrate the power and flexibility of the tools. We will also present the new version of GeoAlchemy, namely GeoAlchemy 2. GeoAlchemy 2 enables leveraging PostGIS' new features. For example, GeoAlchemy 2 supports PostGIS's new raster type. Finally, we will demonstrate how GeoAlchemy integrates with other well-known Python tools, such as Shapely.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,847
On SlideShare
0
From Embeds
0
Number of Embeds
176
Actions
Shares
0
Downloads
9
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Geoalchemy

  1. 1. GEOALCHEMYhttp://erilem.net/talks/foss4g2013/geoalchemy.html
  2. 2. USE SQL SPATIAL DATABASES FROM PYTHON
  3. 3. We have PostGIS. Hooray!
  4. 4. We have Python. Horray!
  5. 5. We need good ways/tools to use PostGIS from Python.
  6. 6. That's the reason we're developing GeoAlchemy
  7. 7. Wait! There's Django, and GeoDjango!
  8. 8. YES (it's great), BUT...
  9. 9. There's a life outside Web and Django!
  10. 10. Has anyone heard about Flask, Bottle, Pyramid? They're great frameworks, with lots of users.
  11. 11. They all love the SQLAlchemy toolkit. For good reasons!
  12. 12. SQLALCHEMY The Database Toolkit for Python
  13. 13. SQLALCHEMY PHILOSOPHY It's not about abstracting the DB Abstracting is Hiding It's about Automation Instruct SQLA to do the grunt work we give it Relational form of data is preserved SQLA provides a rich vocabulary to express decisions made by the developer
  14. 14. SQLALCHEMY CORE / ORM SQLAlchemy has two distinct areas: Core (SQL expression system) Object Relational Mapper (ORM)
  15. 15. SQLALCHEMY QUERY EXAMPLE The user whose email address is jack@google.com. user = session.query(User).join(Address). filter(Address.email_address=='jack@google.com'). one()
  16. 16. GEOALCHEMY Thin layer above SQLAlchemy With the same philosophy
  17. 17. GEOALCHEMY QUERY EXAMPLE The lakes whose buffers have areas greater than 33. It looks like SQLA! It looks like PostGIS SQL! lakes = session.query(Lake).filter( Lake.geom.ST_Buffer(2).ST_Area() > 33).all()
  18. 18. SHAPELY INTEGRATION to_shapeand from_shapefunctions lake = session.query(Lake).filter( Lake.geom.ST_Buffer(2).ST_Area() > 33).first() lake_shape = to_shape(lake.geom) lake_shape.representative_point().wkt
  19. 19. STATUS Version 2 released 6 months ago (03/17/2013) Benefits from SQLALchemy's latest advances Improved API Works both with SQLA Core and ORM PostGIS 2 support (Raster included) Fully documented and tested https://geoalchemy-2.readthedocs.org
  20. 20. EXPOSURE Used in production Many client projects by Camptocamp The SkyLines project ( ) By Tobias Bieniek (@Turbo87) https://www.skylines-project.org)
  21. 21. THANKS!

×