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

learn more… | top users | synonyms

1
vote
1answer
187 views

Can I open a form in layer action?

I want to open a form (made in QTDesign) in the layer action. It is possible?
4
votes
2answers
211 views

Accessing arcpy functions from IronPython

I made a few python scripts to automatically optimize and publish my data.. Now i'm thinking about writing a .NET program to manage and run these scripts: the obvious way is invoking them in a ...
0
votes
1answer
702 views

How to insert values from one table into another?

I am trying to write a script that iterates through each row of a table, calculates for this row something. The result of this calculation is finally stored in another table (with just one row). Now I ...
0
votes
0answers
18 views

QGis non blocking notifications with pyqgis [duplicate]

I'm searching for the way to use the new QGis non blocking notification system with the QGis python wrapper. I found informations on this fonctionnality but nothing on how to use this especially with ...
2
votes
2answers
275 views

Tabulate Area crashes Python and ArcGIS

I have a script that runs Tabulate Area on a single feature class multiple times with different rasters. In total Tabulate Area runs 5 times. 2 of the input rasters are provided as arguments to the ...
2
votes
1answer
233 views

Arcpy Network Analyst solver error

Hello GIS Stack Exchange, I am finding it difficult to load locations to sublayers using python in ArcGIS 10.0 network analyst Vehicle routing problem. I'm also having some trouble debugging my ...
0
votes
0answers
28 views

using python and arcpy , how can I compute the direction and angle of a line segment? [duplicate]

if start_point_x < end_point_x and start_point_y > end_point_y: slope = ((end_point_y - start_point_y)/(end_point_x - start_point_x)) radian = math.atan(slope) degrees = ...
1
vote
0answers
348 views

Calculating the Centroid of polygon in modelbuilder (VBA to Python) [closed]

Got an easy one, that's got me stuck. I'm moving some models that were created in 9.3.1 to work in 10. Part of the model is calculating the X coordinate of a polygon to a specified field. The code ...
0
votes
1answer
187 views

arcpy.setValue for Condition from Dictionary

Hi: I am trying to create a function to update multiple fields based on different criteria. I want to pass the field name and condition thru' a dictionary (please see the function description in the ...
1
vote
1answer
168 views

Python GDAL: find out spikes and pits in DEM

I'm working with on a DEM (Geotiff) in Python GDAL, and I'd like to find out the spikes or pits in my terrain. I have no idea how to proceed, does anyone have good algorithm to help me out? Thanks, eo ...
1
vote
2answers
151 views

Set Extents of MXD to new layer data source?

Alright here I go again this forum has been good to me. I add a layer and replace its data with a shapefile I created using the following bit of python: layer = ...
0
votes
3answers
1k views

Create Text files from a loop with Python? [closed]

I need to create some files to hyperlink to from Arcmap. I have a folder of jpeg files (100.jpg, 101.jpg etc...). I need to loop through them and create a text file of the same name except replace the ...
1
vote
2answers
338 views

ArcGIS 10.1: “ERROR 000223: Cannot extract event table properties” when iterating through multiple files/folder

I am trying to convert ~270k csv-files with lat/long-data to layerfiles. The files are split into folders by year, i.e. ~30 folders with ~9k csv-files in each. I have written a script to iterate ...
2
votes
2answers
484 views

Field calculator or update cursor?

I have a feature class in which one field (let's call it "Field_A"), as yet empty, is to be populated by the contents of another field ("Field_B") multiplied by a certain number (I'll call it the ...
1
vote
0answers
92 views

Python GDAL/OGR: check lines geometries connectivity

I'm working with shapefiles representing roads, so basically it's stored as (poly)lines. I need to perform a road connectivity checking. In other words, I want to ensure that roads meant to ...
0
votes
1answer
531 views

Make Route with Python and network analyst in ArcGIS 10

Good Day, I'm having trouble debugging my python code to create a network analyst layer in ArcGIS 10.0. Basically when run from a script tool the code completes successfully without actually doing ...
3
votes
3answers
830 views

Is it possible to batch clip rasters in Quantum GIS?

I have been able to batch clip rasters in one directory using python in ArcGIS. However, I am not sure how to do the same in Quantum using the python console. Is this possible? If there are different ...
1
vote
1answer
358 views

spatialite.dll with Python and QGIS - the specified module could not be found

I'm having a bit of a nightmare getting to the bottom of this DLL loading problem. The stand alone script works absolutely fine but the exact same code does not work within QGIS. import sys from ...
2
votes
1answer
136 views

Python script to update attributes crashing during loop

I have a script to update a field in one feature class from a selected record in another feature class. This is done through looping through records in one feature class selecting appropriate the ...
0
votes
1answer
155 views

How to access the button on the form?

I have a form that appears when you start the plugin.How do I properly apply to the button on the form, so that when you click on the button performed "function". import sys,os import win32api from ...
0
votes
0answers
49 views

How specify a corridor minwidth?

I’m trying to make a corridor between two substations with ArcGIS, a macro corridor and a micro corridor. I have two questions in this respect and would be grateful for your suggestions. a) How can ...
3
votes
1answer
2k views

How to edit attribute tables using Python/ArcPy?

I am new to Python, so sorry for such a trivial question. There is a shapefile (let's call it Structures.shp) and the script I'm writing needs to update the value of only one record in only one field ...
1
vote
1answer
155 views

How to add attributes to shapefile with Python and pyshp?

I'm using pyshp for creating a shapefile. I need to populate tens of fields with values using the record() method of shapefile.Writer. I have those values as a list, but have no idea how to send it to ...
0
votes
0answers
71 views

Congressional Redistricting

I have a project coming up where I need to create new congressional district looking at only total population data. I am planning on using the census tract level of data, but I am having some ...
8
votes
1answer
2k views

GDAL/Python: How do I get coordinate system name from SpatialReference?

In Python, using GDAL, I've extracted a raster's projection as a WKT string as follows: wkt = dataset.GetProjection() # wkt is ...
1
vote
1answer
92 views

Setting More Than One Workspace

I have a number of tables that contain known values in a field. For example, I have a soil type table with one field in it. That field contains a list of known soil types. I have another table that ...
1
vote
1answer
79 views

ArcGIS 9.3 geoprocessing service output consideration

I'm developing geoprocessing service which do few processes with geographic data. I would like to get somehow geometry of those data and use it in my web aplication (JS ArcGIS API). Now I'm wondering ...
1
vote
1answer
157 views

Need python code example - setting a combo listbox to Null

I want to be able to set the value of a field to Null using python, but I get an error. I am using arcpy.CalculateField_management Any help would be appreciated. Rob Smith
0
votes
2answers
632 views

Tile script (Mapnik) with OpenLayers - Problem with projection (900913)

I use Mapnik python bindings in a geodjango application to render tiles in openlayers with datasource stored in postGIS in 900913 projection. The feature seems to be rendered correctly in the ...
0
votes
1answer
663 views

How can I create a line with three points with Python in QGIS?

I'm new to Python and I'm having some dificulties. I want to create a simple layer with a line in the console of QGIS with Python. How can I do that?
0
votes
1answer
348 views

Check if layer is a QGSVectorLayer from Python Plugin within QGIS

I am trying to extend some concepts in the QGIS Workshop tutorial. Basically, I would like to check if the layer is of type "QGSVectorLayer". In the QGIS Python console, I am able to type canvas = ...
2
votes
1answer
209 views

Generate unique ID upon creating a feature?

Looking for a way to generate a unique Global ID within a feature set when a new feature is created. For example, every time a sewer manhole is added, we need to generate a new unique Global ID that ...
1
vote
1answer
158 views

python gdal_polygonize error

I am trying to use gdal_polygonize to create a polygon from a binary raster. My code is: os.system('gdal_polygonize.py ' + filename + ' -f ESRI Shapefile ' + shapefile) where filename is a string ...
1
vote
1answer
129 views

OGR UnionCascaded gives strange lines (flat polygons)

I'm using OGR to perform a union using UnionCascaded. All my polygons have been created by GDAL polygonize which ensures that all polygons follow pixel edges and should therefore align nicely. But I ...
5
votes
2answers
2k views

How to do advanced Python labeling in Arcmap?

Does anyone have a good reference for advanced/complicated labeling expressions in Arcmap? I am attempting to write a Python label expression that would involve multiple label definitions. Here is ...
5
votes
4answers
429 views

How to computational efficiently check if there are any overlapping polygons in a group of polygons?

I need to do some processing with groups of polygons. If any of the polygons in the group overlaps other polygon the result is unpredictable and don't throw any error. So, I need to detect if there is ...
1
vote
2answers
944 views

ArcMap label expressions with Python

Having trouble here: I'm trying to use python to write selective label expressions. I have several concentrations and depending on its "_Ex" number I either want it labeled red, not red, or not ...
-1
votes
1answer
312 views

QGIS and Python - create line with multiple points in postgis [closed]

How can I create a line, with Python functions, with many points that are records in Postgis? Thank you
7
votes
2answers
1k views

How to Refresh open attribute table in ArcMap using ArcPy rather than ArcObjects?

I am running the Calculate Field GP tool from the arcpy in ArcMap. When a row value is updated, it does not show up untill I use the Reload Cache tool (Table Options > Reload Cache). How do I refresh ...
2
votes
1answer
291 views

Search cursor stops selecting after two iterations

I have a script which selects an extent from a grid and exports the data frame. import os, arcpy mxd = arcpy.mapping.MapDocument('CURRENT') df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0] ...
5
votes
2answers
547 views

How to create Network Dataset for Network Assistant using ArcPy?

Is it possible to create a network dataset with ArcPy to be used with the network assistant? In the documentation I found the Build Network and Dissolve Network functions, but it looks like both ...
4
votes
1answer
682 views

Using matplotlib to create and export graphs automatically from ArcMap

I am going to start a project soon where, after the data has been processed in various ways, an output jpg showing a graph of the data should be produced. The workflow is as follows: 1. A feature ...
0
votes
1answer
329 views

Use subprocess.call with gdalwrap

I am now want to use subprocess.call with gdalwrap to clip raster from shapfile (in qgis 1.8.0) I use raster→projections→wrap(reproject)to generate command_line below gdalwarp -t_srs "+proj=tmerc ...
2
votes
1answer
325 views

How to interpolate GPS data correctly?

I'm working on a project that involves using linear interpolation to fit lines to lat/lng points. I'm pretty new at scientific programming related stuff, and I was wondering if people could steer me ...
0
votes
2answers
235 views

Splitting Shapefiles [duplicate]

I am trying to create a code that will accept the input of a shapefile, and separate each of its features into separate shapefiles into a specified directory location. Can anyone help ? I am trying to ...
6
votes
3answers
2k views

How to efficiently read and reclassify many rasters in R

I've been tasked to create a suitability analysis of wave conditions in the Gulf of Mexico. I have 2 thousand or so raster files that are about 8 MB each (2438 columns, 1749 rows, 1km cell size). ...
0
votes
1answer
310 views

AttributeError: HelloWorld instance has no attribute 'connect'

Here's the code: import sys,os import win32api from PyQt4.QtCore import * from PyQt4.QtGui import * from qgis.core import * import ctypes from PyQt4 import uic class HelloWorld: def ...
2
votes
1answer
457 views

How to get point x and y geometry from a shapefile?

I have a shapefile of US Cities and I want to get the X and Y coordinate of EACH city in that shapefile. I've tried this: for city in city_cursor: geom = city.Shape point = geom.getPart() ...
1
vote
2answers
567 views

Can anyone recommend an Arcpy GUI? [duplicate]

Can anyone recommend a GUI for arcpy? So if I want to run my script as an exe with some blank text boxes(or text boxes with default entries), radio buttons, check boxes etc.
1
vote
0answers
189 views

Problems running zonal statistics - not all zones represented

I have been working on a Python script to automate the steps illustrated by whuber here:Create points around the edge of viewshed results I am trying to create a horizon graph illustrating the ...