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

learn more… | top users | synonyms

0
votes
0answers
9 views

Remove date from beginning of filename, add to the end [on hold]

I have a group of files I'm trying to database (with improper naming conventions starting with dates) i.e. 20160524_Whatever_Whatever I'd like to remove the date and _ and append it to the end of the ...
0
votes
0answers
31 views

SAGA GIS API ERROR (import saga_api)

I want to use saga api on my Idle with Python but I have problems. First I have Windows 10 64 bit, I install SAGA GIS via OSGeo4W64 64 bit, and I have Python 2.7.11 64 bit. I follow steps for the ...
0
votes
0answers
10 views

When I open the software this message showed “Import Error No module named osr” . I am using QGIS 2.6.0 version

This is the image of the error that occurred. I was able to use the software, but I'm bothered by the error.
0
votes
0answers
11 views

How can I obtain selected value from QGIS using python algorithm?

I'm writing an algorithm in python for QGIS and i have a function which uses a value from a selection. The problem is that when i select a value the script give me the error that the local variable ...
3
votes
2answers
111 views

Can this Be Recoded to Be More Efficient with Respect to Processing Time?

I'm very new to GIS but have been asked to parse through any given ESRI GDB file-folder without using any ESRI product. I've been trying to focus on using Fiona and Shapely as these seem to be ...
5
votes
2answers
48 views

How to use current layer name in FME PythonCaller?

In a PythonCaller (FME 2014 SP4 in Data Interop in ArcGIS 10.3), I'd like to do some conditional processing based on the layer that I'm currently processing. I'm feeding in a text file of layers ...
0
votes
0answers
19 views

Creating a polyline with a specified slope

I would like to create a road (polyline) starting from a point, with a specified slope, until reaching the top of a hill (or going out of the DTM Raster). The dowstream slope of the DTM must always ...
1
vote
1answer
25 views

How is it possible to programmatically export current view as georeferenced image with QGis?

I found the this to export the current view as image. The following code works and was accepted as answer. c = iface.activeComposers()[0].composition() image = c.printPageAsRaster(0) ...
1
vote
0answers
9 views

pyd error install qgis 2.14

I removed qgis 2.10 so i could install qgis 2.14. But when i try to install 2.14 i get errors on python .pyd packages. Every time it is a different pyd causing the error. I had this problem with ...
9
votes
2answers
849 views

Histogram Matching using Python to improve mosaicking process of multiple overlapping rasters?

I am trying to do histogram matching using Python to improve the mosaicking process of multiple overlapping rasters. I am basing my code on that found at: ...
0
votes
1answer
1k views

OSRM API - nearest point fed into routing

I am using the OSRM API to (1) determine the nearest point on a road segment from a give random point with http://server:5000/nearest?loc=_lat_,_lon_ The returned coordinates are used then as an ...
3
votes
1answer
334 views

Import error when utilizing QGIS's Python Init function

Based on the answer to Referencing Qt UIs external to plugin with python. I'm trying to utilize the "Layer Properties / Fields / Python Init function" to execute a file (test_file.py) that is located ...
0
votes
0answers
35 views

Drawing contour with python QGIS?

I have one point layer and one contour layer and I was trying to draw a line around one contour, making a circle but not a uniform one, it has to have an irregular shape. I cannot find a tool that ...
4
votes
1answer
37 views

Read from TIF overviews using rasterio

I'm reading a window of a tif using rasterio. How do I utilize the available overviews to get a down-sampled version of the data instead of reading at the true resolution? Right now I am reading a ...
3
votes
2answers
345 views

How to generate Buildings ID numbers inside parcels

In order to decrease manual data entry, I would like to automate a task to generate numbers for all buildings inside a parcel starting with 1. For example, I have 4000 parcels and each parcel has ...
2
votes
1answer
58 views

“unexpected indent” in the script

I'm using a QGIS 2.8 in windows 10. I have 2 scripts that are working separately but when I write both in just one script, it doesn't work. The 1st script is to load one raster to QGIs with a defined ...
3
votes
2answers
43 views

Distance Matrix of two datasets

