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

GeoPandas installation problems

I wanted to install GeoPandas, but I end up getting only this. (conda install geopandas) I also tried the other methods (https://geopandas.org/en/stable/getting_started/install.html), but doesn't ...
user avatar
0 votes
0 answers
10 views

Convert Access DB columns from Irish Grid X,Y to ITM X,Y

I have an access db file which contains 2 million records. I have written the below Python script to convert the relevant columns to the required CRS for consistency in the database. import geopandas ...
user avatar
0 votes
1 answer
17 views

How do I open certain window from raster file

I have a geodataframe with some bounds and I'd like to open that specifc box from the raster file. Lets say my raster file is name data.tiff so my current code is like: import rasterio as rio from ...
user avatar
  • 1
1 vote
0 answers
26 views

How to ignore -3.4028235e+38 as a minimum value in a DEM?

I am working with a DEM with the range of 99.93-169.32 (This range can be seen in QGIS). I am trying to open this DEM using cv2 or rasterio in python, and after that apply some filtering methods to ...
user avatar
  • 165
0 votes
0 answers
21 views

GeoPandas doesn't read FID column from geopackage

I'm trying to open a geopackage with GeoPandas. From QGIS I can see three columns into FAT as you can see below: I expect to see the same columns when I open these data with GeoPandas, but is not so. ...
user avatar
0 votes
0 answers
10 views

Scipy Error for SCP

Semi-Automatic Classification Plugin: Error. Check Python Scipy installation for the Semi-Automatic Classification Plugin. How do l go about it?
user avatar
0 votes
2 answers
34 views

Join multiple geospatial polygons to their nearest lat/long point in a different table using GeoPandas or other Python tool

I've got a list of voting precinct geospatial polygons that need to join to a different table with just lat/long points for each zip code. How can I join each of the precinct polygons to its nearest ...
user avatar
0 votes
0 answers
16 views

3D terrain in Mapbox using Python

I am connecting my Dash output to a custom-styled mapbox style. In my custom mapbox style, I have enabled 3D terrain which gives super cool insights and it allows you to tilt the map so that you can ...
user avatar
  • 31
-1 votes
0 answers
37 views

How to learn Python and Arcpy(ArcGIS Pro) from knowing nothing in a clear and efficient way? [closed]

I am a complete new to Python and Arcpy. I have learned some knowledge about R before,such as raster and terra packages but now I think learning Python is much more difficult than learning R. And I ...
user avatar
1 vote
1 answer
37 views

Converting working ModelBuilder to Python script reports errors in ArcGIS Pro

I want to learn Python and ArcPy by converting ModelBuilder to Python script. First, I tried to use 'extract by mask' in this way.But it failed. # -*- coding: utf-8 -*- """ ...
user avatar
0 votes
0 answers
23 views

Combine two raster datasets from different areas - xarray

I simply wish to combine two raster datasets from different spatial extents and with different coordinate reference systems using python. Eventually, I wish to combine enumerable datasets, but ...
user avatar
1 vote
1 answer
17 views

Extrapolate URI from a WFS connection

Purpose: to create and add a vector layer instance to the project with Python This is what is written in https://docs.qgis.org/3.22/en/docs/pyqgis_developer_cookbook/loadlayer.html#id1 to connect with ...
user avatar
1 vote
0 answers
15 views

Mask NetCDF file data with multiple variables from shapefile in Python

Most of the solutions to this I've seen online only work on 3-D time series data, but my NetCDF files has more than one variable. It has a data variable named Albedo and I need to plot it using a ...
user avatar
1 vote
1 answer
26 views

Checking intersection between polygon and geometry in GeoJSON

I have a GeoJSON file with different geometries(polygons). I'd like to find if my polygon intersects with any of the file's geometry. I am not going to paste the file here as it is a long one, but can ...
user avatar
-1 votes
0 answers
24 views

Plot graph as subplots for multiple csv files [closed]

I have multiple CSV files. All contains the same columns. Column's names are Date and Value. Now I want to plot graphs for each different CSV and as different subplots and want to save them in png ...
user avatar
1 vote
0 answers
15 views

Coinciding circle fills on Folium

I am trying to combine two circles to get something like this from here. However, I couldn't convert the solution in this post to Python. I need these circles to behave almost like one, but cannot ...
user avatar
1 vote
0 answers
8 views

no feature ID when polygonizing raster with python GDAL

I'm trying to polygonize the following binary raster: The output is a polygon layer (ESRI shapefile) that looks good, however, doesn't have FIDs for the features and thus I am not able to iterate ...
user avatar
0 votes
1 answer
30 views

Geopandas - Create all lines between two point shapefiles

I have two point shapefiles A (say, 10 points) and B (say, 30 points). I would like to create a shapefile with the lines between all points in A and all points in B (so, 300 lines). I have not found ...
user avatar
0 votes
1 answer
21 views

Difference in implementation of ee.Image.getMapId and Export.map.toCloudStorage for float casting

Background The following code: image_collection = ee.ImageCollection("COPERNICUS/S2_SR_HARMONIZED") filtered_collection = image_collection.filterDate('2022-01-01', '2022-02-01').filterBounds(...
user avatar
  • 134
0 votes
1 answer
38 views

Insert x number of vertices on a Polyline with field calculator or Python?

I've seen Adding vertex set distance from first or last vertex in polyline? which is similar to what I am trying to do, except instead of inserting one vertex a distance from the start point and all, ...
user avatar
1 vote
0 answers
17 views

Landsat 8 Collection 2 cloud-free mosaics in Earth Engine

I am trying to get cloud-free mosaics from 6-months periods of Landsat 8 Collection 2 Surface Reflectance. So far I've used geetools. My code consists of multiple modules so I can't paste it all here, ...
user avatar
  • 646
1 vote
1 answer
28 views

Set-Operations with Overlay when columns match

Lets go with the example at the geopandas Documentation. Say we have: from shapely.geometry import Polygon polys1 = gpd.GeoSeries([Polygon([(0,0), (2,0), (2,2), (0,2)]),Polygon([(2,2), (4,2), (4,4), (...
user avatar
  • 123
0 votes
1 answer
23 views

Combining data from multiple continuous rasters in ArcGIS [closed]

I am new to using rasters and have encountered a scenario for which there is hopefully an easy solution. I have 4 different continuous rasters that each represent the density of different habitats ...
user avatar
1 vote
0 answers
32 views

Bringing PyQGIS and PyQt into already settled Anaconda Python environment in PyCharm

I have Anaconda Python environment with different packages required for developing a QGIS plugin (including the Plugin Builder Tool etc.). (qgsdata) C:\TempDaten\_dev\QgsData>conda info ...
user avatar
  • 1
0 votes
0 answers
11 views

geopandas add legend to simple plot with no columns

I have a single feature that I want to plot with a legend, but the legend is not showing off. It's a simple polygon with simple fill. The code that I ran is like this, import geopandas as gpd import ...
user avatar
  • 680
0 votes
0 answers
17 views

Creating MBTiles from GeoTiff raster with transparent background and all the zoom levels

I am trying to create MBTiles from GeoTIFF rasters that have a black background (RGB: 0,0,0). In QGIS, I am able to generate MBTiles via the following steps: Set Transparency pixel (0 0 0) to get a ...
user avatar
0 votes
0 answers
14 views

Using Processing Algorithm script QGIS3 outside GUI [duplicate]

I get an error when I try to use a Python script using processing algorithms. If I use the following script, the program will encounter an error. So there is no processing. import processing ...
user avatar
0 votes
0 answers
29 views

Error in Rbindlist from a rasterstack and shapefile extraction file

I have multiple rasters files and a grid shapefile. I load the shapefile: grid = st_read('/grid.shp') I load the raster and create a raster stack `path <- "/VI_tif"` #folder where I ...
user avatar
  • 39
1 vote
0 answers
21 views

Spatial join for checking whether a coordinate lies within a shape polygon

I've a database of coordinates that records lat,lon values in 2 separate columns as double. I'm trying to map these points to polygons within my shapefile using geopandas spatial join, but I keep ...
user avatar
1 vote
1 answer
51 views

Distance between polygons and points in GeoPandas

I have a main polygon of polygons that have areas mapped out on a map and a bunch of points such as sample below NAME lt ln 1 12.9336806 77.6122669 2 12.974768 77.767745 ...
user avatar
  • 95
0 votes
0 answers
28 views

Calculating terrain slope

Having a set of elevation measurements along with coordinates, I am looking for a way to calculate the slope (the main goal is to determine the locations where the precipitation water might be ...
user avatar
1 vote
1 answer
17 views

Should I calculate my terrain attributes before or after upscaling my DEM

This is more of a theory question. I am working on a project that requires the use of topography data, I have a 1KM resolution global DEM to which I will be using GDAL to calculate general topography ...
user avatar
3 votes
1 answer
48 views

Specifying target resolution when resampling with rasterio

In GDAL warp you can simply set an xRes and yRes value. I'm trying to only use rasterio, but the process seems a lot less clear. According to the docs https://rasterio.readthedocs.io/en/latest/topics/...
user avatar
  • 575
1 vote
0 answers
37 views

An example for Viewshed analysis in Python

My goal: Using a .TIF DEM, I would like to conduct a viewshed analysis. This is to be used as one feature for a larger program written in Python that will significantly improve work quality in my ...
user avatar
  • 11
1 vote
0 answers
17 views

Color polygon based on points' values (geodataframe column)

I'm having a hard time trying to figure out a way to add a heatmap-like effect to my Polygon object based on the values of the Points inside of it. My geodataframe is as follows: inv ...
user avatar
0 votes
1 answer
32 views

Feature/shapefile does not show up in Python

This is the code I have fname = r"C:\Users\Kevin Abbot\Documents\W&OD Trail.shp" shape_feature = ShapelyFeature(Reader(fname).geometries(), ccrs....
user avatar
0 votes
0 answers
22 views

How to correctly/efficiently store Sentintel-2 imagery with 100 x 100 km dimension?

I am trying to store 100x100 km Sentinel-2 tile imagery into the PostgreSQL table. I have only these bands: B2, B3, B4, B8, and B11, resulting in a 2.5 GB GeoTIFF file. Consequently, due to the large ...
user avatar
1 vote
0 answers
38 views

Matplotlib: Giving arbitrary X,Y (Cartesian Coordinates) data a spatial reference of my choosing over a basemap

I'm attempting to overlay my animation over a projected basemap in Matplotlib. Right now I have a animation that is displaying an array in a time series over an X and Y axis in Matplotlib. What I want ...
user avatar
0 votes
0 answers
18 views

Create lat-lon mesh grid from MODIS HDF4 file GDAL

I have a Python code that reads HDF4 files for different satellite products. I am having issues obtaining the underlying grid that it uses. In panoply I can see the variables XDim and YDim that have ...
user avatar
  • 179
3 votes
0 answers
25 views

How to detect curves and straight paths using GPS coordinates?

I'm working on a project involving railway tracks and I'm trying to find an algorithm that could detect curves(left/right) or straight lines based on time-series GPS coordinates. The data contains ...
user avatar
  • 31
0 votes
0 answers
20 views

How to fix "Import ArcPy" glitch in ArcMap?

I just got this problem where my screen in ArcMap has this constant "import arcpy" phrase in the middle of it. It happened after I ran a Python script, but I deleted everything related to it ...
user avatar
  • 43
1 vote
0 answers
24 views

Find the average of pairs with the same first element in FME

I have a list of pairs in FME: and need to calculate the average of each set of pairs with the same first element. I came up with this code, but it takes a lot of time to paste and copy the list. Is ...
user avatar
0 votes
0 answers
27 views

Understanding TIFF file georeferencing

I am new to maps and ArcGIS field, and having some issues understanding the used georeferencing systems, I have a dem.tif file, when extracting information I get X and Y in very large number, I used ...
user avatar
2 votes
0 answers
41 views

Creating custom processing tool (sibling of Batch Nominatim geocoder) in QGIS

I want to create a custom processing tool for geocoding in QGIS. It will reproduce the "Batch Nominatim geocoder" geoalgorithm, besides several things: another URL of a geocoder will be ...
user avatar
  • 1
1 vote
0 answers
25 views

Querying Date Range and Feature Service ID in gis.content.search

I am trying to use Python to export data from ArcGIS Online within a specific date range while also using a specific feature service. I have been able to get this to work successfully: num_items = 3 ...
user avatar
  • 11
4 votes
2 answers
169 views

Comparing two sequential values in order to do an operation within sequence in another field

I have a shapefile representing points along a line. I have the downstream distance of each point on their respective line. What I would like to do is sequence the two fields in the attribute table ...
user avatar
  • 53
-1 votes
1 answer
27 views

Why does my code produce a runtime error?

My code produces a runtime error and I don't know what I'm doing wrong. ... import arcpy ... from arcpy import env ... from arcpy.sa import * ... ... #set the workspace environment ... env.workspace =...
user avatar
  • 43
1 vote
1 answer
36 views

Extract shapes and shape data from GeoTIFF using Rasterio and store as GeoJSON

I have a GeoTIFF that has a black background and shapes using various colours and each point has a data value. I'm trying to use rasterIO to extract this GeoTIFF into a GeoJSON so it can be displayed ...
user avatar
1 vote
1 answer
39 views

Using Python to plot flight data over portion of US?

Question I have a dataset in Python that tracks the flightpath of an object. I know the minimum and maximum latitude and longitude of the flightpath. The flightpath is entirely over the Montana. Is ...
user avatar
  • 11
0 votes
1 answer
21 views

Process for Determining Accuracy of Polygon [closed]

What tools/processing/decision trees would one use to get a base line of the accuracy of a polygon? I'll explain below. In my line of work, I deal with buffered lines (polygons) and I'd like to create ...
user avatar
  • 1,061

1
2 3 4 5
221