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

learn more… | top users | synonyms

1
vote
1answer
58 views

How to select pixel with smallest number in stack raster using Python script in ArcGIS for Desktop?

I have 6 tiff file in ArcGIS which are identical in term of geometry (same frame, same number of row and column). The pixel value of each tiff file is integer and range from 1 to 4. So if I overlay ...
1
vote
1answer
268 views

ArcGIS 10.1 Converting a model tool to a script tool

I have recently created a model tool for a class project and my instructor would like it to be converted to a script tool for practice purposes. I have exported the script from my model and loaded it ...
1
vote
2answers
243 views

How do you get all the results from a Selection made by Attribute or Location using ArcPy?

Using arcpy I'm trying to get the results of a selection, or what is currently selected as a list. Basically I'm attempting to build an addin which on click will either perform an operation where I ...
1
vote
2answers
155 views

Using a different projection to calculate areas using the Field Calculator

I have a dataset that is in a WGS84_UTM projected coordinate system, can I force the Field Calculator to use another coordinate system when I use it to calculate areas using pythons ...
1
vote
1answer
100 views

ArcGIS, Edit Layer Extents with Python script

I would like to read and edit the Extent Values of each Layer in a MXD-file. My code: import arcpy mxd = arcpy.mapping.MapDocument(r"D:\Work\myInFile.mxd") for lyr in ...
1
vote
1answer
71 views

Field does not get updated with Geoprocessing Service

Can anybody tell why the field gets updated when I run this script in ArcMap but not when I run a geoprocessing service? Thanks #Import modules import os, sys, arcpy, traceback, arcgisscripting gp ...
1
vote
1answer
107 views

GDAL reports no bands for a 12-band raster and no projection either

When opened in ArcGIS, the raster correctly unfolds 12 bands, but when I try to open it with GDAL through Python, it appears as a raster that has zero bands. Here is the code: import gdal from ...
1
vote
1answer
98 views

How to add ArcPy Feature Layer to ArcMap automatically?

With Python, how do I get either the MakeXYEventLayer_management or the MakeFeatureLayer_management layer that is temporarily created added to ArcMap automatically after the tool is ran, without using ...
1
vote
1answer
502 views

Subsetting a curvilinear netCDF file (ROMS model output) using a lon/lat bounding box.

