Psycopg is a popular PostgreSQL database adapter for the Python programming language

learn more… | top users | synonyms

3
votes
1answer
38 views

QgsDataSourceuRI and left outer join

I'm trying to load data from different tables using left outer joins into a QgsVectorLayer. The approach I'm following so far is the one from the developers cookbook here. The underlying database is ...
0
votes
1answer
79 views

Python to Postgres insert Geometry syntax

Having trouble creating geom columns and inserting geometry lat lng values into postgres table Is my syntax correct in creating the point geometry fields? st_makepoint is the point constructor. ...
1
vote
1answer
129 views

Create Table with postGIS geometry in Python

I'm creating the following table with a postGIS geometry column in python but get an error psycopg2.ProgrammingError: type "geometry" does not exist What should I use to be able to use postGIS in ...
2
votes
2answers
136 views

Using zoo-project WPS service in QGIS WPS-Client

I've created a python wps service in the zoo-project framework, which is used to calculate a Line of Sight based in on a start point, an end point and a start point height. The service works fine if i ...
4
votes
1answer
53 views

tweepy psycopg2 creating points, coordinate system SRID confusing

I am using tweepy and psycopg2 to extract tweets and input them in a postgres table. When I try to insert the point of the tweet I succeed in creating a point in the geom column I create. I however do ...
2
votes
2answers
61 views

Why does psycopg2 “SELECT ST_AsBinary(geom)” return “<read-only buffer…>”?

I'm trying to retrieve polygons out of a postgresql database and I'm running into several problems. First, I've been able to get ST_AsText(geom) to work in conjunction with arcpy.FromWKT(), but the ...
0
votes
0answers
95 views

How to “INSERT” geotiff raster into postgresql/postgis table using psycopg2

Can someone walk me through how to insert a raster into a prebuilt postgresql table? The table has the postgis extension and I've been able to manually insert a geotiff using raster2pgsql, but I would ...
0
votes
1answer
77 views

Can't execute a simple psycopg2 script twice when running from ArcGIS Desktop as a script tool

I'm building a geoprocessing service that queries an SDE database (running on postgres) and returns results. I do a lot of development by calling the script from a toolbox in ArcGIS desktop 10.3. ...
2
votes
2answers
164 views

PostGIS operations extremely slow when called in a script

OK, I am aware that this is rather vague, but unfortunately I was not able not reproduce my problem in simplified code. I am running a series of functions within another function (main()). All ...
1
vote
1answer
42 views

String quoting issues with sql using ST_PointFromText in psycopg2

I've been banging my head against this for a while, and am seeking some insight into what I'm doing wrong. I have the following snippet of code: params = [PlaneRep.hex, PlaneRep.squawk, PlaneRep....
0
votes
1answer
265 views

Query table names

I want to query a table in my postgis table named Seg_060_2009 using psycopg2 and cant seem to get my query to execute. The query will execute if I name the talbe layer. Are there restrictions on ...
1
vote
1answer
1k views

Import shapefiles into PostGIS using Python with psycopg2

I want to import shapefiles to PostGIS using Python with arcpy & psycopg2 to connect to PostGIS. I don't want to use the existing shapefile loader nor ogr, just write my own import tool. My steps ...
0
votes
0answers
396 views

ST_MakePoint returns an error when using Python

I am trying to use ST_Point or ST_MakePoint to create points from a table of latitude and longitudes coordinates. However I am consistently getting an error even when trying the examples. For example ...
1
vote
1answer
297 views

Get a point value with psycopg2 and PPyGIS

I'm trying to setup a basic working postgis setup with python ppygis package. >>> import psycopg2 >>> import ppygis >>> connection = psycopg2.connect(database='spre', user='...
7
votes
2answers
932 views

Downloading raster data into python from postgis using psycopg2

I have raster data in a postgres table that I want to get into python as a numpy array. I am using psycopg2 to connect to the db. I am able to download the data but it comes back as a string (probably ...
1
vote
0answers
606 views

Generate random points in polygon. Algorithm question

i created a Random Point Generator in python using the algorithm described here by @whuber. The algorithm is implemented using Shapely, PostGIS and psycopg2. To boost performance pythons ...
1
vote
1answer
105 views

Computing intersections for each geometry in a table

I have a table with many Linestrings and for each of these Linestrings I need to figure out which other Linestrings, from the same table, intersect with it. If I recall correctly this gives me a ...
6
votes
2answers
5k views

PostGIS: Insert a Point using Python

What is the right way to insert a Point to a PostGIS database using Python?
0
votes
0answers
2k views

Postgres SSL SYSCALL error: EOF detected with python and psycopg

Using psycopg2 package with python 2.7 I keep getting the titled error: psycopg2.DatabaseError: SSL SYSCALL error: EOF detected It only occurs when I add a WHERE column LIKE ''%X%'' clause to my ...
1
vote
1answer
445 views

Import raster into PostGIS using Python

I am trying to import information from a Bathymetric Attributed Grid (BAG) file into PostGIS using Python and psycopg2. I'm working, for now, on a Windows box with pre-compiled packages, so I don't ...
0
votes
2answers
1k views

Get srid from a shapefile using ogr

I'm writing a script to import shp to postgis, using python, osgeo and psycopg2 ( see my previous question: Import shp to Postgis using Python and ogr ) I'd know if there is a way to get by osgeo ...
1
vote
1answer
5k views

How to save results of postgresql to csv/excel file using psycopg2?

I use driving_distance in postgresql to find distances between all nodes, and here's my python script in pyscripter, import sys #set up psycopg2 environment import psycopg2 #driving_distance module ...
0
votes
1answer
3k views

Use psycopg2 to do loop in postgresql

I use postgresql 8.4 to route a river network, and I want to use psycopg2 to loop through all data points in my river network. #set up python and postgresql connection import psycopg2 query = """ ...
1
vote
1answer
2k views

How to execute sql lines in postgresql using python?

I use postgresql 8.4 to route a river network, the following is my code typed in pgAdmin and the result is fine, select * from driving_distance ('select gid as id, start_id::int4 as source, end_id::...
6
votes
3answers
4k views

PostGIS: parse geometry wkb with OGR

I'm trying to pull a LineString geometry out of PostGIS and parse it with OGR (python bindinds). from osgeo import ogr import psycopg2 connection = psycopg2.connect("...") cursor = connection.cursor(...
2
votes
1answer
456 views

Transferring data between spatial databases

I would like transfer spatial data from PostGIS to Oracle Spatial. I want to use Python's modules psycopg2 and cx_oracle. Transfer Oracle > PostGIS is OK, but in opposite version I have problem with a ...
0
votes
1answer
836 views

Cant Instal psycopg2 on mac 10.8.2

I know there Have been a lot of similar questions asked but none address this issue as I far as I can tell. When I am trying to install the sextante plugin, or run PostGIS Manager in QGIS I receive ...
2
votes
1answer
223 views

How to configure and install psycogpg2 - beginner?

I need to install psycogpg2 for working with 'django'. I read the instructions but I dont understand whether to run the commands in command prompt or in python command line. I am lot used to the GUI ...
1
vote
0answers
354 views

Why is not ST_GeomFromEWKB() working?

The following SQL is working fine from the terminal: SELECT MIN(ST_Distance( ST_Transform(ST_GeomFromText('POINT(-3.163916 55.926528)',4326),32630), ST_Transform(ST_Boundary(ST_GeomFromEWKB(...