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

learn more… | top users | synonyms

2
votes
0answers
19 views

get active colourramp form qgis rasterlayer

I m building a pythonscript were i need the active singleband pseudocolour colourband of a raster. I want to give the active colourramp a new min and max value. I can only find examples like this ...
2
votes
0answers
20 views

classify colourramp with new min and max value with python

For my script i want to update the existing colourramp of a raster with new min and max value. In my current code is can fill the min and max but can't classify and update the raster. How does the ...
0
votes
1answer
35 views

Exception using PyGRASS: “No module named 'core'”

I am trying PyGRASS on Ubuntu 14.04. I have GRASS 7 installed from the UbuntuGIS PPA: $ dpkg -l | grep grass ii grass 7.0.4-1~trusty1 ...
0
votes
0answers
13 views

finding orientation of nitf to display on cesium js globe

I am trying to display my nitfs on a cesium js globe. My first hope was to build kml of tiles and zip into a kmz file. This worked great in google earth, but cesium js does not support this. Their ...
2
votes
1answer
66 views

How to get attribute values from vector features visible in the qgis canvas

I have a vector layer (grid). Currently I select some tiles with the select tool and paste some python code to get information about these features. layer = qgis.utils.iface.activeLayer() ...
2
votes
1answer
62 views

Update raster color ramp with new min/max values using python?

For a script, I want to update the exsiting min and max of a colour ramp with a new one. In the image you can see what I want to update. To do so I tried to follow this thread. I tested the ...
3
votes
1answer
58 views

inaccurate distance measurements in Python

I've tried several ways of measuring the distance between two points in my Django application and comparing the results to a reliable measurement. My numbers are way off. For example, I'm assuming the ...
1
vote
2answers
42 views

GRASS 7 environment setup for Python

I would like to use some GRASS functionality from a Python programme. With GRASS 6 this required the set up of various environment variables, as detailed in the GRASS Wiki. I am trying a similar ...
0
votes
0answers
15 views

How to convert Integerized Sinusoidal Grid to lat long?

I'm trying to convert MODIS Integerized Sinusoidal Grid (0.25km/250m) to corresponding latitude and longitude. I found this tool to convert the data. I've written the algorithm for converting ...
1
vote
2answers
66 views

plotting US cities on a map with matplotlib and basemap

I am hosting a conference and want to show a map of where the attendees have arrived from. I have an input file with the names of the cities. I'd like to put a dot on each city, and have the size of ...
1
vote
0answers
52 views

Cannot run QGIS algorithm with python script without interface

I'm trying to run the QGIS 'intersection' algorithm from a Python script: (Working with Ubuntu) #!/usr/bin/env python # -*- coding: UTF-8 -*- import sys from qgis.core import * from PyQt4.QtGui ...
1
vote
1answer
30 views

ArcGIS Server - problem publishing python script that uses urllib

I have problem publishing this simple python script as geoprocessing service with ArcGIS Server. import urllib import arcpy u = arcpy.GetParameter(0) url = "http://geoegl.msp.gouv.qc.ca/cgi-wms/...
0
votes
0answers
18 views

64Bit Applications installed with QGIS/osgeo4w

Is python 64bit and gdal 64bit automatically installed when QGIS 64bit is installed via osgeo4w 64bit? I currently have a custom 64bit python and gdal setup on my pc. However, this setup causes some ...
1
vote
1answer
34 views

Install GDAL python package in virtualenv on mac

I'm trying to instal the GDAL python package, preferably in a virtual environment, but when I try "pip install gdal", I get the following error: extensions/gdal_wrap.cpp:3085:10: fatal error: '...
2
votes
1answer
25 views

How to include QgsRasterBandStats in plugin

I'm making a plugin were i want to get the min and max value of a raster. When i tried the following code in the qgis python console it worked fine but in my plugin code i get the following error ...
0
votes
0answers
29 views

need to convert tiff and kml to geotiff

I'm looking to combine a tiff and kml file into a geotiff (this needs to be integrated into a program i'm writing, unfortunately not a one off). Due to dependency issues I can't use GDAL and it ...
0
votes
1answer
15 views

System locale settings error creating GRASS location from Python

I am trying to use GRASS 7 from Python without explicitly creating a location. I am starting with the script provided at the GRASS-Wiki. This script tries to create a new location in the /tmp/ folder ...
2
votes
1answer
51 views

How to remove all layers from a group

I want to remove all layers from a distinct group. root = QgsProject.instance().layerTreeRoot() the_group = root.findGroup("my_group") parentGroup = the_group.parent() I think I have to loop the ...
1
vote
1answer
29 views

Does Gohlke GDAL break Command-Line GDAL/OGR in Windoiws?

I recently gave up trying to get the gisinternals versions of GDAL's Python bindings to work, and sought instead to use the 'gohlke' approach - getting the appropriate wheel from the UCI repository. ...
0
votes
0answers
39 views

float() argument must be a string or a number, not 'zip' Python

