Skip to main content

Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

How to read and plot multiple MODIS_L3 data (MYD08) in Python [closed]

I am working on MODIS data (MYD08) and I want to read and plot this data in Python. I have installed the libraries such as h5py and pyhdf, but I am still unable to read the file. Is GDAL useful to ...
Riya Mahendra's user avatar
0 votes
1 answer
28 views

Looping through folders to find shapefiles and then merge them

I am trying to merge shapefiles into one shapefile by looping through folders. I merge them one by one by iterating through each file then merging it with an empty gdf that I set with columns that are ...
Daniel Scharton's user avatar
0 votes
1 answer
28 views

Combine dissolve aggfunc and lambda function

I am looking to aggregate different polygons and applies analytical functions at the same time. I have tried: df.dissolve(by=['ville','arrondissement','quartier'], aggfunc={'transaction':'count','...
bravopapa's user avatar
  • 485
0 votes
0 answers
22 views

Python Error on QGIS 3.34.X

I installed QGIS on my computer but it encounter a python error as show below. I am not an expert on GIS. 2024-06-21T15:19:19 WARNING Python error : Couldn't load plugin 'rastertool' due to an ...
Spokesman1's user avatar
0 votes
0 answers
24 views

Landsat 7 NDVI errors?

I calculated NDVI using a method from a previous question I asked. I forgot that Landsat 7 has errors following 2003. I don't mind running it again but is there ways to correct for this error? # Start ...
Daniel Scharton's user avatar
0 votes
0 answers
58 views

ArcPy function produced None values in multiprocessing

I'm trying to get my script in multiprocessing, but the arcpy.management.CalculateGeometryAttributes produced None values. I tried it in for loop and it worked perfectly fine. import os import ...
Hieu Tran's user avatar
-3 votes
0 answers
25 views

how to provide a script code for downscaling a climate data of a given station using PRIDICTOR DATA? [closed]

how to provide a script '''code''' for downscaling a climate data of a given station using PRIDICTOR DATA, FOR SDSM MODELS Data analysis?
shako's user avatar
  • 1
2 votes
1 answer
49 views

Calculating NDVI from Landsat data

I have multiple folders containing landsat data from different years . I have been just testing Landsat 5 before doing them all but I feel as though something is wrong with the code. def ...
Daniel Scharton's user avatar
1 vote
1 answer
21 views

Opening rasterio datasets in threads

I have an application that requires opening a lot of GeoTIFFs, and I would like to do it concurrently. Basically, I am calling rasterio.open() in each thread and storing the resulting DatasetReader ...
eba's user avatar
  • 13
0 votes
0 answers
11 views

Clipping MODIS HDF file in Python

I am trying to clip MODIS Land Surface Temperature in Python for a defined extent. Even though the files have been clipped, the size (X x Y) of the new file is changed. So when I plot the new data, ...
Ashish Ganesh's user avatar
0 votes
1 answer
32 views

GeoPandas error: AttributeError: You can only set the value of existing options

When I try to set pyogrio globally like this: gpd.options.io_engine = "pyogrio" I get the error: AttributeError: You can only set the value of existing options This however works: test = ...
i.i.k.'s user avatar
  • 1,679
0 votes
0 answers
32 views

After installation of pyogrio Could not detect PROJ data files. Set PROJ_LIB environment variable to the correct path. when importing gpkg

When I import a geopackage with only geopandas all is fine, however, if I try to use pyogrio like this in my jupyter notebook: gpd.options.io_engine = "pyogrio" network = gpd.read_file(r&...
i.i.k.'s user avatar
  • 1,679
0 votes
1 answer
42 views

How to use the gdal_edit tool from GDAL installed within Anaconda?

I intend to modify the color interpretation of raster bands using the gdal_edit tool(https://gdal.org/programs/gdal_edit.html#gdal-edit), and I have found relevant commands online to accomplish this ...
苏云明's user avatar
3 votes
2 answers
197 views

Getting GeoSeries with all the points and their coordinates from GeoSeries that has multiple types of geometries in GeoPandas

I'm writing a program that reads two MultiLineString shapefiles and intersects them, then processes the result in various ways. The intersection normally will give me a GeoSeries of points, like this: ...
cfnnm's user avatar
  • 33
0 votes
1 answer
41 views

How to use a python virtual environment on QGIS?

I'm currently developing a QGIS plugin and I want to use pydantic in this plugin. I'm currently using python 3.12 and QGIS 3.36. It is not recommended to install package in the python system ...
Jérémy O.'s user avatar
0 votes
0 answers
28 views

How can I use python to zip a file geodatabase and add it as an item to AGOL?

I have a script that serves to update a hosted feature layer. Due to recent breaks in the append function from the api, I have transitioned to creating a filegeodatabase using geopanads, uploading ...
Austin Averill's user avatar
1 vote
3 answers
56 views

How to merge multiple GeoTIFFs into one single GeoTIFF and change the resolution

I'm working on my Bachelor Thesis right now and I have a about 300gb of digital elevation database. This database has a 1m resolution and every single 1x1km square is stored into a single GeoTIFF. Now ...
Robin's user avatar
  • 21
1 vote
0 answers
38 views

Drawing a centerline through a polygon using Python libraries [closed]

I want to draw a CENTERLINE through a polygon using Python libraries. The current tools and libraries provide ways to draw the "Medial Axis" BUT I want the centerline to go all the way to ...
Evelyn Jeong's user avatar
0 votes
0 answers
22 views

Testing for joint spatial clustering across multiple variables

I have an analysis that I'm uncertain how to conduct. I have a GeoPandas dataframe that consists of a few hundred sample points (rows) and for each point I have counts of different variables. These ...
clifgray's user avatar
  • 409
2 votes
1 answer
37 views

Projection with transformation returns unexpected results using GeoPandas compared to ArcPy

I am using GeoPandas to project a geodataframe of polylines representing water crossing locations across the USA from ESRI:102039 (NAD 1983 USGS Contiguous USA Albers) to ESPG:3857 (WGS 84 / Pseudo-...
mafbarth's user avatar
0 votes
1 answer
47 views

MultiPolygon to Polygon in Python [closed]

I need to change geotype from MultiPolygon to Polygon. Most of the original features are Polygon, but are automatically imported through API as MultiPolygon. How can I change all the types ...
Ilya's user avatar
  • 1
0 votes
1 answer
32 views

Finding which element of shapely geometry satisfies a predicate

I'm looking for an element of a geometry, which satisfies a predicate, e.g. intersection. Here is a code snippet: from shapely import * p0 = Polygon([(0, 0), (0, 4), (4, 4), (4, 0), (0, 0)]) p1 = ...
Paul Jurczak's user avatar
0 votes
0 answers
37 views

Getting aspect-ratio of shapely rectangle

This snippet calculates an aspect ratio of a rectangle not constrained to be parallel to the coordinate axes: from shapely import * rect = oriented_envelope(LineString([(1, 1), (5, 1), (10, 10)])) p0 ...
Paul Jurczak's user avatar
0 votes
0 answers
38 views

Open File in Gdal with from Smb in Python

How can I open a file in GDAL from a SMB (or CIFS) server without storing the file in memory? I want to do something like this: import smbclient from osgeo import gdal with smbclient.open_file('//...
Math-dude's user avatar
0 votes
0 answers
19 views

Colouring MapInfo polygons from Python

I'm using rasterio and geopandas to generate MapInfo TAB files. The resulting file contains a lot of polygons (~10 000). Here is the function I use: with rasterio.Env(): with rasterio.open(...
Riuss's user avatar
  • 1
0 votes
0 answers
25 views

I want to assign numeric values to grid squares from the 50m by 50m fishnet grid I created based on the wind installed capacity in a 20km of a point

I am working in QGIS while writing code in Pycharm. I have to select suitable sites for BESS locations in Germany. Currently I am looking into the state of Saxony-Anhalt. Firstly, I narrowed down on ...
Zeenat Khan's user avatar
0 votes
1 answer
27 views

Creating custom projection in pyproj

I'm working on program that converts WGS-84 (ITRF-2005) to local coordinate systems. I have file with transform parameters looking like: #СК-63(С2) 0 0 0 <999632> +proj=tmerc +lat_0=0 +lon_0=27....
Vanyaxxl's user avatar
0 votes
0 answers
85 views

Issue with custom QGIS process algorithm

I have a written a custom processing algorithm which iterates features within one vector layer and eliminates polygons in the second that are within each feature from the first under a specific size. ...
Steven Price's user avatar
-1 votes
1 answer
48 views

Removing 0 and NULL columns in a geopackage [closed]

I have multiple geopackages with columns containing a mix of 0 and NULL fields. I want to remove these columns where there is no value above 0. I cannot do this manually as each geopackage has 90-100 ...
ashlaff's user avatar
  • 25
0 votes
1 answer
51 views

How to round or limit the number of decimals in geodataframe

I need to limit or round decimals in my GeoDataFrame so that when importing to a shapefile and opening a file in QGIS, the number of decimals remains the same as in the dataframe. In GDF looks like: ...
Ilya's user avatar
  • 1
0 votes
1 answer
11 views

Folium keep_in_front not working for TileLayer when mixed with other layer types

I am trying to add the TileLayer for the map labels on top of other overlays in Folium. The keep_in_front command keeps the labels on top of the other TileLayers, but not on top of the other overlays (...
Olivier's user avatar
  • 419
0 votes
0 answers
34 views

Creating a single, large mosaic file in S3 from tiles that cannot fit into memory?

I'm trying to form a (very) large mosaic raster from constituent files in S3, and the amount of data is extremely large; I'm not sure on the actual size, but let's say it's really huge, say over a TB. ...
Doug MacArthur's user avatar
0 votes
0 answers
25 views

ArcGIS 106385 "Workspace or data source is read only" when using multiprocess to intersect a featureclass on a network drive

I use arcpy.analysis.Intersect to bring data (specific to my study area) housed on a network drive to my local machine for analysis. Sometimes the study areas are quite large, and so I break them up ...
Matt's user avatar
  • 760
1 vote
0 answers
26 views

cgohlke gdal wheels - early version location

Problem: I recently found out that cgohlke gdal wheel site was taken down and redirected to a github repo. Though, I am unable to locate gdal.whl files that predate v2023.1.4 (3.6.1), even though PyPl ...
Binx's user avatar
  • 1,380
1 vote
1 answer
33 views

Plotting ImageOverlay on Folium maps fails

I'm making a project. I need to open a local GeoTIFF file and load it into the Folium map with PyQt5. For now, instead of GeoTIFF, I took a numpy array. If it is 500,500,3 shape, everything is fine. ...
CruelBrutalMan's user avatar
0 votes
0 answers
16 views

OData Copernicus API single bands

I'm writing a python pipeline to download and process some S2 data and I am using the Copernicus API for the download part. As I only need two bands (B04 and B08), I was wondering whether it's ...
EAlbergo's user avatar
-1 votes
1 answer
52 views

Python script equivalent to QGIS Generate XYZ tiles (Directory) function

I have been using QGIS Generate XYZ tiles (Directory) tool which outputs my raster to XYZ tiles nicely! However, I now want to do this outside of the QGIS environment entirely (so no QGIS involvement)....
guest_231213's user avatar
0 votes
0 answers
25 views

Compressing GeoTiff with Rasterio

I am trying to process several GeoTiffs from Landsat satellite. I wrote a function for clipping and then wanted to use compression on the output bands. However I try it, the compression is just not ...
Tereza Pohanková's user avatar
0 votes
0 answers
24 views

Error: Number of pixels in mask does not match predictions size in Python/Rasterio workflow

I have implemented a random forest model using scikit-learn and Rasterio in Python to predict pixel values within a shapefile containing multiple polygons. However, I'm encountering an error:...
user30985's user avatar
  • 357
0 votes
1 answer
40 views

Can't change geometry in GeoPandas

I have an extremely strange issue with my code. I have a dataframe with 2 columns with point geometries, startgeom and endgeom. I want to assign a geometry from startgeom, do some calculations and ...
Geocarto's user avatar
-4 votes
2 answers
81 views

How does one resample a 20m resolution satellite image to 10m resolution, such that it matches a native 10m resolution image?

I am trying to use Python to perform my GIS analysis. Background: I have 2 satellite images, one with 20m resolution and a second with 10m resolution. Goal: Have both satellite images at 10m ...
tds's user avatar
  • 91
0 votes
0 answers
26 views

How to make PyQGIS to return 4 raster subdivisions calculated by inequations

I've been making in Raster Calculator, one by one, for every Return Period (2, 5, 10, 50, etc.) different sub-rasters of 4 sections of water depth, it's very tedious and I know there is a faster way ...
Alex C's user avatar
  • 1
2 votes
1 answer
39 views

Remove OGR_STYLE field while/after writing

I'm using an OGR_Style field to set the styles for a MapInfo Tab file with Geopanadas. Does anyone know if there's a way use the OGR_Style field for styling but not include it as a field in the file?
Prosper's user avatar
  • 83
4 votes
1 answer
93 views

Integrating an External Python Script into a QGIS Project Macro

Is it possible to integrate an external Python script into a QGIS project macro? I have a relatively large macro that executes various Python commands at the start and end of the project. For better ...
MartinMap's user avatar
  • 8,328
2 votes
0 answers
63 views

Remove side branches from linestring

I'm trying to create a centerline from a (curved) polygon. To do this I'm using the PostGIS ST_ApproximateMedialAxis tool. However, this creates a lot of side branches, whereas I only want to keep the ...
eve's user avatar
  • 21
0 votes
1 answer
86 views

Export Feature as GPX from Virtual Layer Using Right-Click in QGIS

I want to export a feature (line/multiline) as GPX using a right-click in the canvas. The feature to be exported is in a virtual layer (e.g., "RoutenUnion"). The clicked feature is in ...
MartinMap's user avatar
  • 8,328
2 votes
1 answer
66 views

How could I set 8CONNECTED into gdal.Polygonize()

I've seen in several web pages and examples the next snippet: gdal.Polygonize(band, maskband, polygonizedLayer, ndField, [], callback=None) but I don't understand how to use the options parameter. In ...
Francisco Ruiz's user avatar
0 votes
1 answer
33 views

How to upsert LineString in ArcGIS python via CSV (or other suggestion?)

I have been working on an ETL process to push / upsert my data from PostgreSQL into ArcGIS Online into a lines feature layer to be included on a WebMap. I have had no problem with using essentially ...
Eric Davis's user avatar
2 votes
1 answer
34 views

gdal.Translate producing error

I'm running a Python script that uses gdal.Translate to set an area of interest. I believe that the important parts are: from osgeo import gdal, osr, ogr # ... translate_options = gdal....
Ubron Cinzento's user avatar
0 votes
0 answers
73 views

Remove the zero values from a raster using Python

I am trying to remove all the 0 value pixel from the raster, but whenever I am trying to do, 0 values still exist. I am mainly trying to do is, I have 4 raster in a folder. I have to pick all the no ...
Koushik Ghosh's user avatar

1
2 3 4 5
244