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

creating digital soil map [closed]

I am very new to rasters and geographical processing. I want to create a soil map using ndvi of a region. I already have got the final ndvi image using python. How can I create the soil map for a ...
-1
votes
0answers
15 views

Change in altitude value after resizing .tif file [closed]

I have a TIFF file of 7378x6923 (widthXheight) resolution. I resized it to 1200x1200 pixels using Image class in Python. img = Image.open('path to tif file') img = img.resize((1200,1200)) But after ...
2
votes
1answer
32 views

Rasterising multiple shapefiles into a single raster

I'm not even sure you can do this, but I want to convert multiple shapefiles into a single single-band raster. I'm pretty sure its going to be easier to first create a multi-band raster and then use ...
0
votes
0answers
12 views

Using Carto's “Static Maps” API from Python

I want to download a static image of a map to my local PC via a Python script. I have tried this method: from carto.print import Printer printer = Printer(userName, mapName, key, 30, 20, 12, ...
0
votes
0answers
33 views

Getting pixel size without opening raster using Python [closed]

I want to get the pixel size (resolution) of a raster without opening up the raster in gdal. I currently have my script opening the raster in GDAL using gdal.Open() and getting the resolution that way....
0
votes
0answers
17 views

Issue exporting GeoPandas dataframe

I am trying to export a GeoPandas Dataframe looking like this to an external file: id geometry 0 POLYGON ((39.92713 1.41394, 39.92703 1.41394, ... 1 POLYGON ((39.95126 1.41866, 39.95116 1....
1
vote
0answers
19 views

v.overlay with empty layer [closed]

I'm writing a Grass Python Script (using GRASS GIS 7.6.1) for a project for university. Sadly, I never learned Python, so it's a bit tricky but so far I got everything done I wanted to. The Script ...
0
votes
0answers
26 views

Enable Python extension for GeoServer 2.16.x

I am using Windows 10 (64 bit) & QGIS 3.4 along with GeoServer 2.16.x in my machine I am trying to enable 'scripting' in GeoServer (so that will develop Python scripts) but it gives me error (my ...
0
votes
0answers
18 views

Python Arguments for the the path [closed]

I have three .png files which are cropped over a specific region and converted to gif. I would like to know how to define the path as an argument in python. from PIL import Image import glob for ...
-1
votes
0answers
14 views

Exporting selected features to CSV using Python [closed]

I need to write a python script that will export only selected polygon records from a shapefile to CSV.
-1
votes
0answers
19 views

Sorting and deleting attribute features from shapefile [duplicate]

I am polygonizing a single band raster and creating an area field to the shapefile. I want to keep the 10 largest polygons by area and delete the rest. The following script computes the area for all ...
4
votes
1answer
69 views

Assigning new values to polygon based on overlapping area with other polygons

I have two square polygons df1 and df2. Both polygons are assigned a value of 10 (df1) and 20 (df2) in the "content" column. Let's assume, I have a circle with the midpoint 1.5,1.5 and a radius of 1. ...
0
votes
0answers
17 views

Create VRT from multiple hdf files with Rasterio/GDAL

I have several Landsat 8 Scenes, each consisting of 11 bands. I want to mosaic them by creating a VRT and afterwards exporting the mosaic as TIFF again. I tried using GDAL via Python. But maybe it ...
1
vote
1answer
37 views

Creating a raster based on values of other rasters

I have three single band rasters, raster_a, raster_b and raster_c with pixel values 1 and 0. I am trying to burn the values of raster_a to raster_b and create a "new_raster_b" where if: raster_a == ...
4
votes
1answer
55 views

Setting CRS to ESRI:102001 using GeoPandas

I've been passed some GeoJSON shape data that I've been told is in the CRS ESRI:102001, although that property has not been written into the GeoJSON file. I've been able to confirm that is the correct ...
0
votes
0answers
13 views

Convert list of .hdf-files to .vrt in python with Gdal

I'm a little lost. I have a directory with some Landsat-8-scenes. There are files that end on .hdf and they are always accompanied by a .hdr file. What I wanted to do is to convert these scenes to a ...
0
votes
0answers
22 views

Updating Carto Dataset from local file with Python script [closed]

Similar to Map not get updated when Dataset get updated using CartoDB, I want to update a maps data but I need to do it with a python script that is executed from an Excel macro (I already have the ...
-1
votes
0answers
10 views

Extract parts of map tiles (TMS) files into separate files (TMS) by GeoJSON polygon or bounding box coordinates [closed]

I have TMS tiles ({z}/{x}/{y}.png). I'm looking for a way to clip them into smaller sections by GeoJSON polygon or bounding box coordinates. Does anyone have any tips (python script or package) on ...
1
vote
1answer
36 views

Creating new shapefile using pyshp

I am trying to strip data out of an existing shapefile to create new shapefiles. I have made the loop work, and made the new file, but I cannot work out why I cannot add records to the new file I am ...
1
vote
0answers
17 views

Create new raster (.tif) from standard deviation stretched bands, works with dstack but not to write a new file

I am sorry if the title is unclear, I am new to python and my vocabulary is limited. What I am trying to do is apply a standard deviation stretch to each band in a .tif raster and then create a new ...
-1
votes
0answers
49 views

Generating unique fid using QGIS [closed]

I have a layer with a "fid" field which has a "unique" constraint and an "enforce unique constraint". Every time I add a feature to this layer using QGIS GUI, it automatically creates a unique ...
1
vote
1answer
45 views

Using PyQt5 Objects inside QTabWidget and QScrollArea - QGIS Plugin [closed]

I'm using PyQt5 and QT Designer to create the user interface for my QGIS plugin. Now I'm learning to use QTabWidget and QScrollArea. What I don't understand is how to use the objects inside tabs or ...
1
vote
1answer
23 views

Received corrupt data from Overpass (incomplete polygon) with Overpass API Python wrapper

I'd like to collect forest data on overpass turbo. But my code isn't working properly. Here is the first version: import overpass api = overpass.API() res = api.get(""" area[name="Charente-...
0
votes
0answers
33 views

How to find the points of hausdorff_distance()?

The Shapely hausdorff_distance() function returns a single (scalar) value. Is there a way to get the/a pair of points on both geometries that fit this distance? Similar to how we have ...
1
vote
1answer
20 views

How to write BIGTIFF raster files with rasterio

A few months ago I had a hard time in finding a way to read BIGTIFF files. In the end I only managed to do so by creating a new conda environment with the following options: conda create -n env_name ...
1
vote
1answer
30 views

Finding distance of consecutive points in a GeoPandas data frame

I am trying to find the distance between every consecutive points in a GeoPandas dataframe. Let's say we have the following data frame: import pandas as pd import geopandas data=pd.DataFrame() data['...
2
votes
1answer
43 views

Calculate distance from a point to a MultiLineString geometry - PYQGIS

I'm trying to calculate the distance from a point to the closest river in my QGIS plugin. But I receive this message: MultiLineString geometry cannot be converted to a point. Only Point types are ...
1
vote
1answer
30 views

GDAL in docker using pipelines in gitlab

I want use gitlab to test python with GDAL library pip install gdal is not working I use gitlab to CI/CD Source code of project: https://github.com/lazyspot/georeference-image-library It is ...
0
votes
0answers
32 views

Spatiotemporal analysis with polygons and points

In QGIS, I have a dataset of burned areas (polygons) and lightning strikes (points). In both datasets, I have the date of the fires, date of the lightning strikes, latitudes, and longitudes. However, ...
1
vote
1answer
28 views

gsconfig add WFS with shapefile via Python

I am generating a shapefile with a Python script and I want to publish it via GeoServer. The GeoServer is running on localhost 8080. I learned from this website that the workflow would be: Add a ...
1
vote
1answer
34 views

Updating Pyproj syntax results in other values

I want to know the length in meters of a LineString with coordinates in EPSG4326. Based on this post, this is code that works for me: from shapely.geometry import LineString from shapely.ops import ...
1
vote
0answers
28 views

Folium choropleth plots markers [closed]

I have this code to plot a choropleth from a GeoPandas DataFrame. def create_gpd_dataframe(self d = {'Angle of point': yard_list, 'Latitude': yard_lat_list, 'Longitude': yard_lon_list} ...
1
vote
0answers
31 views

Convert GeoTIFF to KMZ

I am trying to convert a GeoTIFF to a KMZ. Here's my code: from osgeo import gdal import zipfile srcf = r"C:\raster_to_kml\OrthoImage.tif" vfn = "/vsimem/OrthoImage.jpg" drv = gdal.GetDriverByName('...
0
votes
1answer
37 views

Deleting features with Null value in attribute field

I have polygonized a single band raster and created an area field. I want to keep the 10 largest polygons by area and delete the rest. The following script computes the area for all polygons and sorts ...
2
votes
1answer
29 views

Set image SRC using GDAL [closed]

I have a TIFF image with no coordinate reference system and I need that image to be in EPSG 32631. Is there a way to do this using GDAL? Note: I am very new to Python
0
votes
0answers
34 views

Measuring distance between points across polygon [closed]

How do I measure distance around an object? I'm looking for an answer in R, Python, QGIS preferably. Here is my situation. I am trying to measure distance between points across an area of water. ...
1
vote
0answers
35 views

Python Classification of multiple NDVI images for difference

I have several months worth of NDVI images for an area. When I check the values, there seems to be some deviation. I am using python GDAL to attempt to calculate possible areas of concern for ...
0
votes
1answer
35 views

How to visualize large .tif file which is a multispectral image

This image is supposedly a 5m multispectral multi-temporal (LISS IV) data of a place in India called Satna. It is a .tif format file of size around 32 MB. Image should typically have greenery(...
1
vote
0answers
20 views

Problem with Python plugin [duplicate]

I developed a Python plugin to import a PostgreSQL project organized in QGIS with one click. The problem is that I don't put the layers it in the correct "tree scheme" in the layer panel. I enclose a ...
1
vote
1answer
39 views

Sort and create attribute field to the shapefile

I am creating a shapefile layer and adding an 'Area' attribute field using the following script: # Create shapefile layer drv = ogr.GetDriverByName("ESRI Shapefile") dst_ds = drv.CreateDataSource(...
0
votes
0answers
38 views

Longitude and Latitude Missing values [closed]

How to deal with missing values in these variables?
0
votes
0answers
25 views

earthpy.spatial stack() -function and data type

I have Landsat-8 OLI images in directories named after image WRS-2 scenes. I tried to compose script that would iterate these directories and stack rasters within each directory - using earthpy python ...
0
votes
0answers
18 views

Convert heights from DHDN Gauß Krüger Zone 4 to UTM 32 ETRS 89 in pyproj

I am using pyproj. X/Y conversion is pretty straightforward through transformer = Transformer.from_crs(31468, 25832,always_xy=True) However, this does not transform the heights. From Vertical ...
0
votes
1answer
40 views

Extract/export Attribute Table of pixel information from Classified Raster in Python?

I am at beginner level in image processing with python. I have classified satellite image with python in 10 classes. I am able to write the image in geotiff format. However, I do not know how extract ...
0
votes
0answers
50 views

Mask Sentinel 1 images for radar shadow in Colab?

I am trying to export Sentinel 1 images from Colab to Google Drive, but before I want to mask out areas of radar shadow and layover. Is there code or a function for masking out radar shadow in the ...
2
votes
0answers
58 views

Error name '__file__' is not defined

I have a complement (image_1) that works perfect. But I get an error by wanting to make a change. I add the code of my two .py files. I want to change this address: "C:/Users/SENARA/AppData/Roaming/...
1
vote
0answers
21 views

OSMIUM deleted column conflict with OSM

The following code used to extract the data from a history file. import osmium class CounterHandler(osmium.SimpleHandler): def __init__(self): osmium.SimpleHandler.__init__(self) ...
0
votes
0answers
27 views

Converting multipolygons to polygons in Leaflet or Python [closed]

Given a multipolygon like the state of Hawaii, how can I generate the polygon that most tightly fits all the islands. I think this may be what is referred to as the "Minimum Area Circumscribing ...
0
votes
0answers
25 views

Where can I find the source code of shapely.geometry.multilinestring.interpolate() function?

When I use shapely.geometry.multilinestring.interpolate() function, it creates points at every 50 m along the multiline. I try to create a points at a given interval (lets say the distance between ...
0
votes
0answers
46 views

How can I import pyqgis API into standalone Python script?

I want to create .qgis file from standalone Python script and I need to import pyqgis (qgis.core ). I tried commands: set PYTHONPATH=C:\Program Files\QGIS 3.4\apps\qgis-ltr\python and set PATH=C:\...