All Questions
12,327 questions
0
votes
0
answers
18
views
Convert raster (.tif file) to .txt
I am new to Python. I managed to write the code to convert only one raster to .txt format (xyz coordinates) and it works beautifully.
But the problem is that I need a code that will convert multiple ...
0
votes
0
answers
28
views
Disaggregate point data by weighted value
I have Malaysia property exposure data that is geocoded to postal code centroids. I want to disaggregate this data using LitPop (https://www.research-collection.ethz.ch/handle/20.500.11850/331316) or ...
-2
votes
0
answers
24
views
Permission denied for database datacube [closed]
I am trying to run a file in a Google Colab but I am getting a error like I can't access the database datacube. What should I do?
Initialising database...
Traceback (most recent call last):
File &...
-3
votes
0
answers
70
views
SETTING AN EXPRESSION IN DEFAULT VALUE DIALOG BOX OF ATTRIBUTE FORM [duplicate]
I am trying to write a Python script to give an expression in default value dialog box in attribute form for a field I tried some of the methods like creating a widget and trying to pass a value ...
0
votes
0
answers
26
views
QGIS ignores argument "direction_range" for GRASS r.viewshed
I am trying to run the GRASS tool r.viewshed in QGIS. The GRASS tool includes an optional parameter direction_range which lets you analyse a specific horizontal angle range. In the QGIS GUI this ...
0
votes
0
answers
43
views
Updating a PostGIS layer from a geopackage layer with additional features [closed]
I have a layer named polygon in my PostGIS database. I would like to perform an update and append on the database layer using a geopackage layer that contains additional features to the ones in the ...
0
votes
1
answer
26
views
Masking an AOI using shapefile: Set SHAPE_RESTORE_SHX config option to YES to restore or create it [closed]
I have a .shp file I want to use as a mask on top of a .tiff satellite image which has a specified AOI, so I need to adjust the .shp file to that.
I found this doc, but I am confused on how it can ...
1
vote
1
answer
64
views
Calculate percentage of overlap between a polygon and raster in Python
I have multiple polygons and a raster of one area. I need to calculate percentage of polygon that overlap the pixel. I need to do this for each pixel.
This is what i have tired
import rasterio
from ...
-1
votes
0
answers
25
views
Authentication issue accessing Satellogic Open Dataset
I’m trying to access Satellogic’s open dataset for Earth observation. I came across their Open Data Program here and found an example using Python to interact with the dataset via a script.
Here’s the ...
2
votes
1
answer
51
views
QGIS 3.36-3.40 that same error: AttributeError: 'NoneType' object has no attribute 'write'
Does anyone know how to fix this? (chatGPT and other AIs recommend crap).
On QGIS 3.40 (as well as 3.36) start:
An error has occurred while executing Python code:
AttributeError: 'NoneType' object has ...
0
votes
1
answer
28
views
Get the 3D centroid of a GeoDataFrame
I have a 3D GeoDataFrame (GeoPandas 1.0.1) that I'd like to extract the 3D centroid from.
Currently, this is not working because it drops the 3rd dimension:
from shapely.geometry import Point
import ...
0
votes
1
answer
40
views
Extract multiple bands into one image with rasterio
I want to extract a set of images from Sentinel-2 L2A, containing 12 bands, all resampled to 10 m/pixel, in .tiff file format.
The code is composed of parts taken from this documentation mainly ...
2
votes
1
answer
66
views
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 3" error when reading GeoJSON into GeoDataFrame with non UTF-8 encoding
Is it currently possible to read a simple GeoJSON file which has non-utf8 encoding for certain field names and/or field values in GeoPandas v 0.14.2? Here's an example:
{
"type": "...
1
vote
1
answer
34
views
How to make a Daytime Convection RGB from Himawari-9 NetCDF
I'm trying to make an RGB image from Himawari-9 NetCDF using the Daytime Convection Recipe through Python centered in one part of the Philippines. I have downloaded the individual near-IR and IR bands ...
0
votes
0
answers
37
views
QGIS automatically name a file after multiple specific attribute values
I'm trying to get an answer how to create a python code that allows me to pick multiple attributes from another file and rename the shapefile I eventually get at the end of my model in the QGIS model ...
0
votes
0
answers
21
views
How to download imagery to a Google Drive folder using GEE Python API given new constraints on Google Cloud projects
I am currently trying to update a Python script that uses GEE API to request Landsat imagery. Before the introduction of Google Cloud Projects, I used the command ee.batch.Export.image.toDrive(**...
2
votes
1
answer
75
views
Method to subset a GeoTIFF image based on pre-defined grid
I have a GeoTIFF image of an agricultural field and surrounding area that I'm working with in QGIS. I've defined a couple of grids in QGIS to generate zonal stats for target plant sets. This has ...
0
votes
1
answer
90
views
Trouble getting SAGA to work in QGIS 3.4 for Mac
I have been trying to get the SAGA toolbox to work in QGIS 3.4 but it does not show up. I have downloaded the SAGA Next Gen plugin for QGIS, and I have also downloaded SAGA from SourceForge and set ...
0
votes
0
answers
34
views
Converting Python Script to .exe and Handling Complex Spatial Dependencies
I'm trying to convert the following Python script to an executable (.exe) file
import tkinter as tk
from tkinter import filedialog
from PIL import Image, ImageEnhance, ImageTk, ImageOps
import numpy ...
0
votes
0
answers
21
views
How to convert OLCI Sentinel 3 .nc file to GeoTIFF composite
I have downloaded level 2 data from https://data.eumetsat.int/data/map/EO:EUM:DAT:0407?start=2021-02-15T18:39:00.000Z&end=2024-10-30T18:39:40.167Z&facets=timeliness%7CNT&bbox=-89.6,30.05,-...
0
votes
1
answer
97
views
pip3 upgrading Python dependencies - SSL error (unsafe legacy renegotiation failed)
I'm trying to update some Python dependencies (mainly the remotior-sensus) using OSGeo4W, installed with QGIS 3.34.9. This is using Python 3.12.4.
I'm following instructions on this site: https://...
2
votes
1
answer
55
views
Merging collinear sides (a.k.a. deleting collinear vertices) of a Polygon or LinearRing in Shapely
If two Polygons have partly overlapping sides, a union of these Polygons is a Polygon with collinear sides/vertices. Is there a method to merge those sides by deleting the middle vertex? I thought ...
0
votes
0
answers
51
views
Concatenating Pandas dataframes into one GeoPandas dataframe
I am trying to concatenate three geodataframes with different CRSs. Before that I made sure I convert them to similar CRS (4326) as follows but still the concatenation is not working. What is wrong?
...
1
vote
1
answer
38
views
Resizeable rectangle on a map
Using ipyleaflet, I put a rectangle on a map and I have a callback when I move the shape around but I don't figure out how to add a callback when I resize the same shape. Any idea ? Ultimately I would ...
1
vote
1
answer
41
views
Intersecting by largest area with GeoPandas
I intersect by the largest area as a filter and then merge.
Then I used GeoPandas 0.14.
overlay_gdf = left.overlay(right, keep_geom_type=True, how="intersection")
overlay_gdf = (
...
0
votes
0
answers
22
views
Images with different bounding box overlaps with each other with the same CRS
I was working with 3D point clouds and converted them into 2D images. Initially, I made an error when applying a geotransformation to the images. Specifically, I incorrectly set the top-left Y ...
0
votes
0
answers
41
views
KDE heat map raster produced from points shapefile does not resemble actual points [Python]
I have the following shapefile of points, laid over a shapefile of New York City's boroughs, viewing in QGIS:
I tried to make a KDE heat map raster layer based on these points, simply showing the ...
0
votes
1
answer
48
views
Create a data deployment pipeline with ArcGIS Online feature service
To date I have created many workflows that involve programmatic deployment of new data to AGOL Feature Services using the API and Python. The inherent issue with this is the potential for failure of ...
1
vote
1
answer
38
views
How to save raster as int16 / compressed using SaveGDAL from richdem
I am using the python package richdem to calculate a slope map from my DEM file.
dem_file = richdem.LoadGDAL(os.path.join(output_dir, f'DEM_{region_name_clean}_EPSG{EPSG}_resampled.tif'))
slope = ...
0
votes
0
answers
39
views
How to plot weather data using Earthkit-plot
I am also working on a weather project for that I must extract some weather data out of GRIB file folks say it's gridded binary file where the data about whatever whether parameter is provided to you ...
3
votes
2
answers
314
views
How to reduce the precision of a shape without creating duplicated points?
I need to provide the description of a field to the EUDR reporting system. In the description of the regulation the rules specify "6 digits precision" on geospatial coordinates. As we are ...
0
votes
0
answers
25
views
Create a UGRID-compliant 3D deformed grid NetCDF file (in Python) to be read by QGIS
My data consists of four 200 x 200 x 50 tensors,
xgrid: E-W coordinates
ygrid: N-S coordinates
zgrid: Depth coordinates
scalar_field: A scalar field array.
The scalar field array represents values ...
0
votes
0
answers
41
views
How to read attached object data of points in DXF
I'm reading a DXF with ezdxf module in Python.
Some entities have attribute data, xdata and object data.
I'm able read attribute and xdata, but how to read the attribute data?
dwg = ezdxf.readfile(...
2
votes
1
answer
118
views
Multilinestrings to Linestring using Python
I have a geodataframe (download link) that contains the geometry of bus lines. It is a Multilinestring. I need to transform the geometry into a single Linestring.
My first idea was to use .explode (...
0
votes
0
answers
45
views
Huge file size after resampling
I want to co-register a DEM file with 100m resolution with a landcover file of 10m resolution. Thereby the DEM file is resampled to match the 10m resolution.
Obviously, the file size of the new DEM ...
0
votes
0
answers
18
views
Py3DTiles to create terrain mesh
I have a las file and want to use py3dtiles to make it a suitable format for cesium.
Ideally, I'd like to create a terrain mesh, the documentation https://py3dtiles.org/v8.0.2/api.html mentions mesh, ...
4
votes
1
answer
226
views
Finding overlapping polygons in the same shapefile using GeoPandas
I want to find overlapping polygons in the same shapefile. I am using parcel data.
I am using
intersection_gdf = gpd.sjoin(parcels_gdf, parcels_gdf, how='inner', predicate='intersects')
but the ...
2
votes
1
answer
48
views
Retrieving short names of datum accepted in pyproj
I can compile a list of available datum names in pyproj using EPSG codes:
import pyproj
from pyproj.crs import Datum
from pyproj.enums import PJType
auth = "EPSG"
epsg_codes = pyproj....
0
votes
1
answer
31
views
Unknown layer exception when downloading WMS chip with owslib
I'm attempting to download an image-chip from the Dutch hires imagery WMS, using owslib. The WMS URL is https://service.pdok.nl/hwh/luchtfotorgb/wms/v1_0?request=GetCapabilities&service=wms.
wms = ...
6
votes
1
answer
127
views
Add extra vertices on LineString where they cross Polygon edges
I have two GeoPandas GeoDataFrames; one containing Polygons, and the other LineStrings:
Corresponding sample data:
import geopandas as gpd
from shapely.geometry import Polygon, LineString
gdf1 = gpd....
1
vote
1
answer
90
views
How to buffer, merge and save large spatial data from PostGIS to shapefile
I am using a PostGIS database (PostgreSQL 14, PostGIS 3) where I have a table layer_polygons containing layer polygons. It has a column geom containing the geometries and 5 columns for attributes ...
1
vote
0
answers
49
views
Point with polygon join returning a polyline
I'm new to spatial coding and I am trying to do a spatial join between a shapefile that has point information and a shapefile that has polygon information. The output should be a shapefile with the ...
0
votes
0
answers
18
views
Read OGC WMS tile data with Mapnik
I am using Mapnik 3.1 with python-mapnik 3.0 and would like to have a WMS layer in my program. Users should be able to add a WMS server and see the image data of the WMS layer from that server as ...
2
votes
1
answer
68
views
QGIS Expand rule-based symbology with multiple levels using python
Using Python, I want to expand a rule-based symbology with multiple rule-levels in the table of contents.
I tried using the following code, but it expands only the first rule, but not the subsequent ...
0
votes
0
answers
58
views
Rasterio affine transform pixel size meaning
I'm using calculate_default_transform and reproject from rasterio.warp to transform geotiff file from one coordinate reference system (EPSG:25832) to another (EPSG:3857). As a result the pixel size ...
2
votes
1
answer
50
views
Extracting linework from a GeoDataFrame
I have raster data where each pixel is assigned a feature id and the features form connected pixel regions. We could think of this as a rasterized map of different countries.
raster = np.array([
[...
3
votes
1
answer
63
views
Extract raster subset from another one using OSGeo OGR Geometry in Python
IMPORTANT! Please note I don't want to use shapely, rasterio, geopandas or any other level of abstraction there is.
I have generated multiple polygons such as these:
For every polygon (in the ...
1
vote
0
answers
31
views
ArcGIS Online layer - delete/replace rows through python - file size ballooning
We had a consultant write a Python script for us a few months back. Part of the script takes a feature layer from an enterprise geodatabase and overwrites the data in an ArcGIS Online layer. Someone ...
1
vote
1
answer
36
views
Buffer function and Projection [closed]
I've got a geopandas (EPSG:4326) that when I plot, this is the result (a road intersection):
What I'm trying to achieve is to "trim" these geometries around the center of the intersection. ...
0
votes
0
answers
34
views
True comparison of country sizes when plotting GeoDataFrame of countries with matplotlib
When plotting subplots of different countries, the axis ratios are not the same among subplots, showing the countries with incorrect sizes.
Kenya is much bigger than the others but shows as big as the ...