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

learn more… | top users | synonyms

5
votes
1answer
108 views

Export .qml file using QGIS API

Im loading a shapefile using the method QgsVectorLayer() and adding a style to it using the method loadSldStyle() and the path to the sld file. So far so good. What I want now is to export that style ...
1
vote
1answer
67 views

Create Table with postGIS geometry in Python

I'm creating the following table with a postGIS geometry column in python but get an error psycopg2.ProgrammingError: type "geometry" does not exist What should I use to be able to use postGIS in ...
6
votes
4answers
128 views

PostGIS query for selecting features not connected to rest of road network?

I have a dataset of roads in a city stored in a PostGIS enabled database. I would like to identify and remove any feature which is not connected to the rest of the road network. This behavior is ...
2
votes
1answer
195 views

Gdal_calc works but I get a pyhon error at the end of each process

I have a problem while using gdal_calc by a .bat file. Here is the code : call "C:\OSGeo4w64\bin\o4w_env.bat" gdal_calc ...
3
votes
1answer
326 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 ...
5
votes
2answers
645 views

Auto-updating symbology between *.mxds for same shapefile using arcgisscripting?

I have a variety of .mxds for any one project I'm working on, which are all different but all use the same set of base shapefiles for my project. I know I can save a .lyr version of my initial ...
1
vote
2answers
87 views

python rasterio error

When I am importing RASTERIO then i am getting an error as: Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import rasterio File ...
2
votes
1answer
34 views

How can I retrieve private tag GDAL_NODATA from a TIFF using libtiff?

In an earlier post I reported about my attempts to read TIFF with data stored in tiles using python and libtiff. First I tried to use libtiff's function TIFFReadEncodedTile but finally I tried ...
3
votes
1answer
37 views

How to insert a variable into a tool script

I am a bit new when it comes to Python programming and this is very basic but I can't come up with a solution. I'm trying to run the GRASS r.sun plugin tool to calculate the global irradiance for my ...
1
vote
0answers
50 views

QGIS: startup.py missing [closed]

I am trying to set QGIS 2.8.1 (Linux Mint 17.2) to add the filename/path to layouts. I am using this post as a guide How to add the current document path on Print Composer? However, I haven't got ...
1
vote
1answer
46 views

Qgis -> Settings -> Customization : how to import ini file with python?

With QGIs, from "Settings"->"Customization" i can hide/show the components of the GUI. I can export a INI file with my customization. There is a way to import my INI file with a python command in ...
10
votes
3answers
2k views

Cannot run standalone QGIS script

I've been trying, along with this post, to run a script in OSGeo4w Shell, outside of QGIS. But I get the following error: ImportError: No module named qgis.core I have also read the following ...
1
vote
1answer
236 views

gdal_proximity distance to meters

I followed the answer given in this topic for searching the distance to the nearest coastline given a lat/lon coordinate. The distance output obtained is in degree (I think) but I need the distance ...
1
vote
0answers
57 views

mosaic rasters with gdal_merge.py

I want to mosaic 2 rasters "rasa" and "rasb" using gdal_merge.py . While running the code, it produces an error " No input files selected". Can somebody help me to find the error in the code? ...
1
vote
1answer
43 views

Connect / Disconnect GPS device via PyQGIS

In QGIS I would like to establish a connection to my GPS device programmatically (not via button in the GPS control panel) I found out how to get available ports with QgsGPSDetector i.e. ...
2
votes
1answer
155 views

Using ESRI Python's Geoprocessor Via mod_python

I am working on a number of geoprocessing services to be accessed solely by web clients. The traditional method of encapsulating this type of stuff in toolboxes and then publishing the toolbox just ...
3
votes
3answers
2k 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 ...
1
vote
1answer
39 views

Foreign Key error, creating new splite db?

Attempting to use a plugin in QGIS (midvatten) that utilizes splite. I am attempting to create a db in a different EPSG than the plug in defaults to, im getting "foreign key constraint failed" as my ...
1
vote
0answers
32 views