While running the basic example of cKDTree, why I am getting the error again and again. from scipy import spatial x, y = np.mgrid[0:4, 0:4] points = zip(x.ravel(), y.ravel()) tree = spatial.cKDTree(...
1
vote
1answer
41 views

How to tranform MODIS tiles into lat/long?

I'm trying to get the vegetation index nearest to a particular lat/long. I'm getting the data from here which is 250-meter spatial resolution hdf file. The globally gridded projection is split in 36 (...
2
votes
0answers
16 views

Unable to compile using make test(windows)

While trying to compile my test plugin I encounter this error. At the moment i can't figure out why it isn't working. I m using a windows and try to execute the command in OSGeo Shell. I typed in ...
5
votes
0answers
51 views

Sending a https request from a QGIS plugin using urllib2

I'm developing a QGIS plugin that needs to send https request to an API. I have to use urllib2 (see below if you want to know why I don't just use the requests package) The first request I need to ...
10
votes
6answers
1k views

Is there a faster way in python of finding the smallest number in a field?

Using arcgis desktop 10.3.1 I have a script which uses a search cursor to append values to a list and then use min() to find the smallest integer. The variable is then used in a script. The Feature ...
3
votes
2answers
213 views

Automatic selection of pixels, from a raster series, greater than minimum image of the series

Given a series of rasters, and the raster image of the minimum values of the series, I am looking for a python script capable of selecting, for each raster, the pixels whose values are greater than ...
1
vote
1answer
38 views

Writing geoJson from rasterstats

How would I write a proper geoJson, readable by a GIS, from the results of the rasterstats package? stats = zonal_stats("somePolygons.shp", "someTif.tif", ...
0
votes
0answers
40 views

NumPy to GeoTiff for use with Gdal

I have a few NumPy arrays: lat, lon, and 6 data bands. I'd like to convert these to GeoTiff and then apply the gdalwarp function, based on a specific projection, to each band. Is there a standard way ...
2
votes
1answer
19 views

AttributeError: 'SpatialReference' object has no attribute 'ImportFromESPG'

I am trying to create a spatial reference using ImportFromESPG and this is what is returned: AttributeError: 'SpatialReference' object has not attribute 'ImportFromESPG' Code and error are copied ...
3
votes
2answers
60 views

Geopandas Polygon to matplotlib patches Polygon conversion

Unfortunately geopandas plotting is extremely slow and takes a lot of resources, hence I would like to use instead matplotlib for plotting. When I use pure Fiona to open and read the shapefile I ...
1
vote
1answer
48 views

Why are there my_form_open() Python functions in my QGIS project file?

I have a project open with 6 layers (MapInfo .tab format), have set the style for each layer and added labels for 1 of them. So for a simple project the .qgs file is about 2000 lines long and among ...
1
vote
1answer
24 views

Updating a raster using a shapefile [closed]

I have a huge raster file and want to increment all the values within a relatively small shapefile by 1 in Python. Speed is of critical importance, as I have to do this many times. I have been ...
1
vote
2answers
54 views

Point Click for Coordinates - Stand Alone QGIS in Python

I am implementing a stand alone version of the answer to this question > How to programatically check for a mouse click in QGIS My code is below. The code compiles without error, and the toolbar ...
3
votes
1answer
93 views

How to convert multiple csv files to shp using python and no arcpy?

At my internship, I have been asked to learn Python on the job. Its been a rough road never having coded before so please forgive me if my problem is elementary. The Lightning CSV files I am ...
1
vote
0answers
12 views

Duplicate an existing geoserver style using gsconfig

I am playing around with gsconfig and trying to assign a new style on a layer I have created. What I want to do is to actually create a new style, which is the same with an existing one. I searched ...
1
vote
0answers
31 views

Find and filter points within a variable radius

I have a set of projected spatial points (x,y,id,dist,value) that needs to be filtered. For each point I have to find the other ones falling within a variable distance. For each selection, I need only ...
3
votes
1answer
75 views

get log of internal functions called by qgis

Is there a way to know which internal python functions are used by QGIS? e.g., when I click on "add vector layer" button I would like to know the functions that are called by QGIS. It would simplify ...
1
vote
2answers
53 views

Renaming shapefiles and raster files with Python

I'm trying to add "_Kiwi" to the name of multiple shapefiles and raster files in a folder C:\data. For the files with multiple extensions (.shp.xml for example), I can't get the files to rename ...
1
vote
1answer
49 views

How to filter out layers with QgsMapLayerComboBox?

I am using Qt Designer 4.8.5 to develop a plugin (with QGIS 2.14.3-Essen). I recently started to use QgsMapLayerComboBox widgets instead of the conventional Combo Box widget. However, I want to ...
3
votes
1answer
66 views

Add field and calculate expression with PyQGIS

I want to use PyQGIS to add a new field and calculate the values for each feature. Similar to Field Calculator option. My 'Field Calculator' expression is for example: y(start_point($geometry)) from ...
1
vote
0answers
27 views

Qgis standalone script using eclipse IDE -No data provider available issue

I know, the question is asked few times also in this forum but i apply already the presented solutions without any chance to fix the problem. In General the source code looks like the following: from ...
2
votes
2answers
37 views

Find common borders of features and get their attributes using fiona and shapely

I would like to find neighboured features in a shapefile using fiona and shapely. As shown in this answer http://gis.stackexchange.com/a/95595/62250 it's easy to get common borders between features. ...
1
vote
1answer
54 views

How can I add output vector to a list to loop a geoprocessing on it?

I have about 18000 circular buffers that I want to transform in some kind of a wind rose. To do this, I transform the buffer polygons to lines, create points along the lines on the wind directions ...
1
vote
1answer
37 views

Read only geometry from shapefile with python/geopandas

I would like to open a shapefile(shp) without loading the attributes(dbf), as I do not care about attributes and it takes about 25 minutes to load them. I am using Python Geopandas, so any Fiona or ...
2
votes
1answer
36 views

How to use create a plugin that contains a set of processing scripts using Qgis Script feature?

I have some script that I would like to share easily. I have read here that its possible to create a plugin using a set of scripts using "Scripts/Tools group in the Processing toolbox, double-click ...