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

learn more… | top users | synonyms

3
votes
1answer
95 views

What is QGIS equivalent of ArcGIS GetCount for use in Python script?

I have a number of layers in QGIS that I would like to select attributes on, and get the feature count for, within a Python script. In ArcGIS for Desktop I have been using SelectLayerByAttribute ...
2
votes
3answers
550 views

How to prevent ArcGIS SOC from locking Oracle tables?

I have a python geoprocessing that performs CRUD operations on feature classes and oracle tables. Sometimes, when handling Oracle tables, ArcGIS SOC gets hung and locks the Oracle table. I need then ...
0
votes
1answer
214 views

Shapely Python NameError when using cascaded_union

I am fairly new to Python and therefore my error-solving skills are not much yet developed. I am using Python within a geoprocessing script which is supposed to use ogr (reading/writing shp) and ...
15
votes
4answers
2k views

Is there Python library (other than ArcPy) for geoprocessing such as buffer?

Excluding ArcPy, is there any python library which can do geoprocessing, such as buffer/intersect, with shapefiles?
2
votes
2answers
516 views

Python Def Query Help for multiple layers

I have Three layers in a .mxd, all three layers have a common value I can use, but a different Label in each Layer. As an example, the Value I want to use is "100" In Layer A, the Value is in [Name] ...
1
vote
1answer
64 views

Access atributte processing algorithm