I am attempting to get salinity data from one of the ocean models in our region and have run into a roadblock. This is ROMS model output in NetCDF form, but the grid is curvilinear (lon and lat arrays ...
1
vote
1answer
806 views

How to import sextante(processing) for QGIS 1.9 (2.0)

In the current QGIS development snapshot the SEXTANTE toolbox has been merged into QGIS and is now known as "processing". This is a good step, but the previous import command doesn't work anymore. ...
1
vote
1answer
151 views

OGR: How to best use GetFeature on a selection?

I think the following is very confusing sel_str = "ND_14 = '108'" l.SetAttributeFilter(sel_str) l.GetFeatureCount() >>> 1 In a for-loop this gives me for f in l: g = ...
1
vote
1answer
325 views

ArcGIS 10.1 Python script to snap points to lines

I have 2 Feature Datasets in a geodatabase. One dataset contains bus routes and the other contains bus stops for each route. I want to create a script that will snap the bus stops to the vertex of the ...
1
vote
1answer
160 views

How to get Quantum GIS display a line or polygon feature created by Python package pyshp

I am not sure if I have discovered a regression, or if I have not enough sleep. While I manage to create shapefiles with point geometries with pyshp, line and polygon features don't show up in QGIS. ...
1
vote
1answer
265 views

Help with formatting ArcGIS text elements with Python

I'm struggling with a formatting issue that comes from inserting text into a Text Element object in ArcGIS using Python. I want to print a table of values of which all but the last column are numbers. ...
1
vote
1answer
44 views

Arcobjects- IAnnotateLayerPropertiesCollection2.QueryItem in Python

Anyone tried access label properties trough ArcObjects with Python? I try to obtain reference to label object with IAnnotateLayerPropertiesCollection2.QueryItem, but when I do: pA = ...
1
vote
1answer
39 views

How to export Std Dev from Raster Dataset of DEM to classify current extent and execute Contour Tool with Python?

I want to create Countour Lines for a DEM which are based on a "STD dev" classificaion. My problem is that the "Std dev" is exported in an unknown type instead of a String. So the classifacation for ...
1
vote
2answers
388 views

Fiona ImportError: DLL load failed

I've been using the great Shapely/Fiona combo successfully on Linux, but now i need to create a kind of production environment on windows and theres only one problem. When i try to import fiona, i get ...
1
vote
1answer
145 views

How to make a virtual layer from ogr geometry?

I know how to do this: nodes = driver.Open(node_nav,0) node_lyr = nodes.GetLayer() node_lyr.SetSpatialFilter(None) But how do can use the layer methods on a geometry I created from scratch? ...
1
vote
1answer
104 views

Export some specific pages from data driven pages to pdf file by python

I need to export pages 14, 13, 23 and 24 of 26 pages of data driven pages to pdf file by python and then add the pdf file to the final pdf file by arcpy (python), any help please?
1
vote
1answer
82 views

How to create point features from 1-Many relationship?

I have an address point shapefile for buildings in a city. The point shapefile shows only a single point for each building; apartments are listed in a table called additional addresses. I need to ...
1
vote
1answer
126 views

Python: Grabbing X,Y coordinate from matching fields

Here is my table. What I am trying to do is write a python script to go over the Zip_Crid values. If there are matching values, I need to grab x1, y1, x2, y2 and put it in a new field. Haven't ...
1
vote
1answer
75 views

Stop custom attribute form from resizing in Qgis

When I open a custom attribute form for a feature in Qgis it always gets resized to the default size of the original Qgis attribute form. I've tried to set the sizePolicy in QT Designer to Fixed ...
1
vote
3answers
868 views

How can I translate Modis HDF To GeoTiff

I've a MODIS04 L2, and I want to extract band 8:Image_Optical_Depth_Land_And_Ocean. I use Quantum GIS to open this band, because Quantum GIS see this is not coordinates so this allow me to select ...
1
vote
1answer
81 views

How do I change the isNullable property for a field?

Once in awhile I encounter a field in my featureclasses that have their isNullable property set to No. Is there a simple way using python to correct this? I came up with this code, but ...
1
vote
1answer
72 views

How to set parameters for Describe() function?

I developed one tool in arcgis using python code, in the process i used Describe(feature class) function to know the coordinate system of input feature class. I got success while compiling code, But ...
1
vote
1answer
101 views

ArcPy - Dividing every raster cell value by the maximum cell value

I want to divide every cell of a raster by the raster's maximum cell value using ArcPy. Here is what I have done so far. densityRaster = LineDensity(shapefileName, None, "", "", "") maxVal = ...
1
vote
2answers
122 views

Python select by attribute using a variable counter

I am brand new to python and trying to learn how to do some simple loops but I have hit a snag. Below is what I am working with, I am trying to select the polygon row by row, but I keep getting EOL ...
1
vote
1answer
141 views

How to iterate all input folders (containing coverages) using Python with ArcGIS 9.3?

I'm trying to write python scripts to batch convert thousands of coverages to shapefiles in arcgis 9.3. The coverages files are in different folders: d:/area_A/building d:/area_B/building ...
1
vote
1answer
153 views

How to set a spatial filter with Python/GDAL?

Is there a way with GDAL (Python) to set a spatial filter (bounding-box) on a raster before I process it? I want to read it as an array. BandReadAsArray(band, xoff=0, yoff=0, win_xsize=None, ...
1
vote
1answer
159 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?
1
vote
2answers
302 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 ...
1
vote
1answer
140 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 ...
1
vote
1answer
153 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
1
vote
1answer
572 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 ...
1
vote
2answers
190 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 ...
1
vote
1answer
1k 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
4answers
407 views

Get vector features inside a specific extent

The problem: I have a very large vector layer with many features and a much smaller raster layer in a defined region. I want to get only those vector features which are within the raster layers ...
1
vote
1answer
216 views

How to add MS SQL table using python console?

I have MS SQL Server 2008 R2 database. How to add MS SQL Table using python console in QGIS?
1
vote
2answers
151 views

How to handle adding a PostGIS layer in pyQgis without saving password?

I'm writing python plugin and trying to find the right way to add PostGIS layer on the map without storing user password. After adding layer on the map, I strip out the password from uri like this: ...
1
vote
1answer
86 views

GeoDjango - Use GDAL python binding in the shell

I would like to use the GDAL python binding in my GeoDjango site. The aim of this is to use ogr2ogr capabilities in a script. I am on windows 7 so I have installed GDAL-1.9.2.win32-py2.7 downloaded ...
1
vote
1answer
305 views

How to write a CSV from Python console in QGIS?

I am trying to write out a CSV file from a vector layer made up of points using the python console in QGIS. I've tried the following command: QgsVectorFileWriter.writeAsVectorFormat(layer_Map, Folder ...
1
vote
1answer
200 views

How to use QgsOverlayAnalyzer class in pyQGIS?

I am very new to Python scripting in QuantumGIS, so bear with me please. I am trying to use the QgsOverlayAnalyzer class in QuantumGIS (http://www.qgis.org/api/classQgsOverlayAnalyzer.html#details) ...
1
vote
1answer
312 views

Data Driven Pages, Graphs, and selections in ArcMap 10.1

Is it possible in python to create a selection set based on the extent from a Data Driven Page (DDP)? I have a layout view with a map and a graph. The graph is set to only plot the selected set of ...
1
vote
2answers
194 views

Batch set value/calculate field inside Cursor

I am matching data using a cursor, where one of the final steps is filling in a new attribute, match, with a value calculated during the cursor. This matching is done to an ID field in the original ...
1
vote
1answer
110 views

How to use QgsVertexMarker in a python plugin?

I am trying to display a vertex marker for a QGIS python plugin I am writing. I am getting a the following error... 'NameError: global name 'QgsVertexMarker' is not defined' canv = ...
1
vote
1answer
524 views

How do I copy all feature attributes to a feature in a new layer?

I'm trying to create a new layer in QGIS based on an existing layer. The new features should have all the attributes of the corresponding features in the original layer. I've been trying to use ...
1
vote
3answers
124 views

Applying rotation before FeatureToRaster_conversion?

I am converting polygon shapefiles to rasters. With arcpy I am using the function FeatureToRaster_conversion. gp.FeatureToRaster_conversion(InFeatures, InField, OutRaster, InCellSize) This function ...
1
vote
1answer
148 views

Why won't QGIS let me write to a file?

I am writing a QGIS Python Plugin. I am trying to write data to a file using with open("filename.txt", "w") as f: f.write("file text.") QMessageBox.information(None, "Test", "Written to file.") ...
1
vote
1answer
273 views

arcpy JoinField_managment RuntimeError

So, I've been banging my head against the wall the last few days trying to figure out what's wrong with my script. It's suppose to pull weekly flu data from a department of health website, parse it ...
1
vote
1answer
657 views

Error code 500 at REST Endpoint of published geoprocessing service - Problem with output parameter type?

Using ArcGIS 10.1 (Server and Desktop) I've been trying to publish a geoprocessing service based on a python script I wrote. Of course, it all works flawlessly from ArcGIS Desktop but I run into all ...