Questions tagged [python]
Python is an open source interpreted programming language used in many GIS programs.
12,249 questions
0
votes
0
answers
3
views
How to extract layer list in ArcGIS 10.9.1 Standalone Server?
We have an Standalone ArcGIS Server 10.9.1 environment.
The objective is to fetch layer list within all services using arcpy or python API.
I did found some help articles and stack results, but can't ...
1
vote
1
answer
51
views
Natural Breaks (Jenks) classification using Python
I am classifying a PlanetScope Imagery into 3 classes (water, non-water and mixed) using NDWI. Natural breaks (Jenks) worked the best for me when I tried different data classification methods in ...
0
votes
1
answer
20
views
Uploading style (SLD) to GeoServer using REST API not working - for empty workspaces
I am trying to upload a layer using the GeoServer (2.28) REST API using the Importer extension in python. I ak not not what I am doing wrong.If I use the PUT method when the sld does not exists in an ...
4
votes
1
answer
87
views
Why does gdal.Warp create a black region on the sides of some rasters when it reprojects and cuts them?
I have a JPEG of a red square, example.jpeg.
I use it as webmercator tile 6/36/16. I georeference it accordingly, using the bounds of 6/36/16 (I calculated them like this – details are irrelevant to ...
3
votes
1
answer
80
views
Truncate layer in ArcGIS Online using arcgis.gis
I'm trying to delete all features in a layer hosted in ArcGIS Online.
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
#Login AGOL
gis = GIS("https://www.arcgis.com", &...
2
votes
0
answers
40
views
Efficient spatial join with OvertureMaps GeoParquet in SedonaDB
I want to check if points is contained in buildings and if so, join the buildings' attributes to them.
I looked through:
https://sedona.apache.org/sedonadb/latest/quickstart-python/
https://sedona....
0
votes
1
answer
29
views
Why is fiona.open causing a PermissionError?
I'm working on a flask app that takes a geojson file and returns a shapefile. Currently it is giving me the error PermissionError: [Errno 13] Permission denied: 'C:\\Users\\john\\Desktop\\...
0
votes
0
answers
71
views
What criteria could be used to automatically identify lakes in a DEM?
I have elevation data as a DEM PNG image and would like to automatically detect lakes. I have tried to use the following criteria:
Lakes are areas of adjacent pixels of equal grayscale color.
Pixels ...
5
votes
1
answer
195
views
Skeletonize or extract lines from segmentation image
I have this raster:
which I'd like to convert to vector data (linestring) (e.g. a Shapefile).
To this end, I'm using this Python code:
import rasterio
import geopandas as gpd
from skimage.morphology ...
0
votes
1
answer
57
views
Windows 11 pytorch installation error
I am following this tutorial to install GeoSAM plugin for QGIS.
As I removed my old QGIS and installed the latest LTS version through OSGeo4W installer it seems that at some point the old installation ...
2
votes
1
answer
95
views
Overcoming temporary file writing error in GDAL
I am trying to use a Python package called hydrosar to apply a water mapping algorithm to a Sentinel-1 image. I am getting the following error:
Attempt to create new TIFF file C:\gdal_temp\tmp_xxxxx ...
3
votes
1
answer
86
views
Issue plotting orthographic projection with GeoPandas
I'm getting an issue plotting countries in an orthographic projection with GeoPandas. It can be seen as a cut through Russia at the top of the image (white in the country and green in the ocean). I ...
1
vote
0
answers
66
views
Running Python script before PostgreSQL authentication in QGIS
I'm working with PostgreSQL in QGIS and have a Python script that runs when the QGIS session starts.
Right now, the PostgreSQL connection requires authentication first, and only after that, the Python ...
1
vote
0
answers
56
views
Reading file from Google Cloud Storage with rasterio
I try to open a file from Google Cloud Storage (a cloud-optimised geotiff) using rasterio directly without downloading the whole blob manually. In this example, I simply want to download the number of ...
0
votes
1
answer
50
views
ogr2ogr on ArcGIS Feature service - migrate to use gdal.VectorTranslate
I currently have a working console command, which translates an ArcGIS Feature Service to a geopackage.
The command line is as follows (where ive just replaced the full with the word 'url':
ogr2ogr -f ...
0
votes
1
answer
48
views
arcpy PointsToLine produces no output and no error
I have a situation where the arcpy tool PointsToLine silently fails. Ie, it produces no output and no errors.
My script runs the following code:
arcpy.PointsToLine_management(position_history_lyr, ...
2
votes
1
answer
86
views
Raster and Vector data match in QGIS but do not match in Python
I am working with imagery from Pleides Neo3. I have some raster data in geotiffs and a vector mask as a .GML file.
When i open these files in QGIS, the raster and vector data are aligned.
The ...
2
votes
1
answer
92
views
Embed custom properties or variables to geopackage file/layer
Is it possible to embed custom properties or custom variables on a layer/geopackage file to be used on different projects ?
I tried layer.setCustomProperty('key', 'value') but this is only visible on ...
2
votes
1
answer
150
views
Is GeoPandas is_valid_reason method the same as shapely explain_validity?
I've come across both geopandas.GeoSeries.is_valid_reason and shapely.validation.explain_validity, and I'm wondering if they are the same (i.e. if the same checks / the same code is executed under the ...
0
votes
1
answer
89
views
Editing Python code to fix errors [closed]
I have the error:
Traceback (most recent call last): File "_________ (removed personal data) default/python/plugins\SDEllipse\SDEllipse.py", line 127, in run self.dlg.progressBar.setValue(0....
1
vote
1
answer
60
views
Rasterio: rasterize in 10 band?
I'm working with two inputs: a 10-band raster and a shapefile with polygons constructed over this raster. To create a mask of regions in the raster overlapped by the polygons, I use the following:
...
1
vote
1
answer
145
views
Remove overlapping polygons but keep the top-most overlap using Python [closed]
I have a huge dataset of about 1 million+ features, of which many are overlapping. I would like to remove all the overlaps in each instance of overlap, but keep to top-most polygon.
This is for a ...
0
votes
3
answers
87
views
Simplify geometry originated from viewshed raster image
I am doing a viewshed analysis on a DEM .tiff file. I would like to convert the viewshed raster into vector geometry in the format of .geojson, which i have achieved, although, the result is not good. ...
2
votes
1
answer
175
views
Efficiently remove holes from complex polygons while preserving geometry
Problem
I have a polygon dataset containing many features with holes of various sizes. For my downstream modeling workflow, I need polygons without any holes. The challenge is to remove these holes ...
1
vote
0
answers
45
views
How to generate raster layers interactively through Streamlit
I am trying to create an interactive map through Streamlit running on Python based around a building footprint shapefile layer, where I can use these building footprint shapes to generate buffer ...