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.

0
votes
0answers
7 views

Intersection of points and polygons

I have the code down, I wanted to intersect the points and polygons and to create a new shp (points) with polygon ID information. It is replacing me at shp points and the table comes empty. Attention ...
0
votes
0answers
3 views

How to use GDALGridInverseDistanceToAPower in a python script

I'm trying to use GDAL in a python script to do an inverse distance interpolation. So I found GDALGridInverseDistanceToAPower function but it's a C function. Is somebody know how to perform it in ...
0
votes
0answers
2 views

Extracting pixel time series from Google Earth Engine

I have written a short program in Python to extract a time series for any given pixel for MODIS data stored in the Google Earth Engine. The code is working fine and returns a data frame containing the ...
0
votes
0answers
12 views

Python error message 'EOL while scanning string literal (, line 77) See log for more details' [on hold]

I am an absolute beginner in Python programming. Despite numerous attempts to rectify I am constantly finding new errors in the script below. Can anyone help please? ##Network analysis=group ##...
2
votes
0answers
65 views

Creating function in function editor in QGIS

After my previous question Weighted values of field in QGIS, I successfully adapted the following formula in Expression dialogue "Value" / (sum("Value") / (count(CASE WHEN "Value" >= 1 THEN +1 END)...
0
votes
1answer
16 views

pip install psycopg2 from source [on hold]

I have python 2.7 and I want to install and setup psycopg2 from the source code. I installed the code from here http://initd.org/psycopg/ under quick links Download stable release (2.7.7) this ...
1
vote
0answers
12 views

ArcGIS Python Add-In Extension - how to make it immediately functional after install?

I have a Python add-in that includes an extension class. The only purpose of this extension is for some buttons in the add-in to be automatically enabled/disabled depending on if there are relevant ...
0
votes
1answer
60 views

Loading all rasters in a directory and naming the variables iteratively

Hi I'm working with prism data and I already have clipped (masked) rasters (*.bil files) of a specific area for each day of a year. I'd like to open all these rasters with rasterio, convert them into ...
3
votes
0answers
29 views

ArcPy Memory issue re-using dictionary?

Before I start I should mention that before this I have never worked in Python before. I am trying to process a large fc to fc update, 3 million plus rows with 70 columns. I tried using updatecursor ...
1
vote
1answer
8 views

Failure to Revoke ArcGIS Pro Advanced license using Python API

I am scripting the provisioning and de-provisioning of users for my place of employment. I have the script in place to license users but I am having trouble getting the revoke script to work. I can ...
0
votes
0answers
10 views

Extract data from NetCDF file based on station

I have read other solutions for NetCDF data but my data are a little different and I do not know how to extract data from NetCDF and save them in CSV files based on stations. Data include the maximum ...
0
votes
1answer
26 views

How to create a GeoDataFrame from Dataframe correctly? [on hold]

I am new to Python and struggling with this problem: I have a DataFrame which contains one column called 'WKT' with polygons. I wanted to import it by using gdp.read_file. The import is working but ...
1
vote
1answer
356 views

'pyrcc4' is not recognized as an internal or external command?

C:\Users\Department\.qgis2\python\plugins\np>pyrcc4 -py2 resources.qrc -o resources.py 'pyrcc4' is not recognized as an internal or external command, operable program or batch file. How do ...
0
votes
1answer
16 views

pyrcc4 command not recognized as internal or external command? [duplicate]

The question has already been asked as 'pyrcc4' is not recognized as an internal or external command? but the answers did not fit my own trouble. I am trying to create a plug-in. I followed ...
2
votes
1answer
23 views

Populating new field in shapefile with values from list?

I'm looking to populate a newly created field in a shapefile that from a list using basic python and osgeo tools. The values are integers and in a python list that is the length of the number of ...
6
votes
1answer
3k views

Programmatically populating shapefile field with polygon areas in OGR?

I'm trying to programmatically populate a shp field with polygon areas: import sys import ogr ds = ogr.Open( 'tttttttttt.shp', update = 1 ) if ds is None: print "Open failed./n" sys.exit( 1 ...
0
votes
0answers
9 views

Different levels in R-tree

I am using the "rtree" package in Python to index spatial data. Is there any way to identify how many levels are there in the R-tree?
0
votes
1answer
18 views

Convert GeoJSON object to bounding box using Python 3.6

Is there a library available in Python 3.6 using which I could convert a GeoJSON object (geometry) into a bounding box object? Actually I am calling a WMS layer from GeoServer and I want to set the ...
1
vote
0answers
12 views

How to find data orientation atfer an ICA

I'm trying to cluster tractor sensor data by row in a python script. For the moment I'm trying to find data orientation after a FastICA (sklearn), vertical or horizontal. Because for same data, ...
0
votes
0answers
5 views

ERROR 1: gdal_translate was compiled against GDAL 2.0, but the current library version is 2.2

I have tried to uninstalled both version but failed. both version were installed from source. How can I remove both version or point to 2.0 version.
2
votes
1answer
32 views

Fast intersection of a list of polygons with a bounding polygon using Shapely

I have a list of Shapely polygons which I need to find the intersection of each with a bounding Shapely polygon. Not all the polygons in the list cross the boundary of the bounding polygon so I only ...
0
votes
0answers
17 views

Visualizing R-tree in Python? [on hold]

I am trying to visualize R-tree in Python. Are there any existing packages for this?
1
vote
1answer
991 views

What do “count”, “mean”, and “sum” in QgsZonalStatistics mean?

I am working with Qgis and making some analytics of lightdata. I've used these commands: rasterfile = qgis.utils.iface.mapCanvas().currentLayer().source() vectorlayer = qgis.utils.iface.mapCanvas()....
1
vote
0answers
43 views

asyncio with multiprocessing

I am trying to run a multiprocessing on a zonal statistic in pure Python. I am new on it. I have to apply a zonal statistic with a shapefile with more than 6 million features on a taster of 6 GBs (...
0
votes
1answer
27 views

Understanding Scale in Earth Engine

I am trying to understand the scale parameter in earth engine better. My goal is to calculate monthly sums of precipitation across a geometry. Here is the python pseudo code: area = ee.Geometry....
0
votes
1answer
25 views

Problems with raster to point operation in QGis 2.18.17

I tried to make points of IDW or Kriging interpolation. From point csv-file I made .asc raster file, then I tried to make "raster value to points".At first QGIS wrote me about the error: ascii' ...
0
votes
0answers
10 views

Error in write Array in Raster file: “”ValueError: expected array of dim 2“”

I'm using Python in my research and how I don't have large experience in this language, I need Help to understand this error that occur when I`ll write a array as raster file. data_res_b1_corrected = ...
23
votes
5answers
12k views

Installing QGIS3 on Mac?

Kyngchaos installer is not finding python3. I installed python3 using HomeBrew and is not located at /usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/bin/python3.6 How do I ...
0
votes
0answers
21 views

Building macro for simple tasks [on hold]

I want to automate some simple steps in my QGIS work. I have several layers included in my project file. What I want to do: Select one layer visible Fit it to screen Print it to SVG via simple svg I ...
3
votes
1answer
89 views

Custom function works in “Zoom to Features” but not “Select Features”

I'm trying to update the Using Custom Functions tutorial to QGis 3 and Python 3 and I've run into an interesting issue. With the following code I can create an expression GetUtmZone()='33N' and it ...
39
votes
7answers
69k views

Converting projected coordinates to lat/lon using Python?

I assume this is a basic question but I can't seem to find or recognize the solution. This site returns Point: X: -11705274.6374 Y: 4826473.6922 when you searching with the first key value of ...
1
vote
1answer
96 views

RasterIO saves wrong coordinate system when writing to a new file

I am trying to open, perform a calculation then save to a new tif file using RasterIO without changing the coordinate system. My input tif is in GDA 1994 MGA Zone 54 and has a wkt string of PROJCS[...
1
vote
1answer
128 views

Unable to load layers from MSSQL PyQGIS

I have a plugin that loads layers from SQL Server 2008. It has worked before but when I reset my PC, i wasn't able to backup my plugins. I am left with an older copy. Below is my python code to load ...
0
votes
0answers
20 views

Download GEE Image Based on Boundary of Feature Collection in Python [duplicate]

In Google Earth Image I'm trying to download an image using the boundaries of a feature collection using Python. Working off this example, in 'region' I want to specify a feature collection instead ...
1
vote
1answer
82 views

Handling AIS data using Python and PostGIS?

I want to turn points into a linestring in PostgreSQL with the extension of PostGIS using Python. I want the lines in a new table because every few minutes more points are added and it needs to keep ...
0
votes
0answers
12 views

Using Python / ArcPy to activate feature in one of ArcMap toolbars?

I'm writing a basic python script that will change a definition query and export. That is simple enough, but I would like to also add these arrows that only show up when you manually check a box ...
0
votes
0answers
16 views

NHGIS census files get lat/lon from polygon

I've never worked with shapefiles before and I'm having a lot of trouble with something that I think should be pretty simple. So I have the census tract files from NHGIS for 1980 and the structure ...
1
vote
1answer
29 views

Empty shapefile created with Python and GDAL

I need to create a point shapefile using the coordinates specified in the variable I called "my_points_dataset". 'my_points_dataset' variable has this structure: 1615311.055743243079633 4820229....
1
vote
1answer
62 views

Map automation using open source Python modules

I have a shapefile with 3000 parcels. I am going to generate a map for each parcel. The map should be the same as the following paper map. I know that arcpy.mapping can be used for this purpose. I was ...
0
votes
1answer
36 views

Integrate JSON file inputs (specifically latlng) in Leaflet with JS

It's my first time using Leaflet and I wanted to simply put two markers based from my inputs. I managed to connect my JSON file with the JavaScript and the only problem I have is how to dynamically ...
0
votes
1answer
67 views

Write GeoTIFF in Python without GDAL

I have a code to transform numpy array in TIFF image using Pillow. But now I need to georeference the tiff to later use it in a GIS software. In my case, I have the latitude and longitude of each of ...
0
votes
0answers
6 views

PDAL Filter output is same as input file

I've applied SOR filter using PDAL python.Below is the code snippet of the same, json = """ { "pipeline":[ "D:/Lidar_collect_3/output/output_1.las", { "type":"filters....
1
vote
0answers
22 views

Unable to load output layer from Python algorithm in QGIS 3

I'm building a Python algorithm for QGIS 3, to be run from the Processing Toolbox. I've finished debugging the algorithm body, which seems to work, but QGIS is unable to load its output. Here's the ...
-2
votes
2answers
58 views

How to gently ask PostgreSQL to add PostGIS extension

I have recently installed PostGIS for the first time. I'm trying to use psycopg2 to create some polygon features. This runs: cur.execute('CREATE TABLE test_insert_shape (uuid varchar PRIMARY KEY, ...
1
vote
0answers
23 views

R process: Zonal Stat Raster has No Data Values vs Arc output

I am trying to re-create my ArcGIS Zonal Stat model with R All my files will be 30m pixels; 18000 x 18000. I have used R two different ways to create the output and both create NoData values in the ...
0
votes
0answers
36 views

[Resolved) Resampling ALOS images with Python

I'm trying to resample an ALOS image of 12.5 m resolution to 1 m resolution with cubic interpolation using GDAL warp. Here is the current code used in pyzo import os from os import path import ...
2
votes
0answers
61 views

Rank-based Spatial Clustering in Python

I was wondering if there was any python (or R) packages out there that can do spatial clustering on ranked data? For each US state I spatially varying value for education rankings. For example, for ...
-1
votes
0answers
15 views

issues import fiona [on hold]

import fiona Traceback (most recent call last): File "", line 1, in import fiona File "C:\Python27\lib\site-packages\fiona__init__.py", line 87, in from fiona.collection import ...
18
votes
8answers
8k views

What software to use for making digital elevation models from UAV aerial imagery?

I have a an unmanned aerial vehicle (UAV, also called a drone) and would like to use it to create a digital elevation model and orthomosaic over a smaller area (10 km2). My platform will be able to ...
0
votes
1answer
25 views

How to post marker to Mapbox GL map

I'm following this tutorial about Mapbox GL and flask which has been going great until the step to add markers to the map. I've tried to distill it to make it as simple as possible but it's still not ...