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

learn more… | top users | synonyms

0
votes
2answers
97 views

SnapToCurrentLayer in QGis2.8 with python programming

I have a polygon vector layer and I want to snap the vertex. def canvasMoveEvent(self,event):   x = event.pos().x()   y = event.pos().y()   startingPoint = QPoint(x,y) ...
0
votes
1answer
63 views

Is it possible from the list or np.array, updating the table using arcpy.da.UpdateCursor?

I have created array. Is it possible to update an existing table if the number and order of columns and rows identical? In the array do not have a column headers. for example: array = ...
0
votes
1answer
41 views

Missing labels when using arcpy.mapping.ExportToPDF

I have a script that is run on a daily basis to export a folder of MXDs to PDFs and I have noticed some peculiar behavior. Many, but not all of the PDFs will be missing some labels or their label ...
1
vote
0answers
85 views

Calling a GP service from a GP service arcpy.Importtoolbox

I'll try my best not to sound like a lunatic as I explain this. I have a python script that calls an ArcServer geoprocessing service toolbox with arcpy.Importtoolbox. The GP service is on several ...
1
vote
1answer
86 views

Running Python toolbox tool both standalone from other tools within same Python toolbox?

I have created a python toolbox for work that has two tools inside. These tools use the toolbox template and so have a init, getParameterInfo, etc. I want to be able to run one tool both stand alone ...
2
votes
2answers
65 views

Is it possible to sort the features by an attribute programmatically?

I have written a PyQGIS script that loops through an attribute table and finds duplicated values in a target attribute field. My technique requires that the attribute table is first sorted by the ...
2
votes
2answers
91 views

Multiply Rasters from two subfolders

I have two subfolders with Rasters named with the same parameters. I am trying to figure out a way to Loop a multiplication of each raster into a folder with its pair of the other subfolder. Looks ...
1
vote
1answer
73 views

How to merge multiple overlapping lines using python?

I have a shape file with different line features, some of which overlap. Is there a way to easily merge all overlapping lines into one, new feature using python? I've seen some solutions for ...
3
votes
1answer
75 views

How to order points along a line?

I have a bus line with bus stops along the route. The sample data looks like this: LINESTRING (-70.57243474999999933 -33.37452829000000065, -70.57308152999999606 -33.37470645999999874, ...
2
votes
1answer
64 views

How to access a specific feature?

Is it possible to go to a specified row number (or perhaps the next/previous) row using PyQGIS? This code gets the value of the first attribute in the first row of the table features = ...
0
votes
0answers
34 views

How to query a WMTS layer with a point layer in QGIS?

With the "identify" tool it is possible to query WMTS layers. Then, you can copy the acquired attributes and afterwards the clicked coordinates, then create a CSV file with attributes/coordinates. Is ...
2
votes
2answers
110 views

Batch add column to layers and add layer prefix in PyQGIS

I have a number of layers each with a prefix like A_ B_ and so forth. I'd like to: Add a column (text) called DENSITY to each shp Add the prefix letter from the layer name to each row in the ...
1
vote
0answers
54 views

How can I extract the measurelength, highmeasure and lowmeasure of routes in ArcGIS

I'm trying to create road Routes in ArcGIS, which traditionally have been created using workstation. I've managed to write a Python script to do this, however, unlike ArcInfo, the attributes ...
1
vote
1answer
33 views

Odd Error in Metadata Script

So I developed a script that traverses through a root directory, and any subdirectories and catalogs layers files. Then exports these layer files' FGDC metadata and outputs them to a folder. The code ...
1
vote
3answers
63 views

Calculate field management not working within customized Python tool in ArcGIS

I am trying to make a custom made Python Script tool which I would like to use in Model builder. I am using the arcpy.Calulate_field_management function (simple reclass function as an example), but it ...
3
votes
2answers
187 views

VB Script or Python for Field Calculator when using greater/less than?

What I have: I have 4 fields for my address ranges. L_ADD_FROM, R_ADD_FROM, L_ADD_TO & R_ADD_TO (all in DOUBLE field type). What I need: The lesser value from L_ADD_FROM and R_ADD_FROM to ...
0
votes
2answers
48 views

how to make clusters from small polygons with constraint of boundary touching?

I want to make some clusters from a bunch of small polygons with the constraint that each basic unit (polygon) in the resultant cluster must share a portion of its boundary with at least one other ...
1
vote
1answer
113 views

“ImportError: no module named qgis.core” in standalone app

I am developing a standalone app (in Windows) using libraries from QGIS. When I run the script in cmd, I get the ImportError: no module named qgis.core. I read in several posts that I need to ...
1
vote
1answer
42 views

ArcMap: Unknown Spatial Reference fix with GDAL/Python

I have a .tif file that I created with Python and when I open it in ArcMap it says it doesn't have spatial reference information. Is there a way to set the spatial reference with GDAL if I have a .prj ...
0
votes
0answers
29 views

How to merge grd files programmatically, ideally in Python?

We currently get LIDAR data from the field in grd format. Sometimes this data is overlapping. This data gets fed into a python program that does some analysis. What I'm after is some way of ...
1
vote
0answers
34 views

QGIS actions - get currently selected attribute column (with python?)

I'm trying to open files dynamically through actions. A simple example would be: Action name: OpenLink from PyQt4.QtCore import QUrl; from PyQt4.QtWebKit import QWebView; myWV = QWebView (None); ...
1
vote
0answers
85 views

How to create an expression using the arcpy.SearchCursor? [closed]

Example: On the basis of the table which is not defined by the number of columns and rows, you need to evaluate expressions as shown, using the arcpy.SearchCursor .... First, create a list of ...
0
votes
1answer
68 views

Inserting row into table and then updating it in sum of each column using ArcPy?

My problem is the following: I have a table with an unknown number of columns (n) Use arcpy.ListFields create a list of columns and generates Field name list Then, using arcpy.da.InsertCursor create ...
0
votes
0answers
25 views

Password Caching in ArcMap using Oracle accounts

The issue I'm looking for help with is that we have several Oracle accounts through which we host data. For example we have ACCOUNT@ORAC and ACCOUNT1@ORAC (these are made up names as I don't to ...
1
vote
1answer
19 views

Trouble updating attributes of a layer based on another layer's attributes if features intersect in python, QGIS

I am trying to assign attributes from features in one layer that intersect features in another layer. When I run my code, I do not get an errors but it does not update the attribute field as I am ...
0
votes
1answer
61 views

Running Grass7 in conda environment?

I have Anaconda Python Distribution (Python 3.4.3 :: Anaconda 2.1.0 (64-bit)) installed on Ubuntu 14.04. I would like to create a conda environment for running Grass 7. To do that I used: conda ...
0
votes
2answers
91 views

ArcGIS field calculator: Calculating a new field using multiple fields with python

Basically, I have a large polygon data set that has soil data for an area and I want to assign numeric values to the data based on soil texture text values (e.g. SIL=4, CLY=7, ...). However, the soil ...
1
vote
1answer
45 views

Trouble importing NumPy in GRASS. Architecture

I can't get GRASS to work on my system, and after doing some digging I think it is related to me using 64-bit python. I'm not really sure. I get this message... This module requires the ...
3
votes
2answers
151 views

How to calculate a value based on another field under arcpy.da.UpdateCursor and cursor.updateRow?

I am trying to do a calculations under arcpy.da.UpdateCursor. I want to calculate the values for the records that have FIPS=06037. I want to take the values from "kg" column and populate the new value ...
3
votes
2answers
70 views

Calculating unique ID value for a field in QGIS using python

I am trying to calculate a unique ID field for a vector layer in qgis, using python. I found some code to calculate attribute values, and tried to increment the value in the expression, but it doesn't ...
1
vote
1answer
68 views

how to find that two polygon boundaries are connected?

I am working on a Geo database where there is a layer with many polygons. i want to find that which polygons boundaries are connected so that i can create new layer from that polygons and which ...
0
votes
0answers
21 views

Refreshing QGIS view [duplicate]

I've written a short python script for use in QGIS (currently using 2.8.1) to set the CRS for all loaded layers to OSGB 1936 / BNG. The script correctly sets the CRS but I have to manually scroll ...
1
vote
1answer
40 views

Exploding multipart features in qgis using python [duplicate]

I want to explode a multipart layer to singlepart in python. I see through the qgis gui there is a way to do it under vector--geometry--tools--Multipart to Singleparts.. which does what I need, I just ...
1
vote
0answers
19 views

Merge CSV file to Vector Layer using common attributes in QGIS python scripting [duplicate]

I have a vector layer and a delimited text (csv) file -- they both have the common attribute attribid -- how can I add the columns of the csv file to the vector layer merging on the the attribid key ...
0
votes
1answer
39 views

window map (in pixels) given a window size (in miles) for a particular map resolution

i'm a noob when it comes to gis so just had a quick question. i searched for this question...and it seemed like the questions were arcgis specific. i'm using python and basemap for my analysis. ...
4
votes
0answers
52 views

Python IDE complete code autocompletion [closed]

I am seeing that code completion in both PyScripter and PyCharm is not complete, compared to the code completion you get in the interpreter window. In PyScripter, if you add arcpy to the code ...
1
vote
1answer
44 views

Trouble buffering a vector layer in QGIS with PyQGIS

I am working on a script that imports a .csv layer that has lat long coordinates, which I then want to buffer in feet. I've created a vector layer from the .csv file and tried to set the coordinate ...
1
vote
1answer
47 views

Get a point value with psycopg2 and PPyGIS

I'm trying to setup a basic working postgis setup with python ppygis package. >>> import psycopg2 >>> import ppygis >>> connection = psycopg2.connect(database='spre', ...
1
vote
1answer
98 views

How to store attribute values from a custom form into shape file?

I have created a custom form (for mapping bird species in the field with different attributes like species, type of observation, number of birds, date, ...) with some python logic. One important ...
2
votes
1answer
93 views

Using ArcPy to Read from Excel Spreadsheet to Python Dictionary

How would I go about creating a script that reads a specified excel spreadsheet and places the values in a dictionary? I have read about the xlrd library and how the library in such endeavors to read ...
1
vote
1answer
56 views

Python Code for generating random points not working!

I am trying to create some code to generate 10 random points within a vector layer's districts: layer=iface.activeLayer() import ogr import sys import random from shapely import wkb, geometry ...
1
vote
1answer
38 views

Getting error in running ExportReport Python code in ArcMap

i am unable to generate pdf report using ExportReport function of Arcgis 10.2. getting error of IOError: Could not open report template tried different template files but still getting this error. ...
1
vote
1answer
69 views

arcpy.da.UpdateCursor - How to update last column from Field Name List?

examples: for field in arcpy.ListFields(fc): if field.name != 'Hi': arcpy.AddField_management(fc, 'Hi', 'FLOAT') else: print "kolona Hi vec postoji" with ...
1
vote
1answer
69 views

arcpy.da.UpdateCursor - how to make multiplication of each column with the selected column, for each row in particular?

If I have a table with a number of columns [col1, col2, col3 ... col_n] how to perform multiplication of each column with one selected column, for example: multiplication = col1 * col_def, ...
1
vote
0answers
44 views

Trouble importing qgis.core python module

I am having issues loading the qgis Python modules in the osgeo4w shell. Ultimately I want to work with the modules in pyscripter. I tried the solution mentioned in Problem with import qgis.core when ...
3
votes
1answer
81 views

Intersecting lines get crossings

I have a set of lines representing bus lines. Some of the lines are overlapping and take the same roads. I am able to extract the nodes. However I am interested in extracting only crossings like ...
-1
votes
3answers
84 views

Sum fields from ListFields - RuntimeError: A column was specified that does not exist?

Does anyone have a suggestion on how to otherwise solve the problem ... The need to automatically generate all the columns from the table, the calculation of the sum, the results are updated in the ...
0
votes
1answer
41 views

Select the first 5 rows of a selection after reverse sorting using an attribute field in ArcGIS 10.2 with Python

I have a feature class containing 380 polygons representing sedimentary basins and another polygon feature class representing oil discoveries within said basins. My plan is to: Iterate through all ...
3
votes
2answers
81 views

How to access checked layers in PyQGIS?

qgis.utils.iface.activeLayer() accesses the current active layer, but I would like to get all checked layers in the QGIS ToC. How can I do it?
0
votes
0answers
30 views

How to create custom input widget using Plugin builder?

I am trying to develop a plugin that takes in user input for the time, using the QGIS plugin builder. However, I want to specify the different times the user is allowed to select from when the plugin ...