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

How to create WCS 2.0.1 GetCoverage request using OWSLib?

I have access to a locally deployed GeoServer with enabled WCS 2.0.1. I connect to the service by calling from owslib.wcs import WebCoverageService wcs = WebCoverageService( url='https://example....
rbaleksandar's user avatar
-1 votes
0 answers
14 views

'ImportError: attempted relative import with no known parent package' when QGIS-Plugin code running in PyCharm

I have created a 'raw' plugin with the pluginbuilder. The structure is as follows: It runs perfectly when opened in QGIS. However, when I open the plugin-folder as a pycharm project and run the ...
i.i.k.'s user avatar
  • 1,753
0 votes
1 answer
47 views

How to import other scripts in the same folder?

I'm writing a PyQGIS script and I would import in my script other external scripts. I tried in this way but the code doesn't work. from PyQt5.QtGui import * from PyQt5.QtCore import * import ...
Salvatore Diolosà's user avatar
0 votes
1 answer
40 views

Generalize/Denoise Multipolygons [duplicate]

I am looking for any Python function, that is able to denoise the area to become more spatially homogenous. In other words, I would like to vanish all small polygons beyond some tolerance. Maybe ...
Luckasino's user avatar
  • 293
0 votes
0 answers
38 views

GDAL Warp extremely slow on Python API

I am trying to export one VRT to TIFF using GDAL Warp. My VRT has some scale, offset, reprojections, etc, but nothing too crazy. I have observed that trying to perform the warp from the Python API is ...
Guillermo Moreno Castaño's user avatar
1 vote
0 answers
34 views

cellSize calculation in Python

To create a raster file of cell size, which is similar to the function of cellSize function in terra library in R. It takes input raster with whatever the input's projection, and calculate cellsize in ...
Sang Truong's user avatar
2 votes
1 answer
49 views

Python: Split Polygons where they overlap one another [closed]

I have a python script that produces a shapefile of polygons, created primarily using geopandas. I wish to split polygons where they overlap each other. Ideally removing all but one feature where ...
BlindedByBeamos's user avatar
0 votes
0 answers
35 views

Trying to find zenith and azimuth angles to satellite

I am working with satellite data. Each scene is approximately 30km squared with 1024 * 1000 pixels. I have the zenith and azimuth angle for each of the four corners, plus the center. I have latitude ...
sil's user avatar
  • 119
0 votes
0 answers
33 views

Stitching geotypes into a mosaic [closed]

How can I stitch satellite images using python, making the image connection borders invisible? I am surprised, but there is still no ready-made solution for gluing a mosaic of typhus with adequate ...
Кирилл Ярков's user avatar
2 votes
2 answers
58 views

Buffer without overlaps in Python

I have a set of points with respective lat/long coordinates and each point has a given value associated with it (basically a field measurement). I would like to draw buffers of a given radius around ...
André Lourenço's user avatar
0 votes
1 answer
26 views

Legend in meta data for land cover / land use codes (e.g. Corine Land Cover) (python)

I am working with Corine Land Cover Data. Is a legend stored in the meta data or somewhere else which shows the meaning and the official colorcodes of the different land uses? The product user manual ...
tofri's user avatar
  • 13
0 votes
0 answers
19 views

GRASS r.recode lowest value given no data

I would like to recode a floating point raster using GRASS' r.recode called within a Python function. As rules file for r.recode, I am using a file created by r.quantile with the -r flag. I am using ...
archeo_gis's user avatar
1 vote
1 answer
44 views

How to plot single land use / land cover classes on a map in python

I want to analyze Corine Land Cover data. It is raster data in a .tif file. Currently, I am using rasterio to handle the raster data. Question: How can I plot only a single land use on a map? My goal ...
tofri's user avatar
  • 13
0 votes
0 answers
16 views

Add an MBtiles with Vector Tiles to GeoServer through Python

I have an MBTiles file that contains vectors. I'm attempting to upload it to a remote GeoServer, but running into issues. The file will upload to the geoserver but with errors and I cannot create a ...
JWB's user avatar
  • 604
-1 votes
0 answers
30 views

Reproject tool and Python commands not working in QGIS project [closed]

I am working with a layer that is in EPSG 26911 and I need to reproject it to EPSG 3857. When I open the reproject tool I am not able to select or add an input layer. I tried using Python to ...
Heather Shaw's user avatar
0 votes
1 answer
23 views

Python output GeoTIFF in arcseconds

I have been utilizing code that looks like the following to output GeoTIFFs for some time (rudimentary, but gets the job done): def output_geotiff(data, outfile): # Get our dimensions cols = ...
Miss_Orchid's user avatar
1 vote
0 answers
42 views

Issues with GDAL installation - ogr not available?

I am attempting to install GDAL on my Windows 10 machine. I have previously done this successfully using the wheels from Gohlke's now deprecated site so I am learning a new way to do an old thing. ...
Graham Oxman's user avatar
0 votes
1 answer
23 views

Unable to read shapefile into geopandas as a geodataframe because resulting in OSError: exception: access violation writing error [python] [closed]

I downloaded a shapefile of New York City's building footprint from NYC OpenData through the following source: data.cityofnewyork.us/Housing-Development/Building-Footprints/nqwf-w8eh I then tried to ...
Lino Sanchez Siegel's user avatar
0 votes
0 answers
9 views

Separate legends and colorbars for subplots don't scale properly using the JRC Dataset

I've written some code to create subplots with maps based on the JRC Global Surface Water dataset. My code creates the maps just fine, but when I want to add a legend to explain the colors, they look ...
greasyfries's user avatar
0 votes
0 answers
24 views

Sample Raster Value code check

I have written code to loop through prism climate data (rasters) data at certain 2-week intervals then take the mean of that interval then append it to the original shapefile. #%% Processing Sinks for ...
Ekkehardt Rosasee's user avatar
0 votes
1 answer
31 views

Add Scale and Offset to VRT from python

I'm using the python GDAL package to build a VRT containing multiple bands. These bands might have a scale and offset to be applied. Is there any way to add these parameters to the VRT when creating ...
Guillermo Moreno Castaño's user avatar
0 votes
0 answers
24 views

DriverError When Extracting Features From ESRI Map Service

I am running this code to extract the features from an ArcGIS Map Server into a geodataframe (modified from this Medium article): import urllib.request import json import requests import geopandas as ...
Benjamin Silver's user avatar
0 votes
0 answers
47 views

Plotting spatial data in Python

I am very new to mapping in Python and I'm trying to plot data through Jupyter Notebook - import pandas as pd import numpy as np import xarray as xr import sys import os import matplotlib.pyplot as ...
proy's user avatar
  • 95
-1 votes
0 answers
27 views

Rendering basemap + polygon as JPG and sharing through email

I currently have a PostgreSQL/PostGIS (versions 14/3.2) instance with several tables. When adding a new polygon through QGIS, the server sends an email with info about said layer (using listen/notify ...
d_araujo's user avatar
1 vote
1 answer
51 views

How to write two geopandas dataframes as layers of a .gpkg file in memory in python?

Currently, to save a geopackage to Google Cloud storage I have to first create and save each layer locally. I would like to write it memory and the copy from memory to GCS. I'm stuck on the writing to ...
learningGeo's user avatar
-1 votes
2 answers
70 views

Simplifying adjacent polygons with Python while maintaining shared borders [duplicate]

I want to simplify adjacent polygons (GADM zones level 1) with Python while maintaining shared borders. The general problem is well explained at Simplifying Polygonal Coverages with JTS. The best ...
JoMe's user avatar
  • 7
3 votes
2 answers
132 views

Clip data in GeoPandas to keep everything not in polygons

I have two shapefiles. One is Point Data (Call it Adj). The other is a polygon(s) shape file. I want to clip the data to keep only the points that are not in the polygons. Is there an easy way to do ...
Ekkehardt Rosasee's user avatar
0 votes
0 answers
59 views

Python - How to spread out a set of coordinates so that they're not within 10 miles of each other?

I'm plotting a scatter map with plotly, and I have a lot of markers that are overlapping and very close to each other. This may be convoluted, but I'm trying to spread them apart by tweaking each ...
user247900's user avatar
1 vote
0 answers
25 views

Using GeoJSON timestamped Folium plugin for data in milliseconds

I have data from different points that a car pass by, and a need to put them in a map, but one by one using their UTC time. The data goes from one millisecond to another, and I need to reflect that. ...
natalia's user avatar
  • 11
4 votes
1 answer
66 views

Linking all possible polygons to point within a distance

I am using Python. I have a shapefile with polygons and a CSV with points. My goal is to assign to the points all the possible polygons within a distance of 10 kilometers. I am able to assign the ...
OgeiD's user avatar
  • 618
2 votes
1 answer
62 views

AttributeError: 'GeoSeries' object has no attribute 'is_valid_reason' in GeoPandas

I was going over the documentation for checking on valid geometries. When I wanted to try the example for is_valid_reason, got this error: import geopandas as gpd from shapely.geometry import Polygon ...
saQuist's user avatar
  • 826
2 votes
1 answer
47 views

Splitting SHP file based on property starting with an underscore

I found a rather annoying "feature", when trying to split a SHP file based on values of a property, which has a name starting with and underscore (like _property). The problem occurred when ...
pawel_kw's user avatar
0 votes
0 answers
27 views

How to use a calculated variable within a PDAL pipeline

I'm using a pdal pipeline in a python project. What I want to do is load a file (text format), calculate its resolution, then use its resolution in a filters.faceraster to create a tif. I have no ...
J.E.S's user avatar
  • 1
2 votes
1 answer
109 views

Detecting actual CRS when coordinate in WGS84 is known

My geodataframe includes some points of unknown coordinate reference system, each point has address as well, so I am able to find coordinates for them in WGS84. An example point is: POINT (472593....
szaki's user avatar
  • 21
1 vote
1 answer
53 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 ...
Ekkehardt Rosasee's user avatar
0 votes
1 answer
38 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
38 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
28 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 ...
Ekkehardt Rosasee's user avatar
0 votes
0 answers
69 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
2 votes
1 answer
62 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 ...
Ekkehardt Rosasee's user avatar
1 vote
1 answer
32 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
17 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
41 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,753
0 votes
0 answers
51 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,753
0 votes
1 answer
53 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
222 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
56 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
42 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
79 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
44 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

1
2 3 4 5
244