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

learn more… | top users | synonyms

0
votes
0answers
411 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
155 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
224 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
477 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
230 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
370 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
180 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
95 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
179 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
364 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
204 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
687 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
121 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
530 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
271 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
557 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
436 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
247 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
147 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
112 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
282 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
99 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
233 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
905 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
351 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 ...
1
vote
1answer
46 views

How to keep specified separation distance between features in printout from ArcMap?

Does anyone have a solution to select features using attribute values and print only the selection keeping a specified separation distance between the features in the printout in ArcMap.
2
votes
1answer
375 views

Joining table to shapefile with pyQGIS

Joining shapefiles is a relatively straightforward proess in QGIS using 'add vector join' in the layer properties menu. I can add a csv file as a vector layer, as well as a shapefile, and join the two ...
3
votes
1answer
121 views

How to see print commands through Python Script while programming plugin for QGIS?

This might sound like a silly question. Is there a way that from running a custom plugin made for QGIS that a Python Shell can appear along when the plugin is run, like a debug screen. I'm asking ...
6
votes
4answers
1k views

How to convert geometry to WKT using ArcPy?

I would like to be able to convert a single feature (or potentially many features) in an ArcGIS layer into Well Known Text (WKT) format during a geoprocessing operation using Python and ArcPy (no ...
2
votes
0answers
96 views

traversing KML files with ogr python

i'm new to OGR processing and KML format so be gentle: i've got a series of KML files all containing multiple regions partitioning a larger area in each. i also have a series of geocoded points for ...
1
vote
0answers
58 views

Clipping Buffers

I have buffered a line shapefile where many lines are intersecting but not broken at intersections. I am trying to select each record in the buffer file and clip all intersecting polygons in the same ...
3
votes
2answers
356 views

Create point geometry in a feature class with all the attributes prepopulated

So here is the problem. I have a text file with space delimited values. A standard text file with the headings separated by spaces and then on each next line values for these headings (columns) also ...
3
votes
2answers
488 views

Delete feature selection using Python (ArcGIS 10)

I'm having some issues with a Python script for ArcGIS 10. The idea is to delete points from a single shapefile according to the values of two columns ("Tracks" and "Tracks_1"). Therefore, I want to: ...
5
votes
1answer
476 views

Speed of editing attributes in QGIS from a Python plugin

I'm trying to edit the value of an attribute for each feature in a layer using a QGIS Python plugin. I've found that doing this outside of editing mode is much slower than while editing (even ...
2
votes
2answers
311 views

upload table to ArcGIS Server

We are building a process which will allow users to submit a table of GPS data to update our central repository for all GPS data. Let's say that the target is simply a SQL data table. At first I ...
2
votes
1answer
264 views

Python code: Using Search Cursor to find missing values in attribute table between two layers in one MXD

I need help! I am writing a program that will look through the table of a station layer and then go to the annotation layer and list all the missing values. For Example: The station layer has a field ...
0
votes
2answers
447 views

Using Python to parse an XML containing GML tags

I am trying to write a python script which pulls GML tags out of an XML file and formats them into WKT for inserting into a PostGIS database. I have been successful in doing so for an XML containing a ...
6
votes
3answers
722 views

How to replace non-English characters in attribute tables using Python?

I have a few shapefiles where some of the attributes contain the non-English characters ÅÄÖ. Since some queries doesn't work with these characters (specifically ChangeDetector), I tried to change them ...
2
votes
3answers
538 views

Interacting between Openlayers and Python

I have a openlayers website like this one that gives the user the ability to draw polygons and then creates a GeoJSON file. I want to process this GeoJSON with a python script. The python script ...
0
votes
0answers
85 views

Create Vertex and add empty attributes to it

How can I create a vertex(and then a point feature on the vertex) on a polyline and give it some empty attributes(create fields), move an existing vertex, delete vertex? I am in ArcGIS environment and ...