Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
17 views

How to query all points inside a geometry object

I have a table named slope. It contains the columns X, Y, Z and geometry. The aforementioned values represents the x,y,z coordinates of a geometry. i have also an object named fieldGeometry which is ...
1
vote
0answers
38 views

Calculate area and perimeter of coordinate points in Python

I have a set of points that make up a polygon. I need to find the area and perimeter for the shape in Python. I have used the shapely library to calculate the area and perimeter but it is nonsensical ...
0
votes
0answers
13 views

What is the easiest way to install libgdal 3.3.0 and header files (gdal-devel) on Ubuntu 18.04?

I would like to pip install GDAL 3.3.0 Python package, but it requires libgdal (3.3.0 or greater) and header files (gdal-devel). APT package manager repositories only have gdal-bin 2.4.2 and libgdal-...
2
votes
1answer
32 views

Removing overlapping parts of polygons from the same layer in QGIS

I'm working on a favourability mapping based on geologic inputs. One of those inputs is composed of fault zones which in my case are represented as one unique polygon layer with one attribute that ...
1
vote
2answers
29 views

shapely geometry - how to preserve refrence to original feature

What is preferred method to save reference from geometry to original feature when working with shapely geometries in python? Ie. After creating STRtree and getting some result from it, there is no ...
1
vote
1answer
27 views

Create GeoTIFF images from TIFF image using the coordinates of the four corners

I have several TIFF images which were taken from an aircraft. The images are tilted. Hence, the orientation of the images are not in parallel to the grid system. Please do refer to the below image: (...
0
votes
0answers
12 views

Validating a GML file using the XSD schema in Python [closed]

I'm a beginner. Can you tell me how I can validate a GML file with an XSD schema?
2
votes
1answer
42 views

How to calculate the corner points of a grid if centre points are know

I am working with a file which has the coordinates in WGS84 format. From this file I have calculated the Cartesian coordinates using the following code: import numpy as np import pyproj from netCDF4 ...
2
votes
0answers
28 views

Disconnect users who are creating locks on specific feature classes

I have a nightly Python script which updates some domains in a geodatabase. The domain owner is "AMIS". In addition to the AMIS schema in the geodatabase, there are other schemas. In order ...
0
votes
0answers
15 views

Rotating point feature on line feature in ArcMap

I have a line and a point feature class in ArcMap. I want to rotate the point feature on the line feature. I will use the Symbol Rotate Option with a defined field. I have a script for Field ...
1
vote
2answers
37 views

Error: 'list' object has no attribute 'segmentAlongLine'

I am trying to trim each polyline in a shapefile down to the first 15 feet of each line. The segmentAlongLine method was suggested to me, but this code is getting the AttributeError: 'list' object has ...
1
vote
1answer
42 views

Reading a shapefile into networkx as undirected graph

import networkx as nx from networkx.algorithms import approximation as ax Road = nx.read_shp('/Users/benjaminhendel/Downloads/scatteredroads.shp') #Reading Road Data Base = nx.read_shp('/Users/...
0
votes
0answers
18 views

Using QGIS RVT plugin scripts through PyQGIS

I'm trying to run the RVT Plugin algorithms via a headless version of QGIS, on a server running Ubuntu 19.01. I'm using the conda distribution of QGIS 3.18.2, installed in it's own environment using ...
1
vote
0answers
27 views

Working with large datasets with no server [closed]

I am in a bit of a weird work environment. I'm a data-scientist type person who is now doing more and more GIS work on some very large datasets - spatial regression, some mapping, spatial correlation, ...
1
vote
1answer
66 views

Spatialite KNN - No results

SOLVED: f_table_name was not working as no spatialindex was created/defined using just the tutorial for VirtualKNN - Solution: Run the query SELECT CREATESPATIALINDEX('tablename','geom_col') Original ...
2
votes
1answer
31 views

Python fastest way to load overlapping part of 2 rasters with different origin to np.array

I got a problem with gdal.wrap - it works REALLY slow. On 10m raster of Poland, matching the origin of 2 rasters takes like 30 minutes. Is there an easy and fast way to take 2 rasters (of different ...
0
votes
0answers
31 views

Applying Python machine learning model to Sentinel-2 product [closed]

I downloaded a Sentinel-2 product from scihub.copernicus.eu and want to apply a semantic segmentation ML model to it. My ML model input is 120X120X10 (took out bands 1,9,10). My questions are: How do ...
1
vote
1answer
45 views

How do I avoid altering the data range when writing a NumPy array into a TIF file with rasterio?

I'm using a machine learning model to automatically recognize (a specific type of) vegetation in RGB imagery. The output of this model is a binary NumPy 2d array, with '1' meaning vegetation and '0' ...
2
votes
1answer
32 views

How to calculate azimuth from the south, latitude, departure with two points?

I'm making a Line class in python and the attributes we need to put in are the first point, end point, latitude, departure, distance, and azimuth (from the South). The points consists of eastings and ...
3
votes
1answer
38 views

Retrieve OSM data with python using a GeoJSON geometry as the boundary [closed]

I'd like to : Select OSM map from a polygon geometry defined by a .geojson file Extract data (ex : parks area, building height,...) included in the geometry Any idea?
0
votes
1answer
26 views

Modifying a Python script called in a shell command in Google Colab

I am relatively new to coding and am working on a script to average 24 hourly GRIB2 files to daily files and output to a TIF. I am currently doing this in Google Colab by calling a GDAL python script ...
0
votes
0answers
20 views

Python - No module named '_gdal_array' only on virtual env

I'm trying to import gdal_array in python but I get ModuleNotFoundError: No module named '_gdal_array'. The strange thing is that this problem does not occur if I use system's python 3.8. It only ...
1
vote
1answer
57 views

Using Python or ArcPy to extract usable shapefile data from several hundred MXD files

I have several hundred (potentially more) old MXD files which were made to show grass areas to be cut along city roads. The employee before me opted to do these one by one and rather than create ...
2
votes
1answer
49 views

1m DEM mosaicking results in a very large file; how can I reduce the size of the output file without compromising output quality?

I am trying to mosaic 792 DEM of 1m resolution using this tutorial (https://automating-gis-processes.github.io/CSC18/lessons/L6/raster-mosaic.html), however it results in a large file (27.9GB) and I ...
2
votes
2answers
38 views

GDAL.grid creates an empty tif file (with no error during computation)

I'm attempting to create a raster file from XYZ data. I used GDAL.Grid on a .csv file with XYZ data and .vrt definition. The code produces a .tif file with no data. I'm having a hard time ...
0
votes
0answers
19 views

Geopackage on S3 to PostGIS RDS using a python Lambda

I am attempting to write/invoke a Lambda written in python (with a geospatial layer that includes gdal and the usual python geospatial gang: https://github.com/developmentseed/geolambda). This lambda ...
0
votes
1answer
33 views

Fixing this error “NoneType object is not subscriptable”

Since days and days, I could not figure out this issue. I got this error 'NoneType' object is not subscriptable. lib/python3.8/site-packages/folium/features.py The problem is at this point: layer=...
-3
votes
0answers
40 views

Making Drop Down list from layer attribute using QGIS [duplicate]

I have shapefile (.SHP) with village names of all India with different attributes like STATE, DISTRICT, SUB-DISTRICT, VILLAGE, PIN NUMBER with geometry. I want to make a dropdown list to select STATE ...
0
votes
0answers
37 views

Extrapolating arc via Python function

I am looking for a Python code/function that can extend an arc linestring up to a pre-defined length while maintaining the same arc of the original line. The idea is to repeat the configuration of the ...
1
vote
0answers
48 views

How to use GDAL Warp with Python

I can populate an image with 6 GCPs using Python and GDAL. The resulting images with 6 GCPs will only display using an affine transformation in ArcGIS Pro and QGIS. In order to display the images ...
1
vote
1answer
36 views

Adding datetime to each band's metadata in a multiband raster using Python

I've created a multiband raster of individual rasters of temperature at different times over a period of two days using rasterio in the following way: with rasterio.open('test.tif', 'w', **meta) as ...
0
votes
0answers
14 views

AttributeError: 'NoneType' Connecting GeoRaster

When I open the option to connect georaster and go again to create the connection, the error below appears. Do you know what it can be? Show the mesage: AttributeError: 'NoneType' object has no ...
1
vote
0answers
23 views

PyQGIS-Code in Plugin doesn't store features completely in memory layer

Within a QGIS plugin I download data which is then converted into a list of QgsFeatures. My way of storing for a long time was to use addFeatures on the provider object, but now in QGIS 3.16 LTR, not ...
1
vote
0answers
51 views

Extend the contours of the polygon into a polygon

I would like to be able to extend the vertices of one polygon to the edge of another polygon, how does the snapping between poligons using python. The photo shows a representation of my problem. I ...
1
vote
0answers
23 views

Count the polygons of the raster given by the kmeans algorithm

I am struggling with a Python problem. My plan is to compute the clustering of the kmeans algorithm for an image and to create polygons from this classification. My goal is to get the total number of ...
0
votes
0answers
7 views

Creating not lattice data to xarray-dataset [closed]

I would like to know how to create xarray-dataset that is not lattice data(not mesh data). For example, if I want to write a dataset of "river depth" and "precipitation" data that ...
-1
votes
0answers
19 views

How make grid on map in Folium?

I need make grid 500 x 500 meters in Folium. I tried change this code: https://www.jpytr.com/post/analysinggeographicdatawithfolium/ My code bellow: def get_geojson_grid(lower_left, upper_left, ...
1
vote
1answer
23 views

GDAL GCP Python georeferencing fails to perform second order polynomial transformation

I have Python code that will read drone imagery EXIF data and extract the necessary information (pitch, roll, yaw, elevation...) and leverage that information to create polygons that represent the ...
0
votes
1answer
36 views

QGIS/Python configuration

This question came from another topic: QGIS - creating VRT does nothing. MacOS High Sierra (10.13), QGIS 3.10 Coruña, GRASS 7.8, GDAL/OGR 2.4.1, Python 2.7 The installation of GRASS was tricky (qgis ...
0
votes
1answer
20 views

Send an automatic email when modifying attributes (a specific field) in a service/ feature class (Portal ArcGIS Enterprise / ArcGIS Online) [closed]

I would like to create a Python script (or find any other way) to send an automatic email when information in one field of my feature class (service) is being modified in either ArcGIS Online or ...
2
votes
1answer
30 views

Problem with autofilling output layer names while batch processing

I've been using QGIS "Raster boolean OR" to batch process a set of rasters (using LTS version 3.16.6). This has been working as hoped/expected, with the exception that I've not been able to ...
0
votes
0answers
31 views

How to generate polygons in python (wkt format) with given number of vertices and visualization of these polygons [closed]

So i need to generate random polygons of different number of vertices in wkt format and visualize them.I have no clue on how to generate the points for making a polygon which doesn't have lines that ...
-1
votes
0answers
17 views

Plotting cluster bar graph from multiple csv? [closed]

I am trying to plot a bar graph from 13 csv, my code unfortunately is incorrect, the code tires to plot each dataset individually. I need the outputs to be a cluster bar graph plotting columns 2 and ...
1
vote
1answer
43 views

Opening a grib from the web with GDAL in Python using /vsicurl throws error on Mac but not Windows

I have a Python script that attempts to open a grib file as such: from osgeo import gdal url = "/vsicurl/https://ftpprd.ncep.noaa.gov/data/nccf/com/hrrr/prod/hrrr.20210505/conus/hrrr.t15z....
0
votes
0answers
30 views

Can GDAL ReprojectImage run multicore/multithread from python?

I am using GDAL in python to reproject an image. Is there a way to use all CPU cores in this process. I have tried the following with no success: gdal.ReprojectImage(vrt, output, input_proj, ref_proj, ...
4
votes
2answers
72 views

Python: shapefile.Reader, how to set up .iloc?

I would like to set up range of reading by shapefile.Reader. I couldn't find any suitable documentation. I would like to read rows 0-100. In Pandas or GeoPandas I use df.iloc[0:100], but what should I ...
1
vote
1answer
44 views

Can not resolve the error: Incomplete shapefile definition in 'filename.shp'

I'm trying to add a feature to draw a map but this error: "Incomplete shapefile definition in 'eez v11.shp'" keeps popping. Here is the code I wrote: fname = 'eez_v11.shp' shape_feature = ...
1
vote
1answer
33 views

Cannot install GeoPandas on cloned arcgispro env in Anaconda

I have cloned my ArcGIS Pro env into my Anaconda 3 env. My goal was to have access to both the arcpy mod and GeoPandas mod. I tested it in a notebook to make sure arcpy is working and it is. But ...
0
votes
1answer
32 views

Google Earth Engine: reproject images to the same projection

Below, I have clipped the same region from 2 google earth images. However, the two clips are at different projections (the crs argument in reproject determines the projection). The reason I am ...
0
votes
1answer
24 views

Moving gdal raster references through functions

If I'm processing a lot of rasters, so far I've been creating files. Which I like doing in the sense it gives me confirmation that the intermediary steps are working correctly. However, after I'm done ...

1
2 3 4 5
198