Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

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

9
votes
0answers
365 views

Alter Minimum Bounding Box Algorithm

I'm trying to create an algorithm similar to minimum bounding box (though it may end up looking nothing like it). In this case the angle will be passed as a parameter and given the angle I need the ...
9
votes
0answers
292 views

Executing bidirectional dijkstra on TIFF image?

Can anyone indicate an example of how to do this? Link, tutorial etc... I started a discussion here about how to load a TIFF image like a graph nicely answered by @sehe. But, in this post the image is ...
7
votes
0answers
193 views

Multithreaded DB connection for QGIS plugin

I am using QGIS 2.18.21 and PostgreSQL 9.6. on a Windows 8 machine. I am trying to do processing of a certain database task in the background, and I want the user to be able to continue to work in ...
7
votes
0answers
367 views

Accessing existing instance of QGIS from stand-alone python script

For my own data analysis pipeline, I am running a split screen setup with iPython notebooks on one side, generating variables from source data, pushing them to a CSV file which QGIS then reads/joins ...
6
votes
0answers
66 views

Coarse Woody Debris extraction

I created very high dense point cloud of some forest plots using terrestrial laser scanner. Then removed points above 1.3 meter to see the coarse woody debris (Fallen dead trees). Attached is the ...
6
votes
0answers
226 views

Different results from GDAL raster attribute table command on mac and windows

I am trying to get the raster attribute table of the following file: Shift_cult_past_current_prediction_20160107_gr1DD.tif available here: https://www.dropbox.com/s/fmomfpro3j6dmz8/...
5
votes
0answers
93 views

Installing QGIS to virtual environment?

I'd like to install QGIS. I'm on a system that defaults to Python 2.5x and I downloaded python 3.7x with homebrew. I created a virtual environment with this code. brew install pyenv brew install ...
5
votes
0answers
200 views

GDAL grid Not recognizing csv as having geometry

NON-DUPLICATE EDIT: This question is not a duplicate because I have tried the solution presented as the answer to the "original" question and it did not work. See results below. I am attempting to ...
5
votes
0answers
142 views

Computing the horizon profile given a DEM in python

