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

learn more… | top users | synonyms

1
vote
1answer
397 views

List Map Services and Publish/Delete Map Services using Python in ArcGIS 10.1

I looked at the link http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000004s000000 which describes listing of map service for 9.3, how can we do this in 10.1, moreover I am trying to ...
1
vote
1answer
195 views

Updating the value of a field with pre-defined values

I am trying change the value of a row for a field whose type is "short" in arcmap using a python script. with arcpy.da.UpdateCursor(FILENAME, FIELD) as cursor: for row in cursor: row = ...
1
vote
1answer
48 views

Deleting the cursor object

Can someone explain why you need to delete the cursor objects and the iterator when you use for example: arcpy.UpdateCursor(blah) I've checked the esri docs and there doesn't seem to be an ...
1
vote
1answer
314 views

Select By Atribute using python script on .Shp file getting error 000840 the value is not a raster layer

I have a script that calculating vertices angles on Polyline layer and the selecting features in that layer at a specified angle. at the end of the script i'm using select by attribute and getting ...
1
vote
2answers
2k views

How to set workspace as Python script tool variable/parameter?

I'm pretty new to Python. I'm trying to write a script and as I want to automate it as much as possible, I'm wondering is it possible to set the workspace as a variable so that when it's run as a ...
1
vote
5answers
577 views

String variable substitution in selection expression

I'm trying to put a variable into a string used to do a selection. At the moment it's like this... expression = "'No_Props' > 5 AND %s < 200 AND 'ST_Ori' >60" % metres_field ...
1
vote
2answers
146 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 = ...
1
vote
2answers
287 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 ...
1
vote
2answers
244 views

ArcPy- AddJoin-function struggles using Table of PersonalGeodatabase

Hey, I am doing some arcpy -functions and afterwards I'm trying to add the calculated results from one table to another table. I'm using the arcpy.AddJoin_management() function. As input table I'm ...
1
vote
1answer
785 views

How to change vector attributes values?

I want to change vector attributes values. i could not get the command fet.setAttribute indeed, it is mentionned in http://hub.qgis.org/issues/7223 that: "The QgsFeature instance now must be ...
1
vote
1answer
107 views

Adding parameters to a category in a script tool