I have two datasets of the same adresses, one geocoded with Google, the other with Nominatim. Now I want to compare address1 of dataset1 with address1 of dataset2, then address2 of dataset2 with ...
3
votes
1answer
139 views

How to add loading bar in QGIS Plugin development?

Every time i use tool or plugin in QGIS, i saw a kind of bar like this for indicating loading progress : The different between that bar and Progress Bar is that progress bar will increase until our ...
2
votes
2answers
318 views

Refreshing display for newly added labels with ArcObjects from Python?

I've added a shapefile to an MXD and Edited the symbolization of it with ArcObjects. Now I'm trying to edit the labeling with ArcObjects. I've successfully been able to edit the default class in the ...
1
vote
1answer
23 views

How do I get the feature from a single-feature OGR layer in Python without looping?

A while ago I asked why the 0 index in a OGR layer was not a feature and it turned out that OGR interprets the index as Feature ID and looks that up. Now I filtered a layer to have only one feature ...
1
vote
0answers
24 views

How to automatically run some scripts for QGIS python console by defining the python macros checkbox

I'm working with QGIS 2.8 in windows 10. I've defined the python macros checkbox to QGIS start and simultaneously run a script that has the same path from my "QGIS.qgs" file. In the Project>Project ...
1
vote
1answer
115 views

Closing QGIS custom form programmatically?

I have a custom form for entering and editing attribute values of a point shape file. I also added a button for deleting the actual feature. Deletion of the feature works fine and then I want to close ...
5
votes
2answers
296 views

Build Network Dataset with python comtypes

I know this isn't possible in arcpy, so I thought I'd give it a stab using comtypes. I am trying to translate some of the VB.NET code to create a network dataset from the help docs: ...
3
votes
1answer
70 views

Script that runs automatically from the QGIS Python Console when QGIS starts, using schedule tasks on Windows 10

I'm working with QGIS 2.8 and windows 10. Is it possible that after open QGIS using the schedule tasks from windows 10, I could open the python console and run a script within QGIS programmatically. ...
4
votes
3answers
1k views

Fiona ImportError: DLL load failed

I've been using the great Shapely/Fiona combo successfully on Linux, but now i need to create a kind of production environment on windows and theres only one problem. When i try to import fiona, i get ...
2
votes
1answer
40 views

Plot shapefile on top of raster using plot and imshow from matplotlib

I need to plot a shapefile on top of a raster. I would like to use the python package rasterio and some combination of fiona or geopandas to load the shapefile. I found an example in the rasterio ...
1
vote
1answer
32 views

QGIS - Get Bounding Box of Map Extent in Stand Alone Application

I basically have the same question as this one : How to quickly calculate bounding box coordinates of a selected polygon with qgis However I am building a stand alone application in python and so ...
2
votes
1answer
211 views

Python-gdal create geotiff from array with colormapping

I am creating grayscale, single channel geotiff files from numpy arrays with the below module, but I would like to apply a fairly standard colormap to the data. I've tried three channels of R,B and G ...
1
vote
1answer
30 views

Question about Using r.mapcalculator in Python console

According to the following conversation: Using r.mapcalculator in Python console? I tried: ##NoData Background=name ##RASTERLAYER_BAND=raster ##nodatabackground=output raster import processing ext ...
1
vote
1answer
193 views

Using r.mapcalculator in Python console?

I'm trying to use the r.mapcalculator algorithim in a python script, but I'm having problems in using the r.mapcalculator to tranform a raster layer with float values into integers. Using the ...
2
votes
1answer
588 views

Automatic calculation in one attribute table based on values in another attribute table using python

I am trying to fill the fields of one gdb table based on some statistics over the attributes of another shape file. As it was not possible in ARCgis directly, I am trying to use python coe for this ...
1
vote
1answer
61 views

Installing GDAL2.1

Here will be my sequence of command lines while trying to install gdal2.1 in a UBUNTU virtual machine. My virtual machine is a UBUNTU 16.04 LTS(64bit) I would need gdal2.1 and especially the Python ...
1
vote
0answers
45 views

How to implement a shoelace formula into Python 2.7.8 [closed]

Here's the image of the equation I'm using, it is a shoelace formula. I need help to point out what each variable represents and how to apply this in python script, math is not my strong-suit! From ...
4
votes
5answers
2k views

