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

learn more… | top users | synonyms

1
vote
1answer
65 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
16 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
42 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
19 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
71 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
23 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
74 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
73 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
votes
0answers
24 views

Python Learning [duplicate]

I have to learn python for my project. I don't have any idea about python code. Can anyone help me to learn python from basics. Any video or book which you know that can help me to learn python for ...
1
vote
1answer
31 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
146 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
74 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
136 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
47 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
71 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
121 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
36 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
92 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
221 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
61 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
115 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
175 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
62 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
27 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
70 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
28 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
60 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
51 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
28 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
43 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
17 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
117 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
70 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
48 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
46 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
43 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
36 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
72 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
115 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
22 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
52 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 ...
3
votes
1answer
81 views

methods for converting coordinate datum and format in python?

Related to an earlier Q&A of Missing grid shift files for cs2cs.exe? ... what are the various methods to convert coordinate datum and format in python? (Windows Vista, python 3.4) For example, ...
1
vote
1answer
36 views

Adding Origin to Geotiff using Python GDAL?

Alright, so I'm getting closer to figuring this out but I'm stuck at one (that I know of) thing... how do I use GDAL to apply a known origin of a GeoTiff to another that has been processed in ...
2
votes
0answers
49 views

Efficiently generate Voronoi layers in qgis via Python

The following python commands both appear to function when called in qgis 2.6 to generate Voronoi diagrams: processing.runalg("qgis:voronoipolygons", pointLayer, 1, None) ...
1
vote
2answers
37 views

GeoTiff to ndarray

What is the most elegant way to import a multiband GeoTiff as a ndarray using Python? The most common approach I've seen is as follows: from osgeo import gdal arys = [] ds = gdal.Open('sample.tif', ...
2
votes
1answer
111 views

Run processing toolbox outside QGIS in standalone app

I am developing a standalone app in Python, using QGIS libraries including processing algorithms. I am developing in Linux environment and I put the libraries in a folder. Also I put the processing ...
1
vote
0answers
18 views

Ogr Python API: set null values in feature

Im trying to convert OGR geodata from one driver to another, like the command line tool ogr2ogr do, but using the python API. My problem is, that the NULL values in the input data are converted as ...
1
vote
0answers
34 views

Longest Common Subsequence for trajectory matching in Python

Is there any fast implementation of the Longest Common Subsequence algorithm for trajectory matching in Python? Ideally it would work with trajectories of different length in 2d spaces.
1
vote
1answer
40 views

Error using arcpy.da.SearchCursor and MakeFeatureLayer

im trying to write a script that allows me to iterate through my map layers, and for each layer, iterate over each feature and add a field that gives the location of the feature using my index layer ...
0
votes
1answer
48 views

Add field to feature class by location

im trying to write a script that allows me to iterate through my map layers, and for each layer, iterate over each feature and add a field that gives the location of the feature using my index layer ...