There is plenty of documentation on how to add parameters to a category in a python toolbox, (See the bottom of ...
1
vote
1answer
505 views

Arc 10 Python .shp attributes - usings fields to populate other fields - if/then/else statement

Ive been looking for a solution and unable to find one so please help if able: I'm trying to avoid manually inputting Begin and End engineering station values already inputted into a seperate field. ...
1
vote
1answer
133 views

cannot print listRasters

I'm trying to run this very simple script to check a problem in another more comlpex one. import arcpy arcpy.env.workspace= 'C:\\Users\\Umberto\\Desktop\\Prove_Script\\Karakoram\\temporary_01' rst= ...
1
vote
2answers
91 views

Distribute gridded data to corresponding subbasin boundaries

I have one ArcGIS shapefile of my river basin consisting of many subbasin. Another shapefile showing the location of gridded points over the whole basin (Its latitude and longitude are used as file ...
1
vote
1answer
151 views

Is there a bug when creating a relationship class with Python using a GlobalID?

I'm trying to create a relationship class with Python using a GlobalID. When I use Python it gives me the error: Failed to execute. Parameters are not valid. ERROR 000800: The value is not a ...
1
vote
1answer
121 views

Extending ArcGIS

I've been tasked with a thesis project where i have to extend the features of ArcGis. I've been asked to create a model written in Python that can run out of ArcGIS 10. This model will have a simple ...
1
vote
2answers
415 views

Need help getting started with QgsComposition

I am using QgsComposition for the first time, but I fail at the first step :-( mapRenderer = iface.mapCanvas().mapRenderer() line 31, in mapRenderer = iface.mapCanvas().mapRenderer() ...
1
vote
2answers
128 views

“AttributeError: getZ” error when trying to get the elevation of DXF linestrings

I'm using Python and OGR to extract the elevation of lines within a DXF file. import ogr driver = ogr.GetDriverByName('DXF') datasource = driver.Open('test1.dxf', 0) layers=datasource.ExecuteSQL( ...
1
vote
1answer
618 views

The table was not found error - ArcGIS 9.3.1, Python

I have a python script that does the following on multiple tables maketableView - not shown in code Addjoin Copyrows MakeTableView it was working ok, until all of a sudden it stopped. Heres ...
1
vote
2answers
663 views

How to automate relative filepath when adding a new toolbox to the arcmap catalog?

So I'm creating an arcpy script for a custom toolbox and I want to make it so that a user can essentially utilize the script in that toolbox without having to change the source path (which I made ...
1
vote
2answers
752 views

arcpy.Delete_management not deleting

I'm struggling with deleting an mxd in a for loop. My code is: import arcpy, glob, os, datetime, time from time import strftime for filename3 in glob.glob(os.path.join(folderPath, ...
1
vote
3answers
2k views

Using QGIS with a pre-existing installation of Python 3.2 and matching GDAL

I need to have GDAL/OGR working with Python 3.2 because of another dependency. However, I also want to have QGIS for convenience. However, QGIS - FWTools in particular is built against Python 2.5, ...
1
vote
2answers
3k views

Get extent of Georeferenced Rasters in Python and output to polygon shapefile

I would like to create a shape file containing the extents of each of the rasters in a directory. Is it possible to capture the extent of a raster using Python? I have tried ...
1
vote
2answers
884 views

Creating and serving pdf files from ArcGIS server 10.0

I am tasked with sending map data from the Flex client to an MXD then to serve that as a PDF to the client and/or a server side location. Creating the PDF isn't an issue, however, I am having trouble ...
1
vote
3answers
956 views

Return results to user of python script from ArcToolbox : EDIT 9.3

I have a script in a custom toolbox which sums the values in a given field. After the user indicates which field (currently I have them typing it in but would love to know how to get the ArcToolbox ...
1
vote
2answers
1k views

unique value symbolize layers from a lookup table

I need to create a large number of Arcmap layer files (v9.3 or 10), perhaps a hundred, from lookup tables. I don't have to set the symbol patch itself, that can be random, but I do need the value and ...
1
vote
2answers
40 views

How to skip over errors created by cursors running through empty tables?

I am trying to automate the creation of many different feature layers were their content is created by a cursor. Sometimes during the automation, a feature layer may be empty, this is okay, but as the ...
1
vote
3answers
69 views

How to generate automatically the name of output parameters in a python script tool? [on hold]

I have some Python script tools in ArcGIS for Desktop. I need to reproduce what all geoprocessing tools do when the first input parameter is introduced: autogenerate a workspace and basename for the ...
1
vote
1answer
31 views

trouble with code block execution in python script

I am trying to calculate values for a field in a python script, but keep getting an error that I don't understand: ExecuteError: ERROR 000539: Error running expression: Fron000000F1 Traceback (most ...
1
vote
1answer
101 views

Installing pandas with Esri's python?

Trying to get pandas to import, but I'm getting what looks like an error caused by a failed dependency of the version of my Esri-provided numpy's compile, based on this stackoverflow posting. Here's ...
1
vote
1answer
34 views

Con() does not recognize raster values

I have a problem when using the con() argument. What I want to do is to remap all raster of a raster file ("Red_SL") cells with values larger than 40 to the new value 5. All other values should be ...
1
vote
2answers
44 views

How to find the minimum pixel value within a region of interest?

I am working on a Python script for dark object subtraction, a radiometric correction method for remotely sensed data.To accomplish this, I need to find the minimum band pixel value of a waterbody ...
1
vote
2answers
54 views

Python query to find records with more than one alpha character in a field

Using ArcGIS Desktop 10.2. I have a field in a table of several thousand records. The field is made up of alphanumeric characters. I'd like to perform two queries using python on this field: ...
1
vote
1answer
37 views

Can't get SRS from PostGIS using Proj4 text

I'm having a problem transforming a point from the Australian MGA UTM datum (eg MGA Zone 51 http://spatialreference.org/ref/epsg/28351/) to WGS84 using GeoDjango. I've narrowed that down to a problem ...
1
vote
1answer
66 views

Arcpy: List to point feature class

I have a list of lists that contains: [vala, valb, valc, vald, (pntx, pnty)] [vala, valb, valc, vald, (pntx, pnty)] [vala, valb, valc, vald, (pntx, pnty)] I also have a list of the field names that ...
1
vote
2answers
110 views

Calculating distances between points two feature datasets

I will do my best to explain my problem. I have two feature datasets. One set has about 100 points that are "city centers." The other dataset has points for each census tract in each of these 100 ...
1
vote
1answer
68 views

Fix Black Border in Python Batch Raster Conversion

I have a Raster image like this as you can see the road are not connected between 2 raster (up and down) its because the scanned raster use different projection (dgn utm 50s) than my data frame (utm ...
1
vote
2answers
160 views

Create Feature Class From XY Table Using Python

I have some txt files that are basically attribute tables (object ID, latitude, longitude, area). In ArcMaps, I have been converting these files into feature classes and saving them in a geodatabase ...
1
vote
2answers
57 views

Running a Focal Mean or Low Pass Filter or 3 by 3 Mean Kernel in GDAL \ gdal_calc

Hi I am looking to run the equivalent of Focal Statistics in gdal_calc. Is it possible? It is a simple focal I require. I need to run a 3 by 3 kernel over the data (mean) and if possible only on ...
1
vote
1answer
57 views

how to assign keyboard key to python script in arcmap

I have a python script and I use it through my toolbox but I use it many times in a day. Is it possible to assign a keyboard shortcut to my tool ?
1
vote
1answer
47 views

How to open most recent directory using PyQGIS?

For example, when I add a vector layer, next time that I want to add another layer it opens up where I chose my last layer from. How would one implement this in Python and/or PyQgis? I'm writing a ...
1
vote
1answer
70 views

Error with data frame in python script

I'm running a python script from arccatalog and it works, however, I am trying to add layers to an mxd and need to declare the data frame. I keep getting this error message. type ...
1
vote
1answer
128 views

How to get Z attribute of point using Python and ArcGIS Desktop 9.3?

I am making a python code for arcgis 9.3. In this code i create a new point with x,y and z attributes as following : rowsLine = gp.updatecursor(line_Feature_Class) rowLine = rowsLine.next() ...
1
vote
1answer
51 views

Why does Animal Movement toolbox give SyntaxError: invalid syntax?

I found a complete toolbox (Animal Movement tbx, by Regan Sarwas) for my tasks and I tried it. I had a systematic problem with the codes for all tools (line 1), for exemple: Executing: ...
1
vote
1answer
90 views

How to call ogr2ogr from command line with Python 2.7 from ArcGIS 10.2 for Desktop?

I am trying to access ogr2ogr in the command line, and this is the message I receive: 'ogr2ogr' is not recognized as an internal or external command, operable program or batch file. This is ...
1
vote
2answers
166 views

Counting Characters using Field Calculator - Arcmap

I am trying to use field calculator to populate a column based on the the number of characters in another column. I am using the Python Parser. I am not sure if the .count() function is appropriate in ...
1
vote
1answer
67 views

Python in ArcGIS, CalculateField_management, updating with single value

I have a float field which I want to simply update all values with 1. I can easily do this within the field calculator but I have started using python today, what is the syntax to simply update a ...
1
vote
1answer
94 views

Python.dll could not be loaded with PyScripter

I'm trying to configure PyScripter with QGIS. I've installed it using OSGeo4W and I'm following instructions to setup a pyscripter.bat file by copying content of qgis.bat file. I have the following ...
1
vote
1answer
106 views

Python syntax error -can't figure out why? [closed]

This should be simple. I hope I don't get down votes! I just got the following code from an article about using Google Maps API and ArcGIS to calculate routes without network analysis and just can't ...
1
vote
1answer
144 views

QGIS Map tools and Map canvas--QString errors

I'm trying to learn more about using QGIS Map Canvas widgets and creating custom map tools, so the information from the PyQGIS cookbook is very helpful. After trying to experiment with mywnd.py from ...