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

learn more… | top users | synonyms

3
votes
1answer
101 views

Why does the next() method fail after the last record, using arcpy.da.SearchCursor?

Using the older arcpy.SearchCursor, the next() method would return Nothing once the last record had been passed. Using the newer arcpy.da.SearchCursor, I'm finding that the next() method crashes the ...
0
votes
1answer
83 views

Auto increment a new column using Model Builder Field Calculator in QGIS?

I am making a model which requires creating a grid and clipping various layers to it. Using the Create grid function does not provide an ID column, instead it creates 2 columns: "longitude" and ...
3
votes
2answers
96 views

A python tool like GNU's diff for shapefiles?

I often use the GNU diff tool to compare two files or even two folders for differences. I was wondering if there is a Python based tool out there that does basically the same for shapefiles? In the ...
2
votes
1answer
48 views

PyQGIS: How to send signal if layer is currently in edit mode

I'm looking for a way to send a signal if a layer is in editing mode. I tried editingStarted(), but it wasn't working. I'd like to do something along the lines of the what I have below, but can't find ...
1
vote
0answers
27 views

Programatically export labels to CAD based on another field value

The problem: I have a fairly simple procedure to export both the polyline features (architectural cad layer) and the ID's (attribute fields from polygon features that fill the rooms in another layer) ...
1
vote
1answer
44 views

Finding Code in QGIS Select Features Toolset

Can anyone tell me in what directory the pre-installed Python scripts for the QGIS selection tools (i.e., Select by Point, Select by Polygon) are found? I am using on a Windows 7 installation of QGIS ...
0
votes
0answers
16 views

Problem with full extent after using python code [duplicate]

I delete my previous post on the same topic because it was not clear. I made a python code for ArcGIS 9.3 which : copy a shapefile every feature in the shapefile are shift for an x and an y given. ...
1
vote
0answers
69 views

Converting GRIB to Geotiff with gdal_translate in Python

