Python is an open source interpreted programming language used in many GIS programs.

learn more… | top users | synonyms

1
vote
1answer
124 views

Creating prepared geometries with OGR from Python

Is it possible to create a prepared geometry object using the Python SWIG geos.ogr module? It seems that Shapely and GeoDjango both have this functionality, but I can't see any mention of it in the ...
0
votes
0answers
61 views

How to use python to loop through all possible results in postgresql?

I use driving_distance function in pgRouting to work with my river network. There are 12 vertices in my river network, and I want to get the distance between all of these 12 vertices, starting from ...
1
vote
1answer
471 views

GDAL bindings problem with ArcMap 10.1 Python tool

I'm really getting mad with this. ArcGIS sometimes can be so just...irritating! Forgive me if this question is by any means duplicating this one or similar ones, but I really can't find my way out of ...
0
votes
1answer
266 views

python script in modelbuilder: get field value and return boolean expressions

I have problems integrating a python script in a modelbuilder tool. I'm a absolute beginner with python. Maybe there's also an easier way to solve this problem in modelbuilder without using a python ...
0
votes
1answer
144 views

Orthographic reprojection with mapnik

I am trying to create a google earth like wep application. My problem is that I can't get to render a full view of the earth. The zoom_all() function generates the following error : RuntimeError: ...
0
votes
1answer
128 views

How to find locations for hydro power using raster analysis?

I have a stream network and DEM file both in raster format. I need to extract values from DEM to stream network. For the analysis in stream network after that, I need to find out the places for hydro ...
1
vote
1answer
89 views

How to Average neighboring county data and store in original?

I have data for several rain stations, i have averaged the data and given each county a value. Some counties have null values and I would like to pull the data from the all the bordering counties and ...
4
votes
1answer
314 views

How to access the road graph plugin in python?

I am developing a few scripts in Python for QGIS 1.8 to automate some geo-tasks and one of them would be to calculate the shortest distance from a hospital to each building in a town. I would like to ...
0
votes
1answer
187 views

Is it possible to use GDAL to combine (rather than mosaic) rasters

Is there a GDAL command which can combine multiple rasters so that a unique output value is assigned to each unique combination of input values, like the combine command in ArcGIS? gdal_merge seems ...
-3
votes
2answers
401 views

What does Runtime error : 'NoneType' object has no attribute '<field_name>' mean?

Here is my code #arcpy import arcpy,sys from arcpy import env env=r"C:\Users\Jaya\Desktop\python_practice" totalRec=arcpy.GetCount_management("river") rows=arcpy.SearchCursor("river") ...
0
votes
0answers
125 views

qgis python app how to add edit feature button?

I'd like to develop a QGIS Python app for plotting points and editing the attributes. I've started with the tutorials here: http://blog.qgis.org/?q=node/59 and read the cookbook ...
1
vote
2answers
569 views

What might cause invalid syntax from ArcPy with Raster Calculator and Multiple Rasters?

I am having trouble for writing script in Python (ArcGIS 10.1). The task is generally divide each raster by 100. I have many of these raster files.... So what I've done is the following: from ...
3
votes
1answer
158 views

TKinter to provide variables

I've been looking for a way to enter a unique field name into an attribute table for up to 40 feature classes. I need the field names to be meaningful, not just 'field1', 'field2' etc. For example, if ...
5
votes
1answer
854 views

Python Script for getting elevation difference between two points

I have several stream segments 1000 Km long. I need to find the elevation difference between two consecutive points of distance 1 Km starting from the upstream to downstream. How can I get the ...
5
votes
1answer
504 views

How to create a dropdown menu in QGIS Toolbar with Python

I Have a set of some QAction in my QGIS-Plugin and they are created and added to the toolbar like this icon = QIcon(":/action1.png") self.action1 = QAction(icon, u"Action 1", self.iface.mainWindow()) ...
0
votes
0answers
413 views

Problem reading attribute with Python using osgeo.ogr

I am working thru "Python Geospatial Programming" and I have a problem in a program in Chapter 6 that I cannot seem to solve. The small program: import osgeo.ogr shapefile = ...
0
votes
1answer
156 views