Programmatically adding folders & layers to QgsComposerLegend

I've been building up QgsLayerTree object with a directory structure that reflects the desired legend. Specifically I'd like the Group(s) to be titles and their contained layers to legend items. ...
2
votes
1answer
95 views

How to find the intersection areas of overlapping buffer zones in single shapefile?

Find the intersections of the buffer zones I found an example where they tried finding the intersection of two different shapefiles -Intersect Shapefiles using Shapely. I've tried to adapt my code to ...
0
votes
0answers
20 views

Convert geoalchemy2 Geometry(polygon) column to OGR Geometry

I would like to use OGR to perform analysis. My data currently lives in a PostGIS database. I am loading my data into a python environment using geoalchemy2. I am hoping that a line similar to the ...
2
votes
1answer
63 views

Accessing GPS from QGIS 2.14.1/Python 2.7 /Windows10

I would like to access the device described at QGIS live GPS tracking /recommended hardware (GPS USB stick) via QGIS/Python. A gps module does't seem to be part of the standard installation of python ...
5
votes
2answers
95 views

QGIS python processing.runalg Clip returns None

I'm writing a script in pyQGIS, which would emulate measurement of a line by "walking" along it with a compass with constant length. I have a problem with the Clip algorythm from processing module, ...
2
votes
1answer
31 views

Raster brightness, contrast, saturation in PyQGIS

I'm trying to find a way to change these properties (especially contrast and brightnes) and I've found a QgsBrightnessContrastFilter class, but I can't fugure out how to apply it to my raster layer. ...
0
votes
1answer
48 views

Can I multiply fractions in map algebra?

I have a couple of rasters that show % of success in different things. I want to calculate the overall probability of success. The numerical values are integers so they represent the percentage. This ...
0
votes
1answer
39 views

Python: Running a function on all points in a list [closed]

I'm trying to get a list of cartesian points along contour lines and convert them to polar coordinates. I'm trying to run a function to convert them to polar, one for the length and one for the angle. ...
1
vote
0answers
41 views

How do I calculate the percentage of progress using raster data using Python?

How do I calculate the progress amount of two or more raster data being processed? I have seen examples of vector data but it becomes difficult to calculate the progress when no vector data are ...
0
votes
0answers
37 views

cartopy: plotting shapefiles

I am new to gis and am trying to plot a shapefile containing land polygons. (From OSM.) Unfortunately my output image is always empty (i.e. white). Can somebody tell me what I am doing wrong? import ...
2
votes
1answer
240 views

Weighted Overlay - passing parameter as text error?

For some reason when hardcoding the save path for the wieghted raster just before runtime it works perfectly. Like such... arcpy.env.cellSize = "90" arcpy.env.workspace = r'G:\Xcel\Route ...
0
votes
1answer
34 views

Shebang line for ArcGIS Desktop [closed]

I'm writing a script to be run on ArcGIS for Desktop, which only runs on Windows machines. Is there any use for a shebang line at its beginning, and if there is then what should it be (e.g. ...
17
votes
4answers
5k views

What python web-mapping framework to use? [closed]

I am interested in developing a web-mapping application. I am relatively familiar with Python and so i'm looking for a python framework. What are my options? what are the pros and cons of each option? ...
0
votes
0answers
40 views

Getting closest point on road to point in OpenStreetMap using Python?

I need to find the closest point on a road to a external point in OSM, but I need to do it without downloading the OSM data nor using PostgreSQL, i.e., I can't use the solution pointed in How do I get ...
7
votes
2answers
554 views

Parsing serial date in ArcGIS for Desktop?

I have imported a shapefile that contains a serial date number that looks like this: 41256.260799. I would like to create a new field that shows only the hour and second like this: 06:33. I've tried ...
3
votes
3answers
208 views

Flow Accumulation Python or MATLAB Script

