File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,19 @@ You can first install cython to have a compiled version:
1919
2020You need to register the extension:
2121
22- import postgis
23- postgis.register(mydatabase.get_cursor())
22+ > import postgis
23+ > postgis.register(mydatabase.get_cursor())
2424
25- Then you can pass and get geoms using psycopg:
25+ Then you can pass python geometries instance to psycopg:
2626
27- cursor.execute('INSERT INTO table (geom) VALUES (%s)', [Point(x=1, y=2, srid=4326)])
28- cursor.execute('SELECT geom FROM points LIMIT 1')
29- geom = cursor.fetchone()[0]
30- assert geom.coords == (1, 2)
27+ > cursor.execute('INSERT INTO table (geom) VALUES (%s)', [Point(x=1, y=2, srid=4326)])
28+
29+ And retrieve data as python geometries instances:
30+
31+ > cursor.execute('SELECT geom FROM points LIMIT 1')
32+ > geom = cursor.fetchone()[0]
33+ > geom
34+ <Point POINT(1.0 2.0)>
3135
3236
3337## Example
You can’t perform that action at this time.
0 commit comments