Skip to content

tilery/python-postgis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Circle CI

psycopg-postgis

PostGIS helpers for psycopg2.

Install

Not pypi release yet:

pip install git+https://github.com/yohanboniface/psycopg-postgis 

You can first install cython to have a compiled version:

pip install cython 

Usage

You need to register the extension:

import postgis postgis.register(mydatabase.get_cursor()) 

Then you can pass geoms to psycopg:

cursor.execute('INSERT INTO table (geom) VALUES (%s)', [Point(x=1, y=2, srid=4326)]) cursor.execute('SELECT geom FROM points LIMIT 1') geom = cursor.fetchone()[0] assert geom.coords == (1, 2) 

About

PostGIS helpers for psycopg2 and asyncpg

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •