Tagged Questions
-1
votes
1answer
55 views
QGIS and Python - create line with multiple points in postgis
How can I create a line, with Python functions, with many points that are records in Postgis?
Thank you
0
votes
1answer
62 views
How can i select many rows from a table?
I want to create an action that select many rows from PostGIS table to show many lines in QGIS.
How can i select many rows from table with python to add these rows in a layer?
Thank you
2
votes
0answers
72 views
Extracting x,y,z values from a postgis linestring to python using ogr
I am trying to load a postgis linestring into python (using ST_DumpPoints) and extracting x,y,z coordinates, which is working but extremely slow..and if i mean slow, i really mean it (yes, it takes ...
2
votes
1answer
87 views
Need help assigning values to field using OGR in python
I've got a similar question to this one How to programatically populate a shapefile field with polygon areas in OGR?, but the solution doesn't seem to be working for me. I am trying to import a ...
1
vote
2answers
163 views
Automating batch load of multiple GPX files into PostGIS
I've got 50+ GPX files that I would like to "batch load" into a PostGIS database. All of the track_points data would be loaded into a "track_points" table (with typical GPS fields like lat, long, ...
0
votes
0answers
99 views
how to plot point on openlayer google street layer programmatically
I want to plot points on google street layer using python programming and postgresql database.
Mainly I want to extract data from database and plot it on the google street layer on Quantum GIS 1.8 ...
3
votes
3answers
395 views
How do I apply Dijkstra's algorithm in Python with PostGIS data?
I have currently parsed OSM data, from a PBF file, into a pgRouting database with the use of osm2po, an excellent parsing tool. I don't however want to use the algorithms provided by pgRouting and ...
1
vote
0answers
70 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),
...
4
votes
1answer
152 views
How to interpolate polyline or line from points?
We have a lot of points, but with no timestamps to create ways. For now, I've created a sample of the way the points traverse. It's in here, this way can be compared with a Google one.
I haven't ...
0
votes
0answers
80 views
Can I do full SQL expressions through the “WHERE” clause in UpdateCursor?
Run as a standalone python script for a shapefile in a toolbox on ArcMap.
For example:
psql_url_pop = '''SELECT shapefile.NAME_# + shapefile.WIKI_URL FROM public.shapefile'''
rows = ...
1
vote
0answers
155 views
How to debug 'Layer is not valid error' from Python plugin?
I'm trying to understand what goes wrong with a QGIS python plugin.
Basically I'm trying to render a series of POINT.
The query works fine, at least giving it by hand from inside PostGIS DB:
"SELECT ...
4
votes
2answers
225 views
How to programmatically create exports from PostGIS database into different file formats (e.g. shapefile, dxf, dgn,…)?
Is there a kind of wrapper/library written in python which would enable me to programatically create exports from postgis database into different file formats (most common being, shapefile, dxf, ...
5
votes
1answer
154 views
Can you synchronize tables between ArcSDE(MSSQL) and PostgreSQL(PostGIS) regularly?
I have spatial tables in ArcSDE 10.1 (MSSQL 2008 R2) geodatabases and need to update the same spatial tables in PostgreSQL 9.1(PostGIS 2.0.1) geodatabases. Basically I use my ArcSDE environment for ...
3
votes
2answers
135 views
Setup a map server that runs from USB to whatever computer it is connected?
I would like to have a USB that I can bring with me to any computer. That USB should hold a map server, so that the client computer wont need internet and avoid using OSM or Google maps or any other ...
1
vote
1answer
175 views
Edit Shapefiles Attribute data in GeoServer Programatically
I'm rendering a shapefile using GeoServer and using OpenLayers library to render it in the web browser.
Now I have created the option of editing the attribute data in web browser. I want the edited ...
8
votes
2answers
338 views
Best design for Open Source Python / PostGIS prototype
I am writing a data intensive web application that is delivered through apache. My question is about how to best arrange processing given that there are multiple options.
I have at my disposal ...
2
votes
1answer
134 views
How to get all attributes from a non geometry PostGIS layer with Python in QGIS?
I want to extract all attributes from a non geomety layer in QGIS with Python, but there is only the function
uniqueValues(fieldIndex)
More specific:
I have a postgresql table which is loaded into ...
1
vote
0answers
183 views
Why won't this PostGIS query display in QGIS
I am having trouble rendering the following PostGIS query in qgis1.803.
SELECT
s.musym,
st_intersection(s.the_geom,f.the_geom) as geo,
nextval('"soilsplittersequence"'::regclass) as k
From ...
1
vote
1answer
131 views
Qgis mapserver - Can it use plugins you use in qgis desktop?
Im thinking about developing a small python plugin for qgis which would access postgis raster database and return data via ST_AsPNG() for example. But since i need this in my wms, would it be possible ...
2
votes
2answers
458 views
Is there a way to automatically populate attribute values in Qgis?
We are using a Qgis/PostGis combo, where Qgis is used for adding features with attributes into a PostGis database.
Is there a way to automatically fill the attribute data values with some ...
4
votes
1answer
79 views
Using “Time” in PostgreSQL/PostGIS
I'm loading gtfs into a PostGIS database but I have a problem when loading my stop times.
The data is in time format "00:00:00" and for 1:30 AM, my data is "25:30:00".
I'd like to keep it that way ...
1
vote
1answer
375 views
Write spatial operations to PostGIS from QGIS or ArcGIS
I need to write my spatial operations to a (new) postgis layer (as the data is to large for a shp file). Can this be done in the QGIS browser or from ArcGIS without SDE?
When you go (for example) --> ...
7
votes
2answers
261 views
How to catch PostgreSQL/PostGIS errors in GDAL/OGR Python bindings?
Is it possible to catch PostgreSQL output error messages in OGR after a query has failed?
For example
conn.ExecuteSQL('SELECT * FROM non_existing_table;')
In Postgres this returns an error ...
3
votes
1answer
379 views
How to save a newly created shapefile in PostGIS?
I am creating shapefile using shapefile.py and my database has records more that 65k which is the limit of the shapefile. How can I create shapefiles then?
Is it possible that somehow I am able to ...
3
votes
2answers
172 views
Invoke PostGIS functions outside of the database? Need to force 3D in GeoDjango
I'm looking to ensure that all geometries saved to the database are three-dimensional. It's easy enough to do with a call to the database,
select ST_Force_3D( ST_GeomFromText( blah blah ) )
...but ...
1
vote
2answers
151 views
Toggle editing option in plugins
I am working on python plugins for QGIS.I developed the plugins same as RT SQL LAYER plugins.
When we draw the layers using query builder of "Add Postgis Layer" option,toggle editing option is ...
12
votes
4answers
625 views
The best language to program with GDAL
I'm going to start to create programs to handle geographical data from a PostGIS server, and going to use GDAL.
According to your experience, with the best language to program with it? I can program ...
1
vote
1answer
71 views
Filegeodatabase fanout and Python problem
I have fme wb which does fanout with gdb. It means that in the end as output sets of data I get few new created gdb. But If I start this fme wb within python script It does not do fanout. Just write ...
3
votes
3answers
526 views
Adding shapefile directly to geoserver
I have py script which is creating shapefiles using shapefile.py. Once the shapefile is created I have to add them manually to the geoserver. Is there a way to add it dynamically to the geoserver? ...
4
votes
1answer
254 views
Using group by to set a PostGIS datasource using QGIS Python API
I am writing a QGIS Plugin and wish to obtain data from a PostGIS table using the Group By clause using something like the following code:
uri = QgsDataSourceURI()
uri.setConnection('localhost', ...
5
votes
2answers
887 views
Is it possible to get the EPSG value from an OSR SpatialReference class using the OGR Python API?
When reading a layer from a OGR PostGIS connection I can get the SpatialReference of the layer, but is it possible to get the EPSG value? Is there any documentation on this?
For example:
lyr = ...
1
vote
1answer
325 views
Passing parameters to PostGIS SQL queries in Python: weird behaviour
The following code always goes to the except section and I do not understand why..Any help would be much appreciated.
l = None
c = conn.cursor()
try:
s = "SELECT ST_NPoints(ST_GeomFromText(%s))"
...
3
votes
1answer
581 views
How to assign OGR geometry a spatial reference when writing to a new layer using the Python API?
I'm using the Python OGR API to add new features to a PostGIS layer. However, despite setting the geometry spatial reference, when the geometry is written out the spatial reference is missing. This is ...
2
votes
1answer
256 views
The minimum bounding circle of geometry that crosses the 180th meridian
Background: I've been given a task where I have to calculate the minimum bounding circle of Alaska (for the purpose of running a Roeck test). I'm using the Census' state level geometries available ...
5
votes
2answers
414 views
Accessing non-spatial PostgreSQL tables using OGR Python bindings
When connecting to PostgreSQL/PostGIS using the OGR Python bindings is it possible to get non-spatial table names (i.e. OGR layers) from the connection?
Currently, doing:
conn = ogr.Open("PG: ...
1
vote
1answer
158 views
How to correctly use cursor.execute() with PostGIS?
I do not understand how the operator works some times...
Here is an example that works,
"SELECT ST_Distance(ST_GeomFromText('POINT(-3.16496271127842 ...
1
vote
1answer
241 views
Problems with python postgis polygon
I have a problem with the examples in the book "Python Geospatial Development". I can't write to the PostgreSQL database polygons from TM_WORLD_BORDERS (Chapter 7, page 202 in book). Code:
src_file = ...
4
votes
2answers
1k views
How to convert PostGIS table to Shapefile in Python?
I want to convert a PostGIS table into a shapefile (without using pgsql2shp).
In order to create a geometry in the shapefile I have to give the Xmin,Ymin and Xmax,Ymax, and the geometry which I have ...
1
vote
2answers
184 views
unable to call shp2pgsql using python
I am unable to call shp2pgsql using python as I have to pass various options like (-s -a -i)
and I am not getting the required output ..
Method I am using is
p1 = subprocess.Popen(["cmd", "/C", ...
1
vote
1answer
695 views
Using a geodjango PointField with geography=True, my distance calculations are wrong
Here's my model:
class ExchangeArea(models.Model):
"""
An Exchange Service Area, calculated from a phone exchange and surrounding census tracts.
"""
coordinates = ...
2
votes
2answers
355 views
Parameterized insert query to PostGIS fails
I have a PostGIS database table that I need to insert data into. I'm using Python 3 and the pg8000 interface to Postgres. Somehow, parameterized inserts do not work. If I do
iq="INSERT INTO ...
2
votes
1answer
215 views
RT Sql Layer plugin giving an error
I am trying to use the aforementioned plugin with QGIS 1.7 and Postgres 9.0/PostGIS 1.5.
Added a PostGIS spatial layer w/out a problem and then clicked on the RT Sql layer button which displayed the ...
3
votes
1answer
346 views
PostGIS + pgRouting: Adding dummy links to a road network and performing routing analysis
I'm a beginner when it comes to postgis and pgrouting development.
For a project I'm working on and a bit of the algorithm:
I have a polygon layer that represents zones
I have a line layer that ...
7
votes
1answer
856 views
Help with PostGIS polygon geometry - non-closed rings
I've picked up a copy of the super-wicked book 'Python Geospatial Development' by Erik Westra (Amazon link), and I'm working through it. Currently, it's teaching me to load GSHHS coastline data from a ...
3
votes
2answers
140 views
How to bring polygons closer to a point?
I have some scattered polygons with a lot of space between them.
I want to make a thematic map but all that white space doesn't look very good, so I want to bring the polygons closer to the center of ...
9
votes
3answers
935 views
How to populate an undirected graph from PostGIS?
This question is more related to resources that I might not have identified yet, although I've been searching the web for a while.
In the project I'm working at the moment I need to run a ...
3
votes
3answers
1k views
Writing a plugin for Qgis using python to access PostGIS and write geometries
Sorry about the strange title didn't really know how to word it.
I currently use MapInfo to do most of my GIS work however I have recently installed PostGIS 1.5 and am really liking it so far. A ...
13
votes
6answers
4k views
Nearest neighbor between a point layer and a line layer
I've asked this question several times on stackoverflow and irc between #qgis and #postgis and I also tried to code it or implement it my self in postgis with no real answer.
Using programming (most ...