does anyone have any resources for scripting the D8 flow accumulation in Python or MATLAB after obtaining the flow direction values and filling in 'sinks' and 'flats'? I am trying to understand the ...
2
votes
1answer
57 views

How can I get a map image from an ArcGIS mapserver centered on a single feature?

I have a Python program that is not using arcpy. I need to get an image from a mapservice centered on a single feature using the REST api. I can call the export method to get a map image: ...
1
vote
1answer
36 views

How to install 3rd party python libraries for QGIS without OSGeo4W on Windows?

I want to install pip package in QGIS. I have tried the standard windows installation from Windows command line as explanined in pip site, but still can not import pip from QGIS Python console. I have ...
2
votes
1answer
24 views

Count Lat Lon Data Points Lying Between 2 Azimuths

I need to count the number of points (LAT, LON) from a cvs file that exist inside an arc defined by 2 azimuths. Ultimately it will need to be iterative where the arc defined by the 2 azimuths rotates ...
-1
votes
0answers
26 views

converting to geojson

I have a json as below "data":{"1":{"cartodb_id":1047299,"jsongeom":"{\"type\":\"MultiPolygon\",\"coordinates\": [[[[-114.159837221251,51.1732306066514], ...
3
votes
1answer
50 views

Error when using r.series in a python script

I’m writing a tool script in python and at a certain point I want to use the GRASS tool r.series. I want the algorithem to read all raster files from a folder and calculate the maximum with r.series. ...
3
votes
0answers
122 views

QGIS 2.14 Processing plugin crashes - TypeError: must be string, not None

I've recently installed 2.14, and it worked fine for the first couple of days (Appart from Grass tools), including several program and computer reboots. Today I had this error show up Couldn't load ...
1
vote
1answer
279 views

How to add mdb geodatabase layer (feature class) to QGIS project using python?

I want to add a feature class of a personal geodatabase mdb to my qgs project by code (a plugin I am working on). I am using a command similar to that used for adding shapefiles, but this is not ...
3
votes
1answer
67 views

Dependent Comboboxes in QGIS 2.8.2

I´m setting up an database for an archaeological project with PSQL. There I have a field "material" connected with a table "materials" containing things like metal, stone, etc. In a third table I have ...
5
votes
2answers
5k views

Finding duplicate records in field using ArcGIS for Desktop?

im looking for duplicate records in dbf files based upon the attribute called 'ID'. I have various dbf files from 500,000 records to 1.5 million and I know there are a host of duplicates. I would ...
1
vote
1answer
70 views

Load multiple files from folder for further processing

I'm working on a processing model and I'm looking for a possibility to load multiple shape-files from an Input-folder for further processing (first clip them all to a certain extend, then assign them ...
2
votes
1answer
78 views

Delete all fields with the string “RAWI” using QGIS Python

I would like to delete all fields with the string "RAWI". For instance the field "RAWI_WA" and the field "RAWI_BO" should be deleted but not the field "NSG_RAW"
18
votes
8answers
18k views

Installing GDAL and OGR for Python?

I am developing some code in Python, and I want to use the GDAL/OGR python bindings. What is the minimum I need to install in order to use the GDAL and OGR python bindings? What is the easiest way to ...
0
votes
1answer
27 views

Install pygeoprocessing on ubuntu 14.04 and python3

I'm trying to install the pygeoprocessing package for Python 3.4 on an Ubuntu 14.04 VM. I have all the necessary versions of the required dependencies (GDAL, numpy, scipy, shapely, Cython). ...
2
votes
2answers
310 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
0answers
7 views

Inconsistent indent QGIS [migrated]

I try to set some qwidgets on fields in a Qgis Project, but i have an error of inconsistent dedent at elif field.name() == 'syst':. Made so far: def load(self): map_layers = ...
0
votes
1answer
33 views

Hide/Show leaflet markers based on specific values

So 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') ...