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

learn more… | top users | synonyms

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
47 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
45 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
58 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
44 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", ...
1
vote
1answer
45 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
50 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
32 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. ...
0
votes
1answer
50 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
52 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
36 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
38 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
50 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
79 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
31 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
18 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
24 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
76 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
76 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
62 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
43 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
161 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
90 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
41 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
44 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
44 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
100 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
34 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
32 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
17 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
58 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
167 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
33 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
63 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 ...
0
votes
1answer
32 views

projection for high accuracy small areas

I need to convert (lat,long,height)points into a cartesian system for an area as small as 40kmx40km or even 10kmx10km. I'm currently using the UTM projection, but there are some issues regarding ...
-4
votes
1answer
60 views

How to convert inp to shp with Python? [closed]

How would I convert an EPANET .inp file into python lists in order to convert it to .shp files?
0
votes
1answer
36 views

Arcpy scripts run time dialog keeps deactivating tkinter window

I'm using tkinter in my scripts to get field names of the user in case the hard coded field names were not found in the target feature. it runs from python IDE, but when run from arcmaps toolbox the ...
1
vote
1answer
16 views

How to remove group filter applied via Python-console (setSubsetString) of QGIS?

I need to quickly applie (and then change/remove) the same filter for about 100 layers in my QGis project (all put together in one group). Since there is no implemented solution right now (a feature ...
2
votes
0answers
30 views

Create a sript for “point sampling tool” of QGIS

Is there any way to create a python script to the "point sampling tool" plugin from QGIS? I have a very large number of Netcdf files which I want extrat the values from pixels to a irregular points ...
1
vote
1answer
23 views

Workflow for updating raster using polygons of different attributes

I require a specific output but it is proving difficult for me to work out a workflow. I have: 1) polygons of new housing developments (356, non overlapping) 2) a 25m raster of land cover I want ...
1
vote
1answer
81 views

Value Error with Float/Integer/double Fields in Python?

When running this Code: import arcpy from arcpy import env import os #Specify the map document and the data frame mxd = arcpy.mapping.MapDocument(r"G:\\PythonCode\\mxd_test.mxd") env.workspace = ...
0
votes
1answer
41 views

Modify File Name with Python

How would I change the following code (outJPEG section) if d like to have the original attribute table name (eg Adress) and the attribute fieldname (eg ZipCode) as file name? (Adress_ZipCode) The ...
1
vote
1answer
29 views

how install shapely on windows so it can be imported from matlab?

i'm on windows 7/64. shapely doesn't offer windows installers on their pypi page, even though they seem to have recently (github issues 104 and 109 -- i don't have the rep to post links. their pypi ...
1
vote
1answer
59 views

How to create empty polygon shapefiles with the same field names using python?

I'm new to python scripting in GIS and I have a list with species names, for every species in the list I want to create an empty polygon shapefile with the same fields inside the attribute. I read How ...
1
vote
1answer
130 views

Calculate Field and Python Expression

i know to you my question sounds ridicoulus ... but i ask anyway ;-) i want to populate a field with a new value. If the field has a value of 1 it should get the new value of 15. If the field is 0 ...