how to find close and parallel lines

I need help with script for QA of water network. I need to find all lines that are almost parallel and close to each other less then 2 meters. The script have 3 stages: add azimuth field and ...
4
votes
2answers
1k views

Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas? inPoints = "points.shp" i = 0 arcpy.MakeFeatureLayer_management(inPoints, "pts") arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", ...
0
votes
0answers
23 views

How to do a Python / Fiona / Shapely equivalen to an ESRI ArcPy SpatialJoin?

I'm a GIS noob, but I am trying to learn as quickly as I can. Please bear with me. How can I identify what structures from one layer are WITHIN in some body of water in another layer? My problem ...
0
votes
2answers
145 views

ArcGIS desktop won't import arcpy

I have arcgis 10.3 and I am trying to run a task using python but the python window within arcmap won't import arcpy. This never happened to me with 10.2.2. The error returned is: Runtime error ...
1
vote
1answer
213 views

midpoint of segments in QGIS determination

Gene thanks for your note on the problem yesterday ... This is a follow up to a question I posed before (How to find the middle point of a line in QGIS - Where to place input file name). Errors coming ...
3
votes
2answers
3k views

Conditional Statements in QGIS raster calculator?

What is the equivalent statement of the following expression in the QGIS raster calculator? Con(((Abs("DEM" - "FSMin") > 120) | (Abs("DEM" - "FSMax") > 120)), 1, 0) I have no problem ...
0
votes
1answer
180 views

How to connect mouseclick to map canvas in QGIS?

How to connect mouse click to map canvas in QGIS using python script? I have two lines of code to connect mouse click to map canvas: button.clicked.connect(self.onClicked) ...
1
vote
0answers
227 views

qgis python app how to add edit feature button? [closed]

I'd like to develop a QGIS Python app for plotting points and editing the attributes. I've started with the tutorials here: http://blog.qgis.org/?q=node/59 and read the cookbook ...
4
votes
0answers
26 views

Using QgsNewVectorLayerDialog

I am using QgsNewVectorLayerDialog for taking user input for creating a new shape file. When the user clicks OK i am reading the inputs selected by the user using the following code. dlg = ...
1
vote
0answers
40 views

Image stacking with Python/Gdal

I am trying to accomplish some image stacking task in python. I am not proficient in Python and was hoping I can get some guidance to get started. So I have large number of landsat images. Landsat ...
0
votes
1answer
35 views

Hide/Show leaflet markers based on specific values

I have a Python list of dictionaries with a number of IPs and "Scores" for each IP. I'm adding them to my front end map / leaflet using jinja2 like so: var map = L.map('map') ...
3
votes
5answers
3k views

ExportToJPEG() arcpy script failure

I'm attempting to writing a python script that will automate exporting a set of stock maps to JPEG from their mxd files, and I'm having some strange issues getting there. I've alternatively been ...
1
vote
1answer
104 views

QGIS python script loop for raster calculator

How can I write a QGIS script for making a loop of raster calculator through a set of rasters? I know I can read multiple raster by applying: lddLrs = qgis.utils.iface.legendInterface().layers() for ...
3
votes
3answers
51 views

How to add all “.dat” files (raster) into QGIS, in a defined directory and defined legend (style), using python code

I'm using a QGIS 2.8.3 in Windows 10. I've added just one raster ("dat" file) to the QGIS, with a defined legend, using the following code. If I wanted to add all the "dat" files into a directory how ...
6
votes
3answers
178 views

Remove multiple characters from string field using field calculator (python parser)?

Is it possible to remove more than 1 character from a string in a field using the field calculator? I know !file!.replace(" ","") removes spaces in a string, but is it possible to remove spaces ...
1
vote
2answers
48 views

Using Python to execute merge of rasters Linux

I need help with a python script to iterate merge (gdal_merge.py) of rasters: For each folder located in /home/geodata/sentinel2/ look in subfolder IMG_DATA and merge the three rasters with ...
4
votes
2answers
67 views

How to populate QTableWidget via plugin?

I am attempting to populate a QTableWidget by adding rows, this is done by the user clicking on the add button: I have the following code to try and insert rows but nothing is happening: def ...