I have a doubt. In my plugin I use algorithms from processing sextante. For example: Processing.runAlgorithm("grass:v.to.rast.attribute", None, inputLayer, 0, Indexes, extent, cellSize, -1.0, 0.0001, ...
2
votes
2answers
1k views

How to programmatically change raster symbology after reclassification?

I have created a code in Python that I will use for a custom tool in ArcGIS, the code will create a Eucledian Distance of 6000m around a point and Reclassify the distance from 0-2000, 2000-4000, 4000-...
5
votes
2answers
1k views

How to remove all selection from all registered layers using QGIS plugin?

I want to remove all selection from registered layer in QGIS using Python. I tried to clear the map canvas using: self.iface.mapCanvas().clear() self.iface.mapCanvas().refresh() but the ...
-1
votes
2answers
984 views

Export MXDs files to PDFs using Python [closed]

I'm trying to write a python script that will export multiple MXDs to individual PDFs while using a feature class field to rename the pdfs (this can be an optional field, if not check it can copy the ...
3
votes
1answer
321 views

Creating a polyline from point data that represents multiple linear features in ArcGIS 10.0

I have a problem where I have to somewhow create a polyline feature class in ArcGIS 10.0 from points that were collected in the field using a Trimble GeoXT that represent the start and end of multiple ...
3
votes
1answer
844 views

How can I delete a shapefile using OGR?

In my QGIS Python plugin, I use shapefile layers and I am having a problem rewriting existing shapefiles. Is it possible to delete a shapefile from disk using OGR?
3
votes
1answer
411 views

Is there a method to write feature class attributes and counts to an excel workbook in Python? [closed]

I have a feature class with 3 fields that I would like to reference later in an excel workbook. They are all represented in 3 different maps. Essentially, I would like to show the the attribute ...
4
votes
3answers
3k views

How to install Fiona to read Shapefile attributes with OSGeo4W?

I´m developing a plugin in Python and I need to read the shapefile attributes, so I found the Fiona API and dbfpy also but I don't understand how to install these packages because I install the QGIS ...
3
votes
1answer
1k views

Calculating angle of polyline at midpoint using Python/ArcPy?

Trying to calculate the angle of a line at its mid point using python; this will be used to display flow direction on a water network. I've developed this script, which works in terms of generating ...
0
votes
1answer
215 views

How do I use gdal_proximity.py from the QGIS python console?

How do I run gdal_proximity.py from the QGIS python console?
1
vote
2answers
318 views

How to read arc/info e00 vector files (no binaries) with Python?

I can easily read e00 files with QGIS and it seems as if in older versions of ogr there was driver support for the arc/info e00 file format. Nowadays that seems to be deprecated, as running ogrinfo --...
1
vote
1answer
64 views

which feature of toolboxes will be appropriate for building a groundwater model in Model Builder [closed]

I am completely new to ArcGIS Model Builder and also Python scripting. However, I want to build a model to automate groundwater recharge.
3
votes
1answer
142 views

How to Create Feature Layers and Search by Location for all Feature Classes in Geodatabase?

I'm very new to python, but I'm having trouble finding the answer on my own. I need to loop through a given file geodatabase, select any features that intersect a project polygon and then search the ...
2
votes
2answers
1k views

How to merge dbf files in Python or arcpy?

I have over one hundred dbf files to merge. Each of files have two columns: ID and another field which differs from one file to another. I want to merge those fields based on ID such that each raw ...
0
votes
0answers
46 views

Import processing in qgis 2.0 [duplicate]

I know that this question has already asked but no concrete answer has given!! My environment is Ubuntu 12.04 and I'm using eclipse-pydev as IDE. Thanks in advance for helping me.
2
votes
1answer
1k views

How to convert arcpy.InsertCursor to arcpy.da.InsertCursor in Python code?

I have some working code using arcpy.InsertCursor which I want to convert to arcpy.da.InsertCursor. This I want to do primarily as ESRI claims that da methods are more optimized. The code I have is ...
4
votes
1answer
116 views

SpatialLite BulkLoad and Merge

Via the U.S. Census I have downloaded all of the census group shapefiles. These are approximately 19-20GB across 56 shapefiles. I want to merge these to do some testing. Clearly, shape file ...
2
votes
2answers
373 views

How can I close the identify result dialog programmatically?

I am trying to close the identify result dialog which appeared when I select to identify a feature from the active layer. Does someone know how can I do it?
1
vote
1answer
512 views

gdalbuildvrt error, when using in Python

I am new to python/GDAL and am running into perhaps a trivial issue. This may stem from the fact that I don't really understand how to use GDAL properly in python, or something careless, but even ...
1
vote
4answers
4k views

How do you create a point at the midpoint of a polyline with Python?

I have a polyline shapfile (that contains multiple lines) and am trying to create a point at the midpoint of each line using python. I am currently using the ET Geowizards tool 'PolylineToPoints' ...
5
votes
1answer
467 views

Is there a way to find out which pixel values are around the current pixel?

I would like to write a cycle which takes a current pixel, look at the surrounding pixels, choose the pixel with max/min value and skip to that pixel...and so on. Is there in arcpy such a function ...
0
votes
1answer
39 views

How to work with Multivalues in arcgis script?

I am really beginner in arcgis scripting. I was unable to find a solution of my problem, so I'm writing here. My problem: On my input I want some shapefiles. When I load them from ArcGis Tool, I ...
0
votes
1answer
208 views

Plugin QGIS Error “QTextEdit.setPlainText(QString): not enough arguments”

I try to make save as button but i got this error message when try to save file in my directory File "C:\Users\Mr.Pakde/.qgis2/python/plugins\condition\conditiondialog.py", line 80, in saveAs ...
5
votes
1answer
396 views

How can I get the field index of the new layer in my script using Python?

I am trying to use layer.changeAttributeValue(fid, fieldIndex, value) to add values to a field in QGIS Basically, I'm creating a plugin which will, if a checkbox is ticked, create a new field, then ...
8
votes
5answers
7k views

How to set all pixels with value <= 0 to “nodata” in DEM raster?

I have a DEM raster with pixel values between about 3000 and -0.0003. I need to set all pixel with a value of 0 and smaler (<=0) to "nodata" (for later raster calculations and to reduce the ...
5
votes
1answer
937 views

How to determine using Python whether ArcSDE table is registered with geodatabase?

In an effort to improve my Python skills, I am trying to build code to automate the Compress and Analyze commands for our SQL 2008 R2 SDE database (code below). The Compress code works as does the ...
0
votes
0answers
51 views

List attribute values ​​of selected points in the layer

I need to grab the fields in the layer of the selected points in the order they were selected by the user. My code: Connection to the database and display the map on the screen, everything ok: uri =...
0
votes
0answers
65 views

Need advice on how to use Select Junction by Edge Count at pythot script?

Is There a way to use the tool Select Junction by Edge Count (selecting all junctions (points) in a geometric network by the number of edges to which they connect) at Python script ? or can i use ...
1
vote
1answer
204 views

Save input in plugin as pdf format file

I m trying to make QGIS plugin with plugin builder that compare 2 map scale with Input1 and Input2 as input scale and show recommendation after clicked recommendation button. I wrote my code like ...
6
votes
4answers
2k views

Matching GPS tracks

I'm looking for a proper way to process multiple GPS tracks (so time ordered list of lat/lon points) and match/classify that segments, that are covered by multiple tracks: So it's not about ...
2
votes
2answers
3k views

How to terminate Python scripts in Processing framework properly?

I'm writing a Python script to use it in Processing framework. I need to cancel script execution if certain conditions are met (to save user's time). I tried to use sys.exit(arguments) command. The ...
4
votes
2answers
340 views

Is there a function to select a region of a map for further processing with Python?

I would like to select a map's region in QGIS for further processing with python console. Ideally I would like to select the region with a mouse drag (like Gimp crop function) and then e.g. analyze ...
2
votes
2answers
829 views

How to create equidistant points in QGIS along a polygon?

I am looking for a solution to distribute with a python script equidistant points in QGIS along a polygon. I tried to use the following code example: http://nathanw.net/2012/08/05/generating-chainage-...
1
vote
0answers
192 views

Create custom “Export To” context menu tool using selected feature in ArcCatalog

I'm trying to create a custom "Export To" script similar to the Right-Click Export Content menu item "To Geodatabase... (multiple)". I have a 3 feature classes in a file geodatabase. I selected two of ...
1
vote
2answers
152 views

How to transfer multi attributes in to features?

i have 2 feature classes, i want to transfer all attributes by one click to another attribute feature class, i have used Spatial Adjustment tools, but the challenge with me is to, how to transfer all ...
2
votes
1answer
1k views

How to make autoIncrement number start with (001…009, 011…099)?

i have a challenge with my time in my work, i have feature class called "Parcel" storing many data, i generated an autoIncrement number by using field calculator, in field "parcel code" Expression: ...
-1
votes
2answers
277 views

How to get layer extension info via Arcpy

I want to get file format of a layer with using Arcpy. I am writing a tool that needs to take raster or feature extension like SHP, TIFF etc. Which functions should i use ? Note: I use ArcGIS 10
1
vote
1answer
99 views

python scripts for accessing info from a postgresql database in case of a qgis application?

I am beginner and I need to know if I could access a postgresql database from python script made for a qgis application
0
votes
1answer
96 views

How to Add Field Between Two Existing Field in Shapefile

Can you please let me know if it is possible to add a new Field between two existing field using ArcPy? For Example if I have "Name", "Area", fiels already in my shapefile can I add a new field called ...
3
votes
1answer
343 views

How to apply a color gradient to a shapefile from QGIS console?

Anyone knows how to do a color gradient from the console to a shape file in Qgis (orin Python)? Like the image below.
3
votes
3answers
1k views

Formula for coordinates (lat, lon), azimuth and distance.

I would like to know how to find a set of coordinates on a small circle some distance from another point. For example, lets say A = (39.73, -104.98) #Denver B = (39.83, -106.06) #point ...
0
votes
1answer
376 views

Python: Using re and update cursor over three columns [closed]

I'm working on this code and got a little to excited...only to find out it wasn't perfect! I'm trying to eliminate the suffix (row1) of roadnames(row0) and parse just the roadname to a new field(row2)....
5
votes
2answers
664 views

Auto-updating symbology between *.mxds for same shapefile using arcgisscripting?

I have a variety of .mxds for any one project I'm working on, which are all different but all use the same set of base shapefiles for my project. I know I can save a .lyr version of my initial ...
4
votes
1answer
197 views

Are Date columns in feature classes stored as python datetime objects?

I have a Date column called readings_measurement_tstamp stored in my feature class. I would like to add a String column to this feature class and Field Calculate it to be be just the %H:%M:%S ...
0
votes
0answers
85 views

Loading QGIS and files from Python's use of os.system?

I am trying to open QGIS and load two files using the following code in Python: os.system('qgis D:\data\vector.shp D:\data\raster.tif') However it returns this error message: 'qgis' is not ...