Can anybody orient me towards an open source python script that computes the 360° horizon profile (azi + elevation of highest topography in eye sight) from a single point (x,y,z) on Earth (account for ...
5
votes
0answers
249 views

MapScript with Python 3

I am trying to build raster summarizing features into a GeoDjango webmap, and would like to use the django-raster and django-wms packages to do so. I believe that I have them set up correctly, but am ...
5
votes
0answers
544 views

Setting band names when writing multiple layer rasters using GDAL with Python?

I want to write a raster file (using GDAL+Python) with multiply bands. However, I do not know how to named bands. Their names are always "Band 1", "Band 2", etc. I search and found a function that ...
5
votes
0answers
2k views

gdal/python: tif not recognised a supported file format

I'm trying to open a tif using gdal, read it as a array, do some math, and write it back as a tif. However, when I try to gdal.Open(tif) in python, I get the error: RuntimeError: /att/gpfsfs/...
5
votes
0answers
1k views

Speed up row-wise point in polygon with Geopandas

I have a geopandas GeoDataframe which contains some attributes and a geometry column which is filled with shapely Point(lon, lat) objects. Moreover, there is a GeoSeries which is equally indexed as ...
5
votes
0answers
825 views

library for minimum bounding box “by width” in javascript or python

I'm looking for a library (or at least a code snippet) to calculate the minimum bounding box "by width" in javascript or python. Below is an illustration from the ArcGIS documentation of that ...
5
votes
0answers
858 views

Print Composer Template produces empty map?

I have a print composer template which I'm trying to populate with different subset queries from a CSV-derived vector layer using the Python API. However, all the output PDFs contain everything except ...
4
votes
0answers
182 views

QGIS 3 Python plugin psycopg2 Postgres Notify/Listen Live Connection

I'm developing a plugin for QGIS3 for my company, where my managers can allocate tasks to other users. I have programmed two tables within the python script, witch will be only visible according to ...
4
votes
0answers
84 views

Variable width buffer based on axis directions in QGIS

I need to buffer a polygon with a different distance in the x and y directions. I should add that my polygon has the following properties: closed (obviously) simple (no edge crossing, no more ...
4
votes
0answers
92 views

Speed execution of PyQGIS algorithms

I don't understand why if I do "manually" some algorithms I get results much faster than when I insert the same in a pyqgis code (with the same input). This happens, for example, with the extract ...
4
votes
0answers
95 views

Performance improvement methods in a shapely environment

I am trying to use the Shapely and Fiona libraries to eliminate polygons from one layer (some triangles) from another layer (which represents the world's oceans). I am looking for suggestions to ...
4
votes
0answers
211 views

Installing third party python library in QGIS 2.18.x Windows

We are running into a strange behaviour while trying to use pyoidc with QGIS 2.18.x windows standalone version. Due to pip/pipy no longer working with QGIS 2.18 (see this post), we installed the ...
4
votes
0answers
44 views

How to get a layer object from a geometry

I have a polygon as a gdal geometry and I'd like to use it with gdal.RasterizeLayer(). As its name states, this method needs a layer object, not a geometry. So I need to convert/wrap my geometry into ...
4
votes
0answers
590 views

How to perform spatial join and obtain attribute in python/GDAL?

I am working on a script that will take an unprojected raster, and using a UTM grid (shapefile), will obtain the correct SRS (I have a shapefile where each zone is attributed with its numerical SRS) ...
4
votes
0answers
131 views

Determining Bounding Points of UAV Images

I know the EXIF data from drones contains the GPS point central to the photo to provide photo location. What I'd like is to determine the lat/lon of the four corners of the image. I've done a pretty ...
4
votes
0answers
683 views

Install OSGeo module in virtualenv

How can you install the osgeo module in a virtualenv? I downloaded QGIS using KyngChaos (www.kyngchaos.com/software/qgis) following https://arset.gsfc.nasa.gov/sites/default/files/land/webinars/...
4
votes
0answers
179 views

PyQGIS composed Atlas generation

I have some layers : layer 1 layer 2 layer 3 and I have create styles for any labels layer using base rule styles and labels and I have create a template .qpt and I use atlas correct. In my ...
4
votes
0answers
467 views

Import Pandas or any Python module into QGIS internal Python

(Also asked in stack overflow - https://stackoverflow.com/questions/43244062/import-pandas-or-any-python-module-into-qgis-internal-python ) I am developing a plugin for the current LTR version of ...
4
votes
0answers
413 views

Math domain error in slippy tiles generator

I'm running Alexander Hajnal's Python module (http://alephnull.net/software/gis/tile_writer.shtml) in QGIS (2.14.3, Win10 64) and I'm using the EPSG:3857 as crs. I got this error: "Traceback (most ...
4
votes
0answers
538 views

Right-hand-rule in QGIS

It seems that there isn't a plugin to perform the right-hand-rule on a layer or selected features. Can this be done by using some Python code? Is there a function that works in the same way as ...
4
votes
0answers
622 views

Shapely polygons crossing the antimeridian

Sample data Consider the following WKT Polygon, crossing the international dateline (antimeridian): POLYGON((176 49,-65 49,-65 11,176 11,176 49)) And the following points: POINT(-140 32) # ...
4
votes
0answers
267 views

QGIS selecting features and using field calculator to update existing field using python

I am wondering how to select features based on conditions from multiple fields to update an existing field in QGIS. This is the code I have so far. The expression I want to use to select features is ...
4
votes
0answers
2k views

What is the fastest version of gdal2tiles?

I have multi-CPU linux server, so I wonder what is the fastest parallel version of gdal2tiles.py ? My Ubuntu version: lsb_release -a Description: Ubuntu 12.04.5 LTS How I install the package: ...
4
votes
0answers
269 views

netCDF has wrong spatial extent in metadata

I have a netCDF file with spatial data ranging from x:528500 573500 y:350500 399500 on EPSG: 31287. If I open and explore the file with Panoply and show the data on a map all works like it should. ...
4
votes
0answers
149 views

Gdal Python problem: black strips in image translation

I have a 500 x 500 m resolution world map of clumping index data (He et al., 2012) and I am trying to do two things at the same time: 1) to isolate the variables per plant functional type following ...
4
votes
0answers
496 views

ATDI free map read with software

I am interested in working with the freely available ATDI MAPS. The maps are provided for their proprietary software ICS manager or ICS telecom. I am involved in a project to develop a software in c++ ...
4
votes
0answers
156 views

Python QGIS crashes within categorized renderer setup

I'm hassling around with QGIS renderer definitions in python with QGIS 2.8 at debian wheezy. At least I want simply build step by step a categorized renderer to fill a polygon. The script crashes, ...
4
votes
0answers
219 views

How to handle large tables in QGIS using python?

I'm currently writing a plugin that calculates values based on a QgsVectorLayer's attributes. To display and print the values I'm using a QgsComposerTextTableV2. I have several problems with my ...
4
votes
0answers
953 views

GDAL RasterIO performance in C++ vs ReadAsArray in python/numpy

I'm currently writing optimisations for a raster viewer program which uses gdal as it's base. It's currently written purely in python, and has some major speed issues which cause problems when we are ...
4
votes
0answers
90 views

Issues updating field values programmatically for particular field data type on 64bit Windows computer using QGIS 2.8.7

I have an issue with a plugin for QGIS 2.8 I'm developing when using it on a Windows 64bit machine (as opposed to 32bit). I am trying to update values in a particular field in my plugin, and the ...
4
votes
0answers
101 views

Open QGIS project files in exclusive mode / alert if project file already in use

I have QGIS-Project-Files saved to a network drive and was wondering if it is possible to warn users that a project file is already opened by an other user to prevent concurrent editing of the same ...
4
votes
0answers
339 views

PyQGIS: vector layer does not get displayed after rendering

My project goal is to write a standalone app for Unbuntu and QGIS 2.14. It should get a layer of simple points and their name from a Postgres database and show them in a layer. In addition there ...
4
votes
0answers
134 views

TypeError: QgsEncodingFileDialog

I am using the latest version of QGIS (Lyon) on MAC and have set the default Python version 2.7. Moreover, I have installed all the required python modules and GDAL. It was working before, but now, ...
4
votes
0answers
67 views

“Merging” 2 layers of LineString with splits at intersections

I would like to "merge" 2 networks of lines and these lines need to be split when they intersect. With pictures it should be clearer : What to do: if a black line intersects a red line, they should ...
4
votes
0answers
541 views

Setting up PyCharm CE 4 to work with PyQGIS library in Mac OS

I am trying to set up pycharm to work with pyQgis library but with not success till now. I am using PyCharm CE v4 and QGIS version 2.8 I have tried to implemnte the instructions of several posts like ...
4
votes
0answers
390 views

Using ST_AsText() without session object

I am storing gps locations as feature in a restfull api. The locations are linked by foreign key to "place" objects in a flask/sqlalchemy/geoalchemy framework. I would like to print a user readable ...
4
votes
0answers
1k views

Is there a way to execute FME transformers from a PythonCaller script in an FME workspace?

I have a very large and complex Python/arcpy script that does lots of custom calculations, and I am trying to port it to an FME environemnt. The script runs beautifully under ArcGIS. The problem in ...
4
votes
0answers
1k views

Buffering a Raster with GDAL and Numpy

I am using GDAL to convert a raster dataset into a numpy.array and then using numpy to buffer the data in the raster. For example, I need to know all the regions within 100ft of a school point ...
4
votes
0answers
762 views

Extracting x,y,z values from a postgis linestring to python using ogr

I am trying to load a postgis linestring into python (using ST_DumpPoints) and extracting x,y,z coordinates, which is working but extremely slow..and if i mean slow, i really mean it (yes, it takes ...
4
votes
0answers
1k views

Add CAD Drawing Dataset into ArcMap using Python

I am trying to add an CAD Drawing Dataset into ArcMap using Python. Question is how to add a Auto-CAD .dwg file to ArcMap using Python Normally comes in as CAD file within a Group layer with: ...
3
votes
0answers
36 views

Indexing to Open Data Cube not working for land cover map

I'm trying to index a clipped version of ESA's 2015 land cover map into an Open Data Cube instance. I've written a product specification yaml and a yaml for te actual product itself and it indexes ...
3
votes
0answers
57 views

Automatically update and reclassify project layer from Excel data

I have a project in Qgis that gets its data from a locally stored excel file (linked). Is there a way to automatically update the linked data? What is happening now is that when I change some rows in ...