I want to extract each band from a GRIB (gridded binary from http://data-portal.ecmwf.int/data/d/interim_daily/) in a single Geotiff image. I´m using Python with gdal_translate in a QGIS backround, ...
2
votes
1answer
65 views

How to implement 1:n joins with string attribute concatenation?

I have a question concerning pyQGIS. I'm a QGIS long-time (self-learned) user, but just a pyQGIS newbie. I want to implement 1:n spatial join with attribute concatenation in the table. I have a vector ...
2
votes
1answer
112 views

Get a Shapefile Geometry Type

I am making a python code for Arcgis9.3. In this code I have an input feature and I create a Output feature. I want that the output feature is the same geometry type as the input feature. At the ...
1
vote
1answer
23 views

ogr: what is the advantage of using `geom.Clone()` over `geom`?

What is the advantage of using geom.Clone() over geom? Simple example: geom = link_feat.GetGeometryRef() newfeature.SetGeometry(geom.Clone()) # or newfeature.SetGeometry(geom) ...
4
votes
1answer
93 views

PostGIS table to network analysis

I use PostGIS 2.0 and Python API (GeoAlchemy) to work with it. I want to convert topological informations (points, lines, faces) from PostGIS tables to topological network (points, lines) to study it ...
0
votes
1answer
74 views

How to list..only the Field names for a group of files in a folder?

I am having...for eg, 27 files in a folder (may be a shp or tab). Is it possible to list the Field_Names (ID, Type, Date, Allotment, etc..) alone of all those 27 files in a csv format or xls format?
0
votes
0answers
46 views

error when running a script for clipping a group of rasters on QGIS 2.2 OS X 10.9

I'm trying to clip a group of raster files on QGIS 2.2 (KyngChaos) running on OSX 10.9. When I run the script I get an error related with the location of the files. I'm wondering if this is something ...
4
votes
1answer
68 views

How to automatically check for lidar flight line overlaps?

I have a series of lidar-based raster products created via FUSION. Since I am working with low density lidar data, many of the raster images show significant striping where lidar returns overlap on ...
1
vote
1answer
66 views

How do you set up XY Event Layer Parameters on ArcGIS Script Tool? (asking for user input)

I've made the XY Event Layer work through python script, but can't get it to work correctly as a python script tool on arc, asking for user input. Does anyone have any suggestions? This is the script ...
1
vote
1answer
68 views

Determine Equal-Area Slope of Longest Water Course in Catchment

I'm still very new to python and need some direction in developing a Arcpy\Python script to determine the Equal-Area Slope of the Longest Water Course within a catchment. The Longest Water Course is a ...
0
votes
0answers
27 views

Creating separate Polylines from Points using ModelBuilder and Python Script Tool? [duplicate]

I have a list of coordinate points (long and lat) of 4 locations (points 0, 1, 2, 3) saved as a feature class shapefile. I want to create a polyline that will connect points 0 and 3 and create a ...
0
votes
1answer
34 views

arcpy: how to access element in list? [closed]

I would like to know how to get the elements from the list, maybe using for loop?... here are the code that can save all the angles into myList[] myList = [] for num in range(1,totalStop+1): ...
5
votes
1answer
63 views

Automate loading a table into SDE

How can I automatically load a table stored on a network share into SDE when the original table is edited? Environment is ESRI 10.1 ArcSDE on SQL Server. Preference for python or existing GP tools. ...
0
votes
2answers
88 views

I need an arcPy script for choosing objects from a table at random

I am trying to write an ArcPy script that will select X number of rows from a table with N number of objects in it, then output that selection to a new layer or shapefile. I need to be able to ...
0
votes
0answers
26 views

Cross platform gis api wrapper architecture

I have a python class library for arcpy which is just a couple of class definitions with my common code attached as methods and properties so that I can do code centralization for stuff that I have ...
0
votes
2answers
55 views

Naming your Output feature class?

I am working in a work space in python on ArcGIS 10.1 on a remote desktop. Here is my code import arcpy from arcpy import env env.workspace = "E:\Example" PST = arcpy.ListFeatureClasses ("", ...
1
vote
1answer
52 views

How can I use pyqgis to automate a series of field calculations?

I've got a shapefile with about 30 fields that I'll need to update from time to time by importing a CSV with new data, joining it to the shapefile, and using the field calculator to carry the new ...
1
vote
1answer
40 views

Script to “extract by mask” a list of raster files

I'm trying to mask a group of raster files and save the new rasters in a different folder using the same name of the original files. It doesn't sound as a difficult task, but I'm having trouble ...
1
vote
1answer
65 views

GDAL - How to get gemetry type of a MapInfo TAB file?

I am using the OGR MapInfo File driver to read a MapInfo TAB file. However, the function GetGeomType() returns 0 which means 'wkbUnknown` even if the features in the TAB are only multi-polygons. Is ...
0
votes
0answers
36 views

need help creating layer with geom type wkbGeometryCollection with gdal python

I am having trouble creating a layer with geom type as geometry collection. Thus I am unable to output to a shapefile. I have attached code below. dstLayer is null. This does not happen if geom type ...
0
votes
1answer
69 views

Error when calculate field using VBscript or Python (slice a field)

I have an expression in VBscript that works well for labeling: Function FindLabel (field) if (INT(RIGHT(field, 2)) <> 1) then FindLabel = INT(MID(field, 8, 3)) &"-"& ...
1
vote
1answer
45 views

reproject vector layer with pyqgis with new CRS does not worl

In QGIS I am running a script in th python toolbar to export all visible vector layers to a GEOJSON with this snippet: canvas = qgis.utils.iface.mapCanvas() allLayers = canvas.layers() for i in ...
1
vote
1answer
53 views

ArcGIS10.2 Data Merge error: 000732

I am running python in the ArcGIS python window. ArcGIS shows error message when trying data merge from arcpy. File "", line 1, in File "c:\program files ...
1
vote
1answer
79 views

Add georeferenced png layer to map automatically

Using ArcGIS Desktop v10.2 with an Advanced level license we have georeferenced our engineering drawings in PNG format. Next we have created a polygon layer for every single drawing to see the Area of ...
0
votes
0answers
41 views

Import GRD and count days with temperature below zero, using python

Minimum temperature of a year is given in GRD file. I have to read that file and then calculate the frost day (less than zero degrees celcius) from it in python.
1
vote
1answer
77 views

Geodjango read raster files

I am developing a web app in geodjango (django) framework but I need to import raster files. Is it possible a geodjango app read raster files from a directory? Thanks
0
votes
0answers
62 views

QGIS custom form and autocompleted data entering with “validation check”

In Qt-Designer I created a custom form where I can choose serveral species names in two different combo boxes. This combo boxes are linked via "value relation" to the accordant non spatial tables ...
0
votes
1answer
61 views

arcpy to perform “select by attribute” and display the result on the map in a table [duplicate]

I am thinking to use arcpy to select by attribute, after that I want to display the selected features attribute in a table on the map, how can I make it? Thanks in advance.
0
votes
0answers
34 views

argument 1 has unexpected type error when parse xml with ElementTree

I try to make plugin in QGIS Dufour to open and read xml metadata and then to show some information in metadata i try to parse it with ElementTree and then show it in QLineEdit, this code i use to ...
1
vote
2answers
51 views

Keep leading zeros when converting .txt into dbf using CopyRows management

I am writing a python code in order to bring my.txt file into a dbf file in arcgis. I am using CopyRows_management which seemed to be working just fine until I realized that one of the 40 fields from ...
2
votes
0answers
52 views

ArcGIS10.2 crash opening python window

I was trying to test the data management commends in python, yet arcgis crash every time I I try to open to python window. According this post, it is the python version issue. I do have other versions ...
2
votes
4answers
254 views

how to find close and parallel lines

I need help with script for QA of water network. I need to find all lines that are almost parallel and close to each other less then 2 meters. The script have 3 stages: add azimuth field and ...
1
vote
1answer
128 views

Secure credentials for scheduled python script targeting ArcSDE 10.1 on AWS

I have a python script that will be used as a scheduled task. Our dba team is wanting the credentials to be as secure as possible. I would say that using the os security system as far as locking ...
0
votes
0answers
55 views

aggregate counts on a grid and determine grid adjacency

So here is the problem I am working on. I have a bunch of lat, long coordinates for event occurrences. I want to create a grid and then count how many points fall into each grid pixel. Once I have ...
0
votes
1answer
82 views

create polygon adjacency matrix using python

I am trying to create an adjacency matrix from a set of polygons. That is, I have a bunch of polygons and I want to identify which polygons have a common edge or "touch" each other. Once I find this ...
2
votes
1answer
52 views

How to use the List field function for a toolbox script?

i´m trying to write a simple script for a toolbox, similar to the Addfield_datamanagement toolbox. The script adds a new field to a table of a feature class or a shapefile with attribute tables. So ...
0
votes
0answers
126 views

How to export from ModelBuilder as script and then run using Python. 3.4?

I'm currently studying for a Msc in GIS. In my assignment I have been asked to produce a model, export that model as a script file and then run that script as a stand alone in IDLE. So I have created ...
0
votes
0answers
28 views

Error 14: Could not open CRS database

I am using Python Console and loading a Vector Layer using python commands. When the layer is added, QGIS first asks for the CRS to use, but I don't have all the CRS listed out to select the Reference ...
-1
votes
2answers
63 views

How to use raw_input() with while-loop? [closed]

my task is to execute multiple buffers with the list-loop! import arcpy arcpy.env.overwriteOutput = 1 arcpy.env.workspace="C:\\salzburg.gdb" sbgRivers="sbg_rivers" buff_name=raw_input("Please ...
0
votes
1answer
244 views

ArcGis Python Script, Calculate Field

Sorry for my English. I am trying to write a Python Script for ArcGis 10.2. #import system modules import arcpy import math from arcpy import env #Set environment options ...
1
vote
0answers
56 views

Problem with polygon overlay in raster stats using gdal

I am using the raster_stats module in python to calculate the mean carbon value for different sets of polygons. Here is the code that I am using: africa_sat = ...
1
vote
1answer
63 views

My class using ogr to calculate distance is returning incorrect results away from the equator

In an answer to this question ustroetz kindly provided some sample code for use of ogr to do lat/lon distance and point in polygon calculations. I've created a Python class based on his example to do ...
0
votes
1answer
29 views

Calculate text field based on codeblock query of numeric field

I am trying to populate a field with a L/R bank designation based on a route measure (as part of a larger script), but I am struggling. I have a shapefile created (tir_pts_lyr), I have a blank column ...