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

learn more… | top users | synonyms

7
votes
0answers
229 views

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
17 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
26 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
138 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
47 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
38 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
49 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
108 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
42 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
47 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
55 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
37 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
51 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
66 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
36 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
48 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
61 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
51 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
29 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", ...
1
vote
1answer
53 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
42 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
53 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
42 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
41 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. ...
0
votes
1answer
57 views

ArcGIS 10.0 Python script not working with ArcGIS 10.2.1. Looping through SelectLayerByLocations

Last year I got assistance from StackExchange to write a Python script for ArcGIS 10.0 which loops through SelectLayerByLocation with buffer until it returns no new rows. Then it uses the selection ...
0
votes
1answer
61 views

cannot concatenate str and list objects

I'm trying to rename a group of rasters to "I1986_" + [The 1st 3 letters of the raster]. For example, if a raster is named "Raster1", the output would be "I1986_Ras". I've tried including str() ...
0
votes
2answers
45 views

working with geojson and vincent on python

I want to import a geojson file into python so I can map it with a visualization package vincent and merge with other data in a pandas data frame. To be specific, the said geojson file is: ...
1
vote
1answer
42 views

How to replace field name with a variable in exported whereclause?

In the select by attribute how do I replace "AADT", with a predefined string variable? I don't understand the pattern in "\"AADT\">=" , can you please explain why is it that way when exported from ...
0
votes
1answer
62 views

Python Script to Select records based on user input

I am running Arc 10.3 in a versioned environment. I am attempting to write a simple code that will select service records coming from Oracle CRM to a separate feature class containing only records ...
2
votes
1answer
102 views

How to create a plugin GUI for QGIS 2.8.2?

I create a pluging with the pluging builder in Qgis 2.8.2. I went to the folder of my pluging : C:\OSGeo4W64\apps\qgis\python\plugins\yu in order to visualize al the files that the pluging builder ...
1
vote
1answer
32 views

How to search for fields in a GDB and add them if they don´t exist with arcpy?

I have a list of files that need to be present in my featureclasses - myFields[]. I need to add these fields if they are not present in my FeatureClasses. import arcpy myField="Field01" myFields = ...
0
votes
0answers
21 views

Python Error when I start Qgis

Thank you for the comment for this post: QGIS 2.8 starts with an error and I am not able to run Python console I have run yum search yum search qtwebkit and I got it that is installed. ...
1
vote
1answer
29 views

Parsing path and calculate value in model builder

I am experiencing an issue with the model only tool calculate value. I am attempting to use the parse path and calculate value model only tools to force a feature dataset into the create topology ...
2
votes
1answer
79 views

How to use %i%“.csv” in arcpy to name an output csv file?

I am using arcpy to describe datasets and output the results into a csv file. I am doing this via a script in arctoolbox and would like to save the file in the same folder as the file being analysed. ...
1
vote
2answers
86 views

Using Google API within Python and applying to ArcMap?

I am currently doing a practical project at university (MSc in GIS). I have to develop a python script and the functionality of this script has been left very open other than we have to use Python ...
2
votes
1answer
64 views

Polygon found with search cursor, but not update cursor

Here's my issue. I am doing two things with arcpy: 1) I search a feature class using arcpy.da.SearchCursor() and pull out a UID field and the geometry in WKB format for all polygons in the file, ...
1
vote
1answer
51 views

How to use gdal.FillNodata in python?

I am trying to use gdal.FillNodata in python on a ".tif" raster. The nodata value is set to -3.402823e+38. Here is my code : import gdal from gdalconst import * ET = ...
0
votes
4answers
169 views

Is there a site with templates for Arcpy where I can just fill in the blanks?

I have a Shapefile containing near 7000 pour points across the globe (GCS, WGS84). I'm using the following model to select the first feature point of the Shapefile, copy the selected feature in a new ...
1
vote
1answer
107 views

Performing image segmentation in QGIS?

I have been trying to learn to work with QGIS (open-source GIS software) through some tutorials available online for classification of image for land cover. These tutorials used a dataset from Landsat ...
0
votes
0answers
42 views

Image formats to use for land cover classification in Python? [duplicate]

I am supposed to classify images for different land covers or land uses in Python. I read somewhere that the spectral module of Python is required to do the processing of Hyperspectral image data. ...
0
votes
1answer
51 views

Grid-type shapefile from raster GeoTIFF

I need to produce a shapefile from a raster. I need to be able to specify either an interval, or manually define the intervals. The input file is a GeoTIFF. I would like to use GDAL and/or Python. ...
1
vote
2answers
46 views

Replacing shapefiles in MXDs using only Python options available prior to ArcPy?

I am trying to come up with a python script that will go through a designated folder, locate all MXD files within the folder, and then check each MXD to see if it contains a specified shapefile, which ...
1
vote
1answer
163 views

Interpolation grid for scattered data having (latitude, longitude) coordinates

I've got some scattered data in the form of (latitude, longitude, someParameterValue). I'm using inverse distance weighting interpolation method to interpolate them in a rectangular grid of pixels. ...
1
vote
1answer
41 views

set the transparency layer group with Python

How can I set the transparency for all layers within a group of layers? I assume this will require the use of a FOR loop in the Python Console. Based on How to set the transparency for multiple ...
1
vote
1answer
37 views

extract substring after first number

Suppose I have a field titled NAME1. Examples of what is in the field appear like this: Fox Lake 1 WABASCA 166 TSU TUE 196G YELLOW QUILL I.R. 90-8 POUNDMAKER INDIAN RESERVE NO. 114-17 CROSS LAKE ...
0
votes
0answers
19 views

Finding distance to travel along a linestring from current point

I am using Spatialite. I represent roads using LineString. When the user is on the road, I am interested in calculating the distance to travel to one of the ends of the road. I find this a fairly ...
1
vote
0answers
110 views

ImportError: No module named sip

I have been trying to write a custom application to generate contour from QGIS. This is my starting code: import os; from qgis.core import *; This is the error i am getting: Traceback (most recent ...
3
votes
3answers
179 views

Is there a better way to compare lists in arcpy?

I simply want to create a script which compares a list with the field names of a featureclass and if the fields do not exist in the featureclass add them. My code works, but is very inefficient. How ...
1
vote
1answer
37 views

Using Advanced Python Calculator in QGIS Modeler

I'm trying to create a column with integer values based on a small function that basically uses conditional statements. In short, a reclassification. My attempt below: def getValue(Etat): if Etat ...
0
votes
1answer
88 views

Extract multiple tar.gz files [closed]

I'm new here and in the world of Python scripting mostly with the arcpy module. I hope you can help me with the trouble that I have. I'm trying to develop a script to extract or uncompress multiple ...