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
15 views

ExecuteError when loading rasters using ArcPy Mosaic to Raster tool and Python multiprocessing

I'm attempting to merge thousands of rasters into a smaller more manageable number using the Mosaic to NewRaster_management tool in ArcPy. The code I've written works just fine when I run it the ...
0
votes
0answers
35 views

How to determine which point lies in which polygon from a list of multiple polygons

I am new to python and currently working with Json file and I need to determine the location of each tweet and represent the grid in which they are present with the count of tweets in each grid cell.I ...
1
vote
1answer
33 views

Intersection function returns multiple coordinates

I am trying to find intersection vertices of two polygons defined below PG = Polygon([(0.0,0.0), (0.0,4.0), (2.0, 0.0)]) QG = shapely.affinity.rotate(PG, 10.0, origin="centroid") print(PG....
1
vote
0answers
78 views

PyQGIS raster image shifted from vector shapefile

I previously asked a question about my raster image being larger and shifted over from my vector image here, but now I realize that the raster image is only shifted to the left and up from the vector ...
1
vote
0answers
37 views

Why gdal does not find gcps coordinates on SENTINEL images?

I use gdalwarp with python to overlay polygons on ENVISAT radar images. Everything goes well for this type of images but when I try with SENTINEL images, gdal does not find the georeferencing. It ...
0
votes
0answers
16 views

Trying to convert latitude longitude values in UJIIndoorLoc dataset to degrees

I'm trying to convert the latitude and longitude values in UJIIndoorLoc dataset to degrees. The paper mentions that the data is in UTM from WGS84. Here is an example of the values given: LATITUDE: ...
0
votes
1answer
42 views

Clip shapefile based on another shapefile [closed]

I have two shapefiles with me, one big and one small. I want to clip part of big shapefile where the small shapefile is located. I tried QGIS vector intersect by geometry, but that is returning me ...
0
votes
0answers
32 views

Perform Multiple Point in Polygon Queries PostGIS

I was wondering if there was a way to send one request to a PostgreSQL server with the PostGIS extension that contained multiple points, and then find the polygons that they are located in. For ...
1
vote
1answer
25 views

Open a mutliband raster, edit values in one of the bands, and overwrite the raster using Python/Rasterio?

I have numerous multiband rasters (36 band) in which preserving the band order is important for future processing. One of the bands often contains erroneous data and I'd like to be able to change all ...
1
vote
0answers
27 views

Sorting massive amounts of geospatial data based on location and scale using Python [closed]

I have a few terabytes worth of geospatial data. Raster, matrix, imagery and vector, everything from point shapefiles of gas stations in a local area to country overviews. Some of the data is good (...
0
votes
0answers
7 views

OWSLIB Python Library

I'm looking for some way to change a gis iso metadata xml. I had find the Python OWSLIB and I could read an XML file. However I can't find a way to change the MD_Metadata CLASS attributes and write ...
1
vote
1answer
25 views

Writing numpy arrays to irregularly shaped, multiband raster

I have the following numpy arrays: predictions; type is float32; shape: (94, 1461) lats; float32; shape: (94,); centroid of cell in vector layer, decimal degs. lons; float32; shape: (94,); centroid ...
0
votes
0answers
23 views

Saving matplotlib map to shapefile in python?

I already plot a prediction map I made with xgboost modal by matplotlib function and I want to save this map as a shapefile so I can work with it in ArcGIS, how can I do that? Picture of the map:
0
votes
1answer
18 views

Find intersection vertices of two polygons

I have defined two polygons and I can find whether they intersect or not. I need to find the intersection vertices if they intersect or not ? How can I do that ? p1 = Polygon([(0,0), (1,1), (1,0)]) ...
0
votes
1answer
25 views

Equivalent method for .withcolumn() for geodataframe

I am trying to use a user-defined function in pyspark in order to check whether the points in CANmep_GDF lie within the polygons in gda_GDF. from geopandas import GeoDataFrame def check_exist(geom):...
0
votes
0answers
9 views

Pyinstaller Osgeo4w jvm.dll

I try to create a exe file since 2 days. Pyinstaller and cx_freeze have problems with .dll files and py2exe is not working for python27 which i have to use. The problem with pyinstaller is the ...
0
votes
0answers
20 views

Converting a bearing in degrees to DMS from a column in a table?

Bearing Point 1 0.000000 Point 2 81.847356 Point 3 121.959755 Point 4 351.612081 Point 5 189.582973 Point 6 242.890690 Point 7 41.095348 So far I have this but am ...
0
votes
0answers
36 views

pyinstaller stops in the middle of process

I try to create a .exe from a .py script. I use Pyinstaller. The script runs fine with no errors in Pycharm. If I open the .exe my Tkinter opens I can choose the files etc.. And then in the middle of ...
0
votes
0answers
25 views

Merging many files on Python?

I'm new to Python. I tried to call gdal_merge.py import sys sys.path.append('C:\Program Files\QGIS 3.6\bin\gdal_merge') import gdal_merge as gm gm.main(['', '-o','C:\12\Merged.tif','C:\..\...
0
votes
0answers
41 views

Nested loop in time series change detection in Google Earth Engine?

I want to execute Continuous Change Detection and Classification(CCDC, Zhu&Woodcock, 2014) to all pixels in a given region in GEE. The first step is to build an image collection containing all ...
0
votes
1answer
55 views

Read multiple netCDF4 using Python 3

I need to read a multiple netCDF4 files using python 3. The files are in different folder named 2019, 2018 with months and days. And the files have the same variables I use to read and plot it. I ...
1
vote
0answers
17 views

Error when starting QGIS 3

I get an error when starting QGIS 3. Then I type this into python console: import matplotlib.pyplot as plt See response below. What is the problem? Python Console Use iface to access QGIS API ...
1
vote
0answers
54 views

PyQGIS overlaying raster image on vector map correctly?

I have some code written in Python using PyQGIS where I am trying to overlay a raster image gridded with coordinates on to a vector shapefile map with the same coordinates. However, when overlaying ...
0
votes
0answers
27 views

Geopandas doesn't fix invalid geometries

I am trying to fix self-intersecting polygons on shapefiles in Python 3 using Geopandas as below: import geopandas as gpd shp = gpd.read_file('shapefile.shp') print(shp.is_valid) 0 True 1 ...
2
votes
1answer
39 views

Write accent mark in .shp and .dxf filename

I'm trying to export with python 2.7 some shapefiles and CAD files that could have specials characters in their filename, like accent marks. In example, I want to have this: ...
2
votes
2answers
26 views

How to resolve QGIS 3 syntax error from processing.algorithmHelp?

I am using QGIS 3.4.3-Madeira and OSX Mojave 10.14.3. I am trying to use QGIS 3 through the Python Console. I am following the QGIS 3 documentation. I am trying to determine the syntax of the ...
0
votes
0answers
39 views

Creating NDVI using Python, rasterio producing grey image

Using Sentinel data I am creating an NDVI image using the below Python code. The output is a grey image. import rasterio from rasterio import plot import matplotlib.pyplot as plt import numpy as np ...
1
vote
0answers
49 views

How to segment polygon in to line segment?

I want to segment a Polygon or PolyLine in segment of line and remove some segments. I have an polygon that i convert in polyline by the code below and it work well: from shapely.geometry import ...
1
vote
0answers
28 views

How to join multiple nearest neighbouring nodes using postgresql or python?

I have many short paths SHP file which look like a longer dashed path. Is there an efficient way to connect these paths to one continuous path? If possible, I want to avoid a hundred times manually ...
0
votes
0answers
20 views

Create/deploy REST API using ArcGIS/Python

I've written a bit of Python code that utilizes ArcGIS to perform some analysis on a specific location. Running this locally on my computer works great. However, I am struggling and am unfamiliar with ...
0
votes
1answer
48 views

Python - Extract raster values at point locations

I'm a beginner with python. I would like to extract raster (.tif) values from a set of specific points that I have in a shapefile. I would like to have the same result as the QGIS Point Sampling Tool ...
1
vote
0answers
40 views

Layer selection changed connect signal none type issue

How propery use the layer selection changed method? I am using following method. It shows error "NoneType" object is not callable def test(): print "selection changed" layer.selectionChanged....
0
votes
0answers
30 views

Locating observations that lies within a collection of Polygons (Python)

I'm trying to locate the observations that lie within a collection of Polygons but my current implementation takes forever, and I suspect that it is because the 'within' method needs to check all ...
1
vote
1answer
99 views

TypeError: tuple indices must be integers or slices, not str after ingested data into the open data cube

I've ingested some landsat 5 images into a database using the open data cube. The problem is that when I try to run the continous change detection function following the jupyter notebook I get a ...
0
votes
1answer
35 views

Add custom maps in Mapbox as tile layer in Folium

I was trying to create a map in Folium using a custom map built tile layer created with Mapbox Studio (using 3 different datasets and a satellite basemap). I was wondering if there is a simple way to ...
1
vote
0answers
31 views

Returning a new vector layer with additional setup from a processing algorithm in QGIS 3

I am working on a processing script in QGIS 3, which does the following: Take a few inputs Run a native algorithm on these inputs, saving the resulting new layer in memory Set up the symbology for ...
1
vote
0answers
38 views

Rename fields of shapefile using PyQGIS 3

I am using the following script through QGIS 3.4 "Python Console" to rename field names of shapefiles. The input will be a CSV file with 1st row - shapefile name, 2nd row - old field name, 3rd row - ...
0
votes
0answers
50 views

Calling Python script from .net form?

I am trying to create a form/Python script that actives when a button is clicked. what are the steps you need to take? I tried the example callscriptfromnet from https://github.com/Esri/arcgis-pro-...
0
votes
0answers
26 views

Quadtree based polygon indexing? (Python/Java)

I was wondering how to best represent the inside of any given polygon (GeoJSON coordinates) with some sort of indexing, like a grid or quadtree? See image below for an approximation of what I have in ...
1
vote
1answer
58 views

Open Data Cube how to continue after the creation of the database?

I have some questions about using Open Data Cube. First of all I have successfully installed the virtual environment with miconda and the database with PostgreSQLPortable-10.1.1. Now I have already ...
1
vote
0answers
25 views

QGIS 2.18 - Can't get click coordinates from mapCanvas

Trying to get click coordinates from map canvas but code is not working. Newbie for Python, pyqgis, pyqt I already check these topics but still code is NOT working 1 - QGIS 3 Get coordinates from ...
1
vote
0answers
30 views

qgis.core import to Python 3

I had a pure Python 3 configured for myself and recently installed QGIS (just QGIS, not OSGeo4W). I need to keep my initial Python 3 but also add qgis.core module. Can it be done with no harm to my ...
0
votes
0answers
39 views

Writing only one of the input vector fields to output vector using Fiona/ Python?

I'm working on a function to perform operations on folders of vector files. These files might have differing attribute fields but there will be a common field between them. I'm using fiona in python ...
1
vote
1answer
38 views

Running a non-QGIS Python 3 script within QGIS 3.4 processing toolbox just like that of QGIS 2.18

I've written around 30 scripts (both QGIS and non-QGIS scripts) in Python 2.7 and using it through QGIS 2.18 "Processing -> Scripts" tools so that within our office we can share and use the scripts. ...
0
votes
1answer
50 views

Python geopandas dataframe of polygons — determine nearest neighbor polygon?

I am trying to figure out how to dynamically create expanded regions of interest based on polygon geometries in geopandas until some threshold is satisfied (essentially custom regions across the ...
0
votes
0answers
23 views

Python error after opening QGIS

Downloaded QGIS 3, downloaded Grass 7. Opened QGIS version 2.18.21. I get the following error message: 2019-03-27T19:42:38 1 Traceback (most recent call last): File "/Users/CMM/.qgis2/...
1
vote
1answer
58 views

Renaming columns using geopandas - issues with data table in Arc

What I'm trying to achieve: Read in an existing ESRI polygon shapefile Drop an attribute Dissolve by another attribute Rename columns Reorder columns Write out as new shapefile What works: Drop ...
1
vote
0answers
15 views

Qgis python ComboBox: Combination of fixed and free Items

I want to built a ComboBox to select a given plotting scale out of a list or ask for a different scale (e.g. '1:625') as Textinput in the same ComboBox. The combobox is changed to 'editable' and I'm ...
1
vote
1answer
40 views

Delaunay triangulation algorithm in shapely producing erratic result

I would like to triangulate the following polygon: The wkt for the geometry is given as follows: POLYGON ((3 0, 2 0, 2 0.75, 2.5 0.75, 2.5 0.6, 2.25 0.6, 2.25 0.2, 3 0.2, 3 0)) I ran this code to ...
0
votes
0answers
51 views

Flipping raster with Python

I am trying to calculate summary statistics for a raster file. I am encountering a problem when loading my raster into Python. When I load the raster and I plot it, it is flipped 180 degrees. This ...