Questions tagged [python]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
22 views

Iterating through a matching set of before and after raster images in Python

I have downloaded a matching set of before and after insect invasion raster images from Google Earth Engine. I now want to loop through these images selecting the matching before and after invasion ...
1
vote
1answer
13 views

Python GDAL/OGR, SetAttributeFilter not working

I'm following the book 'Geoprocessing with python', and I'm just trying to filter countries by their continent with this code: from osgeo import ogr import ospybook as pb fn = os.path.join(data_dir, '...
1
vote
0answers
24 views

GeoServer - Error while storing uploaded file

I am suddenly unable to load new geotiff files into an old GeoServer instance (2.15.2). The latest log entries are: 2021-06-01 12:27:16,920 ERROR [geowebcache.GeoWebCacheDispatcher] - null https://...
0
votes
0answers
34 views

Using x,y coordinates and a value gathered in an Excel file, set these values in a raster with Python and GDAL

I have an Excel file with X, Y coordinates and one Altitude value for each coordinate. I have already gathered these values in a Python dict. Altitude, Lat, Long (see image) Also, I have a raster ...
0
votes
0answers
17 views

How can I go from a SVG file to a Polygon string with ID table in Python?

I would like to translate my SVG file (objects) into polygons. The result I would like to obtain is a table with a column of IDs and another column with the Polygons in it (string). I would like to ...
0
votes
1answer
34 views

How to add a border around a GeoTIFF?

I have a 200x200 GeoTIFF from which I am trying to create multiple polygons. I am using different range values to generate different polygons. However, the inverse of the polygons I want are being ...
0
votes
0answers
25 views

MOLUSCE for QGIS 2.18.28 gives ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I'm trying to use MOLUSCE Plugin for prediction of Land use expansion, I prepared and added the layers required for it but at 3rd step that is 'Area Changes' when I try to 'Update Table', ValueError ...
2
votes
1answer
44 views

Output polygon is the inverse of what I need?

I am trying to output a different polygons from a single band GeoTIFF. I am trying output different polygons for specific range values such as 0.4 <= x < 0.5, 0.5 <= x < 0.6 etc (each ...
0
votes
0answers
21 views

Error: Could not load source layer for INPUT using processing

I am trying to run a process script in QGIS 3.16.11. I need to run qgis:distancetonearesthubpoints over selected features from a vector layer created in the script, I use ...
1
vote
2answers
36 views

Count number of items in a row with domains

I'm having trouble trying to get the total manpower in my attributes table. This is the desired outcome: MAN_1 MAN_2 MAN_3 TOTAL_MANPOWER Technician Null Null 1 Engineer Surveyor Technician 3 ...
0
votes
1answer
27 views

Offset Latitude and Longitude by some meters accurately - Reverse Haversine

I have a set of lat/long coordinates and need to offset the value to the "left" by < 10 meters. I calculate left by getting the direction my instrument is facing and use basic ...
1
vote
0answers
20 views

Reproject vector layer with OGR and python

I want to reproject a vector Geopackage from WGS (4326) to UTM (32605) using OGR and python. However, after running the code below the feature geometry and data extent is still in degrees and not in ...
1
vote
0answers
15 views

GDAL second order polynomial fails in Python but first order and thin plate spline work fine

I have Python code that will automatically georeference drone images regardless of overlap and without SfM software. The code runs without error when I set my transformation type to a first order ...
0
votes
0answers
14 views

rasterio reproject space value

I am using rasterio to reproject data from UTM to lat/lon. The reprojection work, but it creates projection space, with values of 0, which becomes a problem when I display the data, because some of ...
4
votes
1answer
46 views

How is polygon intersection implemented in JTS/Shapely?

I am using Shapely, which from the questions How is intersection implemented in Shapely? What is the algorithm that Shapely used to check if two polygons intersect? uses the JTS as a backend. ...
1
vote
2answers
37 views

Importing gdal_pansharpen in Python [duplicate]

I imported gdal module but I can't find gdal_pansharpen function in gdal. How can I import this function in Python? from osgeo import gdal
0
votes
0answers
13 views

Regardin cloud masking [closed]

I want to apply cloud masks on Landsat 8 Collection 2 Image using Python in Jupyter Notebook. Currently, I am using geemap library for doing the GEE taks. How could I achieve this ? Any suggestion. ...
1
vote
0answers
27 views

NetCDF with negative dimensions

I am trying to read a NetCDF file with rasterio (Python), however, the resulting affine is showing negative numbers. The .nc4 file comes from NOAA. How can I correct these negative dimensions? nc_fo = ...
1
vote
0answers
13 views

Jupyter Notebook fails to launch in ArcGIS Pro 2.8

Since upgrading to ArcGIS Pro 2.8 from 2.6, I am facing an issue with the Jupyter Notebook that fails to load and returns an error: Failed to Load Notebook What all I have tried: Tried opening the ...
0
votes
1answer
14 views

Basemap or Cartopy on Mac OS with Python 3.8 and Matplotlib 3.3.3 [closed]

Matplotlib basemap is deprecated in favor of Cartopy - however, it seems that to install cartopy only the Anaconda package manager can handle dependencies. I am following the instructions to install ...
1
vote
0answers
41 views

Accessing QGIS using Jupyter Notebook

Using Python for QGIS in a Jupyter Notebook, how can I automate the task of importing a dxf file getting a data web service as a layer ? I have tried (https://lerryws.xyz/posts/Install-Jupyter-...
2
votes
1answer
37 views

Is there a difference in transformations betweeen pyproj 2.6.1post1 and 3.0.0?

I've got the following Python Script: from pyproj import Transformer, transform transformer = Transformer.from_crs(31468, 25832, always_xy=True) x_coords = 4359995 y_coords = 5295525 transformer....
1
vote
1answer
30 views

Get centroid of a polygon and transform pixel coords with X,Y coords [closed]

Is there a way to get the coordinates of the centroid of a polygon and transform them into latitude and longitude? I am using Shapely to convert contours into polygons from Google Satellite images. I ...
2
votes
1answer
53 views

What is causing this list index out of range error with Pandas and GeoPandas?

I'm using 7 functions to create dot density maps in Python, Pandas, and GeoPandas. The functions read the US Census blockgroups and create random points that fall within the blockgroup polygon. The ...
1
vote
1answer
30 views

Using a specific transform on GeoPandas 'to_crs' function

I have a GeoDataFrame with CRS epsg:4326 and want to convert to epsg:32066 Such as: gdf.to_crs(epsg=32066) I know that GeoPandas is selecting the optimal transformation and it works. But I want to ...
0
votes
1answer
43 views

Is there an automated way of creating multiple individual feature classes from one feature class in ArcGIS Pro? [closed]

I have a feature class with more than 6000 unique values. Rather than having this as one feature class, I would like to create 6000 individual feature classes. Meaning, for each row in the attribute ...
1
vote
0answers
27 views

Fast retreival of single-point bicubic interpolation from a raster? [closed]

I have a raster data set with a grid size of 100m. I want to get information from it for a single point within the grid, using bicubic interpolation to use a bit more of the information from the data ...
1
vote
0answers
39 views

How to overlay shoreline shapefile into GeoTIFF file

I have a shoreline shapefile of five great lakes and a georeferenced lakeshore TIFF photo of lake Ontario. I want to overlay the shoreline shapefile into tiff photo as a new raster layer. Specifically,...
0
votes
1answer
33 views

Rasterio fails to create new tiff file inside for loop

I'm trying to save rasters with rasterio inside for loop. For reason that I don't understand, the for loop works only in the first loop (being able to save the tiff image) but then when comes to the ...
0
votes
1answer
26 views

GDAL/OGR convert AutoCAD DWG to shapefile

I'm trying to come up with a Python script to convert CAD files to shapefiles. The Open() calls don't error they just return None. I've tried with and without the 'CAD' driver specified. GDAL version ...
2
votes
0answers
30 views

Plotting maps using Matplotlib with a loop: Only two of four iterations completing

Using two different dataframes (Itis and Myyrmanni), I'm attempting to use a loop to plot four different maps with Matplotlib. Each respective dataframe is to be represented with two different maps: ...
0
votes
1answer
31 views

Projected coordinates points rotating horizontally

I have this Sentinel-2 picture that uses the WGS84 UTM zone 23S as projection type. My picture is rescaled to 3413 by 4741. My objective is to transform the X and Y pixels to EPSG 32723 and then from ...
0
votes
0answers
15 views

QGIS Zonal statistics and Python Rasterstats yield different results

I have one polygon shapefile and one raster file (both EPSG: 4326) and I am calculating the minimum, maximum and average raster value in all polygons using two methods: QGIS 3.16.10, Zonal statistics ...
0
votes
2answers
25 views

Setting 0 pixel value to novalue using GDAL in Pythin API

I have a raster data and i want to set the 0 value pixels to NoData using GDAL in python API. I know that you can do this by inputting this code in the command prompt. gdal_translate -of GTiff -...
0
votes
0answers
21 views

How to convert geographical coordinates to points with GeoPandas [closed]

I have an Excel tab with more 5000 lines with localisation of photos. Localisation is in a column and write like this : E100N05 N08W022 W020S003 I'm using Python and GeoPandas. So my goal is to put ...
0
votes
0answers
14 views

Extracting elevation data from DEM with Python [duplicate]

I have downloaded a DEM model for a given region. I use rasterio like this: import rasterio dem_path = 'path_to_dem.TIF' list_of_points = ((42.136097, 24.742168),) def get_offline_elevation(...
0
votes
0answers
36 views

Calculate surface area on raster using Python

I have raster files (GeoTIFFs) and would like to calculate the surface area. I envision having a way to extract the coordinates at each corner of the pixels, then have the height values for each pixel ...
1
vote
0answers
14 views

Can GeoTIFFs hold metadata on class labels?

I am creating GeoTIFFs in Python using rasterio and recently discovered that you can set band descriptions like so: with rio.open(out_tif, 'w', **profile) as dst: dst.write(data) dst....
1
vote
1answer
17 views

How to make necessary changes to Geodataframe to export as geopackage or shapefile

I am trying to export a geodatabase I created via the OMSNX package. () When I attempt to convert the file from a geodatabase to shapefile I get an error "ValueError: Invalid field type <class ...
0
votes
0answers
25 views

Python gdal grid error in EPSG

I'm using gdal.grid() function in my Django project. gdal.Grid('idw.tif', geojson, zfield="vals",outputSRS ="EPSG:32643,WGS84/UTM zone 43N",format='GTiff', algorithm='invdist',...
0
votes
1answer
36 views

How to separate in two lists the coordinates of a 2D list

I have created a program that calculates the intersection of two regions on the surface of the Earth based on 2D coordinates given by the user. It asks if the user wants to add more coordinates and ...
0
votes
0answers
13 views

Format rasterio Raster To Use In Further Operations

I am using this solution (with a couple of tweaks) to split my raster into tiles to further run operations on each tile. I am trying to figure out how to not have to write each split as a separate ...
2
votes
1answer
58 views

In what system are coordinates from the ST_AsMVT PostGIS function

I have a table (records_addressvalue) in my PostgreSQL database with a geom column (geom) with srid=3857. I have some rows in there, and I'm querying the database to generate MVT tiles. I'm following ...
0
votes
0answers
33 views

How to serve a fixed Lat/Long PNG as a raster layer? [closed]

I developed a react-leaflet application that I deployed on the Google Kubernetes Engine. Its primary purpose is to serve weather information tailored to aviation. There is a pretty simple node.js/...
2
votes
2answers
40 views

Is there a way to get/use a specific Transformation in Pyproj?

I have a specific transformation code that I would like to employ to transform one set of coordinates to another. Specifically the EPSG:15851 transformation. Is there a way to create a new Transform ...
0
votes
1answer
41 views

Scikit learn in QGIS does not work (Windows 10)

I tried to install scikit-learn in OSGeo4W Shell. I used the information provided by another question 1. Both ways as AlecZ suggested worked. After installation I get this message: "Successfully ...
0
votes
0answers
40 views

Acquiring data point coordinates from Geotiff and converting to numpy array

I would like to use scipy.interpolate.griddata to interpolate my Sentinel-1 products (see two sample images below) taken from different orbits resulting in having the uniform datapoint coordinates. I ...
0
votes
1answer
51 views

Generate a circle of coordinates around a point, but I'm getting an Oval

I'm using the following code to attempt to generate a circle of coordinates a fixed distance (in this case 1km) around a point. I'm basing the formula on Haversine, but the output I'm seeing in Google ...
1
vote
0answers
30 views

Changing shapefile encoding using Python

I have shapefile in cp1251 and trying to convert it into utf-8. Create cpg file with text cp1251 with same name as my shapefile and put it in same directory. Run ogr2ogr -lco ENCODING=UTF8 output.shp ...
2
votes
0answers
41 views

Clustering polygons with cluster area limit

I have a polygon layer and I need to group polygons (basing on proximity) BUT there is a area limit for single cluster and limit for distance from cluster. DBSCAN algorithm on centroids gives nice ...

1
2 3 4 5
206