Skip to content

Commit ea6c155

Browse files
committed
README
1 parent 5824cea commit ea6c155

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@ You can first install cython to have a compiled version:
1919

2020
You 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

0 commit comments

Comments
 (0)