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

learn more… | top users | synonyms

2
votes
1answer
51 views

Converting Historical Railroad Systems Data from KML?

I'm writing a paper for an undergraduate economic history class and I'm interested in North American railways in the 1800's. I've found historical GIS data for the period here. The railroad data are ...
2
votes
1answer
66 views

Layer properties dialog in my QGIS plugin

I am developing a plugin which should display some information like geometry of the layer, feature count etc. Now those are currently displayed in QMessageBox.information. I want it to be displayed ...
2
votes
1answer
85 views

Why does thumbnail on one MXD not update?"

I want to make modification on multi-mxd properties, I try Arcpy script with a loop like " for mxd in mxdList:" , but I always have same results, Thumbnails are not created... import arcpy,os ...
0
votes
1answer
41 views

Get Path of File found with os.walk [closed]

I am trying to expose the full path of a file found using os.walk. The walk function is working correctly and is exposing all the files I want however when I try to get the path it looks like it is ...
4
votes
3answers
130 views

Separate a string value in two integers in QGIS

My problem is the following. I have a huge dataset of forest stands. All the information are separated but in many cases the stands have different age and this is marked in one attribute for example ...
1
vote
2answers
123 views

How to calculate the Oriented Bounding Box (OBB) of a polygon or point set?

I'd like to calculate the "Oriented Bounding Box" (OBB) which is the enclosing rectangle aligned to the longest extent of a point set (which is not necessarily aligned with the axes of the co-ordinate ...
1
vote
2answers
65 views

How to search by attribute using each row with Python?

I am trying to write a script to select each individual neighborhood using one FC, then use select by location to see the number of lots from another FC that are in the neighborhood and store that ...
2
votes
0answers
36 views

Updating Cursor to Include Newly Created Features

I am using ArcMap 10.1 and python to create cursor that starts at the one and only row of a polyline shapefile, some code runs to create a new feature based on the position of the exisiting feature, ...
0
votes
0answers
46 views

How to resolve warning messages from standalone script?

The standalone script, loaded from OSGeo4W Shell and copied below, follows a set of steps: Create grid with cells length/width at 200m Clip a polygon layer onto the grid Use Distance to nearest hub ...
3
votes
2answers
72 views

QGIS (2.4) keeps caching old Python code

I'm fiddling around with a piece of python code to use with form validation. It works fine, but the real problem is that QGIS refuses to acknowledge the changes I make in the script. Here's what I ...
1
vote
1answer
78 views

How to deactivate my custom tool by pressing the Escape key using PyQGIS?

I'm developing a QGIS plugin and I have created a custom tool. Once the process is over, if the user presses the ESCAPE key, I want my custom tool not to trigger mouse events on the map anymore. How ...
1
vote
1answer
21 views

Processing feature string fields to raster

I am using the GDAL python bindings. I am trying to rasterize a layer from an arcinfo coverage file, but the values I need to rasterize I have to calculate from string fields. OGR can not write to ...
1
vote
1answer
44 views

Field Calculator Python Issues [closed]

How can I adapt the following expression in the ArcGIS field calculator? Below is the python code: import arcpy fc = "2014_2" keyField = "ID_segment" affectedField = "KKN2" maxVal = 2500 cnt = 1 ...
1
vote
1answer
34 views

How to get GML layer CRS with OGR Python?

I have a GML layer obtained from a WFS that looks like this: <wfs:FeatureCollection xmlns:ms="http://mapserver.gis.umn.edu/mapserver" xmlns:wfs="http://www.opengis.net/wfs" ...
2
votes
1answer
79 views

How to iterate over features and abort iteration with keypress in PyQGIS?

I would like to run a loop with PyQGIS, it should wait for the user to press a key either SpaceBar or Escape to continue. canvas = qgis.utils.iface.mapCanvas() aLayer = canvas.currentLayer() feat = ...
0
votes
0answers
25 views

qgis action html

I'm a newbie in QGIS and python. I made a QGIS Action with parameters [% attributename %] that works fine. import urllib2 req = ...
2
votes
2answers
95 views

How do I transform values using a dictionary or lookup table?

I'm reading rows (~20 fields per row) from a database using a SearchCursor and placing them into an array. Then, I loop over the array and use an InsertCursor to insert them into a Feature Class in a ...
1
vote
1answer
86 views

How to link my QGIS plugin main class to mouse events from a custom Tool?

I Have two files one is mouseevent.py and the other one main.py. class MouseClick(QgsMapTool): canvasDoubleClicked = QtCore.pyqtSignal(object, object) def __init__(self, ...
1
vote
1answer
37 views

How do I import Python modules into Manifold GIS?

The question says it all, really. Manifold 8, with the IronPython 2.6 distribution. I've gotten Manifold to at least be able to run IronPython scripts (courtesy of ...
5
votes
3answers
156 views

Grouping latitude and longitude coordinates by city neighborhood

I'm working on a model to predict whether craigslist apartment listings are over or under market value. I'm a complete novice with GIS. I have the lat and long as well as what neighborhood the author ...
1
vote
2answers
84 views

MultiLine field-name label referencing

A labeling routing (which is updated often) is being implemented via pyqgis and a QComboBox. The attached code below worked great, that is until needs for narrowed column headers spawned the use of ...
1
vote
3answers
152 views

How to split a line every x meters? [duplicate]

I have a line that I ultimately want to split up into points. The points should be every 100 meter along the line. So I don't want to extract the nodes. Are there any OpenSource (QGIS, Python) tools ...
1
vote
1answer
51 views

How to find duplicate values that ALL share the same attributes

I am using Arcgis Desktop 10.2. Using python script i am trying to resolve the following : I have 2 columns of data, one containing alphanumeric values, the other some strings like "-1", "-2", "-3" ...
3
votes
2answers
80 views

Adding descriptions to feature class in a geodatabase using arcpy

I am trying to populate the properties of a feature class in a geodatabase using arcpy. In the past I have been given geodatabases with features classes that already have their property descriptions ...
2
votes
2answers
147 views

ArcGIS Calculate Value tool - Python syntax error

I have a feature class within a file geodatabase. I am using the "Iterate row selection" iterator in Model Builder to read each row in the FC. I am then using the "Get Field Value" tool to read the ...
0
votes
1answer
37 views

Tool making by using python

My problem is that i want to solve one equation by using these inputs. Equation is : (field*area)/total area where field= fields which are selected, Area= field of area, total area= total of area. ...
3
votes
1answer
103 views

How to show Python console at QGIS program start

I wonder if there is a way to open the Python console of QGIS 2.6 directly at program launch. There is a possibility to set a shortcut for the Python console, but I can't find such an option for the ...
2
votes
1answer
237 views

How is the Python IDE aware of arcpy?

I'm using PyCharm 4 for some Python scripting. When I type import arcpy I can immediately start using items within the arcpy namespace, like the environment & workspace objects. How does the ...
3
votes
1answer
72 views

Accumulating values of date field using Python parser of ArcGIS Field Calculator?

I would like to modify the following accumulative/sequential python code sample in field calculator in a Date Time field. I think this is the correct code to use but let me know if not. The Date Time ...
1
vote
2answers
155 views

Renaming filenames to a standard filename format using Python

I am working within an ESRI ArcGIS environment. I have a folder full of .xyz files that are named to a specific old file format such as 2014516_MS_005.xyz I want to be able to loop through the whole ...
2
votes
3answers
185 views

Why script works on my computer but not on another?

The script below works perfectly fine in my computer. But when running the script on another computer, I receive an error: Error: Algorithm not found The computer has similar specifications to ...
1
vote
1answer
68 views

smallest, lossless, GDAL ready image format

I would like to know what the smallest file format is I can use with GDAL that fulfills the following criteria: lossless compression (relatively) easy to read/write with GDAL Python bindings least ...
2
votes
2answers
39 views

How to make a list of ESRI GRID rasters in Python

Tipically, ESRI GRIDS are not defined by a file extension like for the .tif files, but they are stored in a info folder plus an extra folder corresponding to the name of the raster. Arcpy allows to ...
0
votes
1answer
110 views

Concatenate Multiple String Fields and Convert to Date field using ArcGIS Field Calculator?

I'm Working in Model builder using the calculate value tool. I have three columns - SignatureDay, SignatureMonth, SignatureYear - All three are string data types and all consist of just numbers for ...
1
vote
0answers
31 views

How to reach the geometry (polygon, polyline) of a dxf in python-ogr module

this might be a basic question, but I am rather new in ogr. I wish to collect all lines from the dxf file and create their boundary. I loaded the layers (ExecuteSQL( "SELECT DISTINCT Layer FROM ...
0
votes
0answers
69 views

Create feature class/layer with data in python list

I want to programmatically add a layer to an MXD. The data for the layer is a list of tuples. From I what see, I need to create a feature class with this data (called invalidDataList) Below is what I ...
1
vote
0answers
55 views

Using processing using other output (result from another algorithm) as input

I have a problem. I am developing a standalone app in python and I need to use processing algorithms. I was able to use one algorithm without erros but I need to run other processing algorithm which ...
0
votes
0answers
29 views

True Altitude of GPS cooridnates

Given two points a=(lat1, long1) , b=(lat2, long2). I want to divide the line between a and b into points with equidistant length. (for example 100 Points) For each of these points i need to ...
2
votes
1answer
52 views

QGIS toolbars source code

I can see the source code of the core QGIS plugins from the repository in github. But is there any repository of source codes for QGIS toolbars also?
0
votes
0answers
29 views

Installing Python MapScript Bindings on Windows

I've run into an issue today getting the Python MapScript bindings to behave today. Traditionally, I just use the MapScript bindings that come with the ms4w package. They had been working, although ...
2
votes
2answers
127 views

Find the first occurrence of any letter in an alphanumeric string [closed]

Working in arcgis desktop 10.2, I use python scripts to split some strings, found in an attribute table. Most of them were quite easy to split, but here is one that i could't manage to break. ...
1
vote
1answer
98 views

errors after installing 64 bit background geoprocessing on ArcGIS desktop 10.2.2

I installed 64 bit background geoprocessing on my ArcGIS 10.2.2 and then changed my pythonpath to "C:\Python27\ArcGISx6410.2" so that my code can benefit from the 64bit. then I had to install a 64b ...
0
votes
0answers
59 views

How to deal with contour error “Exception encountered: invalid index”

I have include vector layer using postgis database with filter(data between two dates) it work fine but after adding when I trying to make a contour from it I get error Exception encountered: ...
3
votes
2answers
50 views

Send signal when attributes modified - QGIS 2.6

For a QGIS 2.6 python plugin, I am trying to send a signal when an attribute value is changed (values for an existing feature are updated or added and the attribute form dialog is accepted). This ...
3
votes
1answer
45 views

Python output for batch “FeatureToRaster” in ArcPy

I am trying to batch process the conversion of shapefiles to rasters. I am stuck on how to specify the name for each output raster file. Part of the trick is that my input shapefiles are the names of ...
1
vote
1answer
48 views

Why use QgsFeatureRequest() when iterating?

I am unclear on why one should use QgsFeatureRequest() when iterating over a file’s features. Let’s say I would like to print out all IDs in my currently active dataset. Now, most examples will ...
1
vote
1answer
103 views

problem with adding 64-bit background geoprocessing to ArcGIS 10.2.2

My code written in python language using Arcpy works perfectly with small to average size datasets; however, with a big dataset, the script stops in the middle of execution which most likely is due to ...
1
vote
2answers
140 views

Insert.da.Cursor, Error - Sequence size must match size of row

So I'm working on this script which creates a table within a geodatabase. It then grabs the unique values from a list and attempts to insert them into the table using an Insert Cursor. I get the ...
2
votes
1answer
26 views

Python-OGR how update the geometry of a point

I need to change the coordinates (geometry) of some points in a shapefile. I can't find the good method. if ( zone[best_y, best_x] >= ( nb_pixel_area - toler) ) and ( zone[best_y, best_x] <= ( ...
0
votes
0answers
87 views

K-means cluster analysis with initial centers with ArcGIS

I am trying to figure out a way to make a K means cluster analysis using initial centers for the clusters, and only classifying, no iteration, for the features in a feature class. Having a feature ...