Rendering a layer in ArcMAP using ArcObjects and Pyhon

I succesfully wrote a script to render a Uniquevaluerenderer in a layer in ArcMAP using symbols from 4 parameters (values) read from the attribute table of the layer. I used ArcObjects and VBA, but ...
1
vote
2answers
229 views

How to Append to rather than overwrite single table using ArcPy?

The code thus far works to create multiple output files, but I'd like to set it up so that the data is all exported onto a single table across multiple rows. The issue is I believe with the part in ...
3
votes
2answers
479 views

Csv to Shp conversion? [duplicate]

I am working on a really big script right now where I have a csv file that I have removed rows and columns from, and edited the headers. I need to create one big shapefile for the entire csv file then ...
2
votes
2answers
232 views

Geopy Error with Reverse Geocoding

I am using Geopy. I get following error for the code. I have using the same code as on https://code.google.com/p/geopy/wiki/ReverseGeocoding from geopy import geocoders g = geocoders.GeoNames() ...
1
vote
1answer
375 views

Reverse geocoding to get city, state, country data separately?

I have longitude and latitude data. I need to reverse geocode to get city, state, country data separately. I have checked google service. Google provides complete address to a micro level. ...
2
votes
3answers
181 views

How to test if geometry is inside another?

I need to tell whether geometries from a shapefile are inside other geometries or not. For example, I want to test if there are trees (represented as points in trees.shp) inside the urban areas ...
3
votes
1answer
117 views

Get the total distance from a point to the end of a linestring

I have a list of GPS coordinates that make up a bus route: busRoute = [(x1, y1), (x2, y2), ... (xn, yn)] I also have a point that may not be exactly on that route (due to GPS error): ...
0
votes
1answer
97 views

Error: Exception Raised on the “for row in rows” command line?

I am comparing fields in layers. I have the AADT layer and AADTAnno layer and I want it to search the fields FLAG and TFLAG. For Example: If there is a 29C9 in AADT layer in FLAG fields then there ...
12
votes
2answers
350 views

Measuring Script Writing Competency

I've been asked by my manager to come up with some sort of competency measure for an employees understanding of scripting/programming. Because I am a self taught programmer, I really don't have a ...
1
vote
1answer
180 views

How to “Merge Selected Features” with python?

I have been looking for the answer to this question for some time now, but can't seem to find it! My problem is straight forward: I have one layer It contains lots of features (only polygons), say ...
3
votes
0answers
195 views

Create easy Annotations from point features with python in ArcGIS 10.0

Because in ArcGIS 10.0 there is still no simple toolbox function to convert labels to Annotation, I try to go a substitude way with the callable Toolbox function [TiledLabelsToAnnotation][1] on a ...
4
votes
2answers
366 views

Does ArcPy leak memory when importing CSV files?

I'm trying to import a great number of csv files of about 250MB each. I wrote a python script for that as follows: import gc import glob tables = ...
4
votes
1answer
210 views

Switching between background 64 bit processing and 32 (so I can use 3rd party ie XTools)

I often run scripts now with 64 bit background processing enabled but when I want to use certain tools like Xtools table to text I have to turn it off as these tools are 32 bit. Is there a way to ...
6
votes
2answers
707 views

How to access Esri ArcPy modules from Enthought Canopy?

I have ArcGIS 10.1 running on my windows system and I have also installed the new 32-bit Canopy Express Enthought Python Distribution. Is it possible to load and use the Esri ArcPy modules from ...
1
vote
0answers
123 views

Averaging satellite data with missing values (using Python)

I am using sea surface temperature, chlorophyll, and other data parameters as covariants in a model, and I would like to average them over a particular time period. I am currently doing this using a ...
4
votes
1answer
538 views

Populating a Value List in one Parameter, from Values Derived from a Second Parameter, Python

Using the Validator in the ArcGIS 10.1 tool GUI, can I loop through and List feature classes from a workspace type parameter (ie a file geodatabase) and then go on and list the values of a field in a ...
1
vote
2answers
173 views

access attributes of one class for use in another class in python add-in

I want to get combobox attribute 'dem' and use it for further processing in class ExtentData. But I am not sure how to get attributes from one class to another for processing in pythonaddin. In ...
6
votes
1answer
273 views

ModelBuilder: How to extract data by date, export to separate tables and interpolate tables to rasters

I've been using ArcGIS for a couple years, but when it comes to model builder I've only worked with very simple models. I'm hoping someone that is much smarter than myself can help me in building a ...
1
vote
1answer
1k views

Find and replace unicode character in a shapefile

I've found several example of script and blog posts on working with unicode characters, but I haven't been able to make anything works so far... It's a little frustrating I have a shapefile encoded ...
4
votes
2answers
559 views

How to automatically reloaded raster layer if source is changed in QGIS?

How to automatically reloaded raster layer if source is changed? (The path is the same but inside source file are changes) I use: qgis.utils.iface.mapCanvas().refresh() but layer not refresh. # ...
4
votes
1answer
443 views

Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas? inPoints = "points.shp" i = 0 arcpy.MakeFeatureLayer_management(inPoints, "pts") arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", ...
1
vote
1answer
89 views

Running a QC check for gaps between vertices on a polyline

I'm checking polylines to make sure power pylons were correctly extracted from imagery. Is there a way to find all of the gaps or missed pylons in the database? Currently, I'm manually making a ...
6
votes
3answers
248 views

How to Run Viewshed on one feature at time in shapefile?

I have over 100 features in a shapefile and I want to create individual viewsheds for each and then run processes on each of those resulting viewsheds in ArcGIS using Python. Is it possible to write ...
0
votes
1answer
149 views

Qgis - taudem plugin - python script not found

I installed the sextante toolbox on qgis. my os is fedora. grass works fine but i've got problems with taudem. it seems like some python files are missing. for instance when i try to run the ...
0
votes
1answer
137 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
0
votes
1answer
113 views

Local variance image in python using gdal and a running window approach

I want a local variance image with a 3x3 of a geospatial raster image using python. My approach so far was to read in the raster band as an array, then using matrix notation to run a moving window and ...
0
votes
1answer
283 views

openlayers python proxy.cgi script is not taking parameters

I have setup the python proxy.cgi in cgi-bin folder in my server. [myserver]/cgi-bin/proxy.cgi returns the openlayers website [myserver]/cgi-bin/proxy.cgi?url=www.openlayers.org returns list index ...
2
votes
1answer
100 views

How to get a message when the map is moved in QGIS?

I want to get a message when every time I move the map. I had: def info(self): QMessageBox.information( self, self.tr( "Info" ), self.tr("info") ) I suppose that used to be something like ...
4
votes
1answer
236 views

“Sequence size” doesn't match row in Python?

Essentially I am trying to calculate a value for a couple of fields after adding them. Below you can see how I am adding the fields and then an example on how my "for" statement is looping through the ...
3
votes
3answers
3k views

Use Python to parse string [closed]

OK, I know that this is Python 101, but I can't seem to figure it out. I have a function setup that will return a string, specifically an azimuth in DMS. I need to take the return values and pull ...
1
vote
1answer
915 views

Python GDAL: Save array as raster with projection from other file

I have an array of data, and for each datapoint I know the latitude and longitude. I'd like to save it as a GTiff with the same projection as other rasters I have. This is what I've tried so far, but ...
1
vote
0answers
93 views

How to programmatically change an SVG symbol in the Vector Layer?

I'm trying to change the symbol used in a layer via Python. I've been able to tunnel through a vector layer to the symbol layer, but I don't know how to change the symbol it's using. I'd like to ...
7
votes
2answers
357 views

Autoincrement field when New Feature added

I know that this is probably a very basic programming but I am brand new to Python. I have a layer in a geodatabase that I need a unique ID field (for joining). I can't use the ObjectID because that ...
2
votes
1answer
151 views

Writing python plugin: How terminate plugin from script without closing QGIS?

I'm writing a QGIS conversion plugin in python to be able to create Obstacle-files for a model from shapefiles. What I want to do now is just to close the plugin cleanly. This means, to close the ...