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

learn more… | top users | synonyms

0
votes
0answers
2 views

PyQGIS Standalone Crashes python.exe when zooming out too far / Process finished with exit code -1073741819 (0xC0000005)

I have the following PyQGIS Standalone App which is working fine so far. One little problem is that if I zoom out to the MaxExtent(by scrolling the mousewheel) the app crashes python.exe so that the ...
0
votes
0answers
4 views

Error: Algorithm not found (QGIS)

I wrote the following code using QGIS'API. import os from qgis.core import * import qgis.utils prefix_path = os.environ['QGIS_PREFIX_PATH'] QgsApplication.setPrefixPath(prefix_path, True) ...
2
votes
1answer
18 views

How to add a message bar to custom canvas?

There is a simple code to add message bar to main window in QGIS: iface.messageBar().pushMessage("Hello","World") My question is how to add bar to my custom canvas canvas = QgsMapCanvas() in ...
1
vote
0answers
17 views

import qgis.core problem with QgsFeature and QgsGeometry ImportError: DLL load failed: The specified procedure could not be found

I've tried several previous answers to similar questions - no luck. I've tried everything, nothing seems to work. This is the error I'm getting Traceback (most recent call last): File ...
0
votes
0answers
12 views

Pythonw has stopped working when running arcpy.SubsetFeatures_ga

I'm currently trying to subset a shapefile into training and validation files. When I run the following line of code, python crashes. I'm using ArcGIS 10.1. arcpy.SubsetFeatures_ga(current_shapefile, ...
0
votes
1answer
13 views

Semi Automated Classification plugin (QGIS) error when trying to create ROI

When I try to create a new ROI through Semi-Automated Classification plugin (SCP) for QGIS, I keep getting a message saying: "It appears that SciPy is not correctly installed. Please, see this page ...
2
votes
1answer
19 views

problem deleting shapefiles because still in use by arcpy cursor [duplicate]

I have a function outputTblContents which contains def outputTblContents ( path ): rows = arcpy.SearchCursor(path, fields="alpha; beta") for row in rows: print("{0} => ...
0
votes
0answers
17 views

Extracting pixels latitude into new raster [on hold]

when extracting pixels latitude into new raster the boundary not matched, what shal in do? # -*- coding: utf-8 -*- #!/usr/bin/env python print("Started\n") import gdal import numpy as np ...
2
votes
1answer
30 views

PyQGIS standalone script does not work. Error “QGraphicsScene::addItem: item has already been added to this scene”

I try to test a PyQGIS standalone script which should just show one Shapefile. Sounds pretty simple but does not work. Here is my script: from PyQt4 import * from PyQt4 import * from PyQt4.QtCore ...
1
vote
1answer
42 views

“Browse” button returns python error in QGIS

I use the latest version of QGIS (2.8.2) in MAC and have se the default Python version 2.7. Moreover, I have installed all the required python modules and GDAL. It was working before, but now, when I ...
0
votes
2answers
50 views

Remove first seven characters from field string using Field Calculator

I wrote an expression/codeblock that removes the words "Nearby:" from the field value string if it has it. Codeblock: import string def splitme(s): if s[:7] == "Nearby:": aList = ...
0
votes
1answer
22 views

Generating elevation 'database' from NED IMG data

I'm starting to work with the NED 1/3 and 1/9 arc-second data. I've been using gdal in Python and QGIS to do some basic conversions of the raw .IMG data from USGS. My goal is to get elevation data of ...
0
votes
2answers
44 views

Calculate field in modelbuilder

If vb code is also possible I could give that a try aswell.
1
vote
1answer
32 views

Adding Vertical Reference in Python to ArcGIS feature dataset

I am creating a python script to generate a terrain. In the process I am creating two feature datasets. However, in order to successfully create this FD, i need both horizontal and vertical datums. I ...
0
votes
1answer
34 views

Can't get the where clause in Select layer by attribute working!

I am trying to develop a script that searches for a particular ID in a user selected field. To this end I have used the select layer by attributes tool to search for a derived number in a field ...
0
votes
0answers
21 views

Is it possible to save a dxf in memory

Following on from my question here, when I run the ExportToCAD tool arcpy.ExportCAD_conversion(listOfLayers, formatRelease, location + fileFormat, "Ignore_Filenames_in_Tables", ...
1
vote
1answer
50 views

How to differentiate between land and sea in python?

I'm going to plot some positions of ships, and thus see which areas (out at sea) where there is no vessels, however, if I do this in an ordinary geographical area defined by a square, all the land ...
1
vote
0answers
31 views

Using gdal_merge to merge a large amount of files (in pairs)

I'm new to python and how it can be applied to gis. I have a large amount of MODIS files to go through and I've already extracted, reprojected and converted to GTiff the bands that I need from each ...
1
vote
1answer
36 views

Setting PYTHONPATH for compiled QGIS version on Linux

I'm trying to set the PYTHONPATH in order to be able to load the qgis classes in a python console (not the QGIS Python one). I followed some resources I've found (PYQGIS Cookbook, and others) but I ...
1
vote
1answer
55 views

How to register “events” for linear referencing in pyqgis?

Is there an easy solution for recording events for a line crossing borders of zones in a polygon layer? I need to implement this in python using QGIS, thus pyqgis. The image attached illustrates what ...
1
vote
1answer
53 views

How to select polygon features that intersect a line feature using pyqgis?

Is there an easy way to select all features in a polygon layer that intersect (overlap) a line feature? I need to implement this in python using QGIS, thus pyqgis. This code illustrates what I am ...
0
votes
1answer
28 views

Get Data for ArcPad extension and python

Is it possible to call the 'Get Data for ArcPad' extension using python? If so would someone be willing to share their code?
3
votes
3answers
58 views

How do I compare two features to test if they are identical?

What is the most efficient method for determining if two features (points, lines, or polygons) are geometrically identical? I'm not concerned about a square figure that contains eight vertices (four ...
1
vote
2answers
32 views

Adding new field and populating with shapefile name

I have a set of shapefiles that need a new field adding to them called "Policy_Ref". I then need to update this field with the shapefile name. However when I do, it uses the full title, including the ...
1
vote
1answer
31 views

What tool would be best for getting the max value out of Identical ID rows?

As the title may imply I want to keep the maximum value in field2 for several identical IDs in field1, the others are deleted for example this table: Field1 Field2 14772 1 14772 4 14766 3 ...
6
votes
0answers
124 views
+50

Python toolbox works in ArcToolbox and in Python console, but not in ArcCatalog

I have a set of Python tools in a Python toolbox (.pyt). They are broken into multiple files and modules and have been functioning correctly, but now I'm seeing inconsistent behavior on multiple ...
1
vote
0answers
11 views

Accessing elements Linestring and points from a DGN file and displaying both layers on QgsMapCanvas

I am using PyQGIS APIs to develop a standalone application which currently display's map data layers on QgsMapCanvas from .shp, .tif, .dgn files. I am able to do it for .shp and .tif but not for .dgn ...
0
votes
0answers
14 views

Re-name using first letters of feature class name [closed]

I have several feature classes and I want to rename them using the first letters of every word in their name (Proposed_Road_Network -> PRN) with python but I do not know how as I have very limited ...
0
votes
0answers
24 views

Implementation of script for bus waiting stops

I've tried to add waiting time in bus stops in several ways (elevation fields, sub-segments, etc), but nothing worked. I'm now trying to use this script I've found in Internet: if (SourceID of ...
2
votes
3answers
109 views

Using .len() in IF THEN statement in ArcMap field calculator

I have a string field with values of varying lengths (1-4). I need each value to have a length of 5 characters by adding zeros to the value until the length equals 5. For example: 123 needs to ...
3
votes
1answer
43 views

add text value to attributes

this is a novice question I have an attribute field that's missing a piece of information, i'd like to amend the attribute field like below: This is the current attribute field: "V:\Building & ...
2
votes
1answer
28 views

Landsat Surface Reflectancce product Python packages

I have to work with numerous Landsat surface reflectance product that I downloaded from http://landsat.usgs.gov/CDR_LSR.php. The product comes with a QA data with information on clouds and shadows ...
0
votes
2answers
42 views

Applying symbology to a layer with python, How to only have symbology in TOC that the sub layer has

i am trying to apply a symbology to multiply layers that i have created from one feature class. The original feature class is used to create several sub layers see layer loop this involves using ...
2
votes
2answers
60 views

QGIS/Python script to generate random points many times

Good day. Can anybody provide a simple code to be run in the Python Console of QGIS (I am using 1.8 Lisboa) to generate X number of random points (say e.g. 5000) over a certain global shape of ...
1
vote
0answers
38 views

If then statement in model builder

I have a model that adds several fields, two which are manual inputs (County Name and User). I am manipulating several parcel layers (approx 90 counties). In my model, one field takes the state and ...
2
votes
2answers
32 views

Map canvas overlay layers QGIS

I built my own map canvas inside a plugin in QGIS and I want to add two layers (one by one) in order to overlay the two. I have this code: fileCI = "....\plugins\teste\test.shp" fileInfo = ...
1
vote
2answers
47 views

ignore Null Values when iterating through fields with python

So far I have a code which iterates through Fefature Classes and ignores all fields of type String, Geometry and OID. I now try to add some lines which tell python to ignore all NULL values when ...
1
vote
0answers
30 views

import qgis geoprocessing tools in python os x 10.9.5

I'd like to use the python bindings from qgis, but in a standalone project. I need the geoprocessing tools for vectors. I updated QGIS (Wien - 2.8), python (3.4.3), etc. However, it always ends with ...
1
vote
0answers
45 views

QGIS python originalName() does not return actual original layer name

I am writing a Python QGIS Plugin, using QGIS version 2.6 as the basis for development. When loading data into the canvas programmatically, I am trying to maintain the spatialite table name as the ...
1
vote
1answer
41 views

What resampling method is used in gdal_merge?

I am using the gdal_merge python script to merge rasters that have slightly different, though similar, input resolutions. The documentation advertises that it can handle different resolutions, and in ...
1
vote
1answer
33 views

Labeling layers with Python in QGIS. LinePlacementFlags

How could I set LinePlacementFlags with Python in QGIS? My code is something like: palyr = QgsPalLayerSettings() palyr.readFromLayer(layer) palyr.enabled = True palyr.fieldName = "attribute" Then ...
1
vote
0answers
44 views

How to automatically generate pour points along stream network?

The following screenshot shows the results of a water flow analysis where I identified stream order via the Strahler method in ArcGIS. Now I need to generate watersheds for 2nd order streams and ...
0
votes
1answer
56 views

arcpy.da UpdateCursor where_clause

I am trying to get a where_clause working on a UpdateCursor (arcpy.da). I can get it to work fine with a SearchCursor, but for some reason the same clause throws a RuntimeError: General function ...
2
votes
0answers
43 views

Using Python to iterate through directory to create event layer and perform kernel Density for each file?

I am new to Python for ArcGIS, but have been using ArcGIS a while. I have a large directory of tables with point data. For each file of each folder I want to create a kernel density layer. I have ...
1
vote
0answers
23 views

Execute GRASS command within qgis phython console

We try to calculate catchments with the r.water.outlet function from python console. To do so we use the following code: import processing rlayer = QgsRasterLayer("/my/path/DrainageDirection.tif", ...
0
votes
0answers
29 views

If/then python for classifying existing field values to a new field

I'd like to have a tool or quick python script to classify an existing number field to a new text field. For example I have a roads layer that has a type identifier as a coded number and I would like ...
0
votes
0answers
41 views

Advice for Python with GIS [duplicate]

How you can I install different packages in python and not have problem with the arcpy module in ArcGIS? I want to be able to run Python as standalone, do other python programming as well as GIS ...
0
votes
0answers
49 views

Configuring Python to avoid conflict with ArcGIS for Desktop (ArcPy)?

I am trying to find the best way to configure a new version of python in my computer (windows) so that I do not have any problem with the python version that I have with ArcGIS. Is there anyway to ...
1
vote
0answers
31 views

Spatial join with multiple intersecting features

I have a polygon dataset representing pavement areas broken up by year of construction and a roads centerline dataset that contains values for remaining service life (RSL). I want to spatially join ...
1
vote
1answer
38 views

Field calculater in Python console from QGIS

I have some doubts in syntax of processing.runalg(qgis:fieldcalculator) in python console of QGIS. I want to create a new field in a shapefile and calculate this formula: [D_PATRICIA]*1000. ...