Questions tagged [python]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
95 views

Converting xy point to lat/long

I have data with columns x,y, address. And no any information about the projection of x,y points. How can I convert these points to correct lat/long pairs? 1091969,199515,27 HEDGEWAY CT 1092046,...
1
vote
1answer
29 views

how to display a ee.Feature using folium?

I try to display a country delimitation in a jupyter notebook using folium. I try the following code #load country from LSIB countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017'); #subset the ...
2
votes
2answers
72 views

Projection: Argument 'crs': Invalid type when displaying ee.Image

I'm starting with GEE and I try to display in a Jupyter notebook a simple image of a small area to see if I get it right. I followed the instruction of the documentation and write the following: ...
0
votes
1answer
27 views

ArcPy extract and split FC name to create table [closed]

I have geodatabase with many feature classes. Filenames of these fc have all info I need. My goal is to have a CSV or Excel table, that I can work with. So all filenames match schema ...
2
votes
0answers
19 views

Problem with LoadLibrary and encrypted DLL

I'm using QGIS and I try to implement a new function into my plugin. For that I need to use a DLL which is encrypted. In my C++ test application I don't have any problems to use that DLL with ...
2
votes
1answer
33 views

Using QCompleter with strings composed by different words in QGIS Plugin - PyQT5

I'm using QCompleter in my QGIS plugin. The code below works well, but I'd love to make it more sophisticated. In this example I have some strings that are composed of some words, for example "How to ...
2
votes
0answers
43 views

Creating smaller sized grid and interpolating data from bigger grid

I am working with a vector grid that looks like this: I am not very experienced with QGIS and have been looking for a way to divide each mesh of the grid a certain amount of time to get a smaller ...
0
votes
1answer
48 views

How can I overlay two raster without turning them in vector format in Python to get zone wise statistics?

I have two raster re-sampled and same extent one is elevation class raster from DEM reclassification classified in 10 zone with 500m interval and another is snow cover fraction raster has snow ...
3
votes
1answer
57 views

Merging rasters with rasterio in blocks to avoid MemoryError?

I am trying to merge two rasters with rasterio. However, when I run dest_array, out_transform = merge(sources), I receive the following error: MemoryError: Unable to allocate array with shape (1, ...
3
votes
1answer
58 views

Working with HDF4 file in GDAL

I'm definitely not the most experienced GDAL user, but I already struggle for quite a while now getting my head around the hdf4 file format in GDAL. The thing is that I have a directory with many hdf4 ...
1
vote
0answers
36 views

Difficulty getting usable response from secured ArcGIS REST API 10.2

I am trying to script the export of subsets of data from an ArcGIS Server to clients based on shapefiles they provide me. Our data are on a somewhat old rest endpoint (10.2). I have tried a variety of ...
1
vote
0answers
59 views

Nearest neighbours with Python [closed]

I'm learning Python and this has been a bit of a challenge! My DataFrame looks like this below. name geometry 0 Uimastadion POINT (24.93045 60.18882) 1 Hartwall ...
0
votes
1answer
93 views

Parallel processing in Pandas

Using this implementation of parallelization raises an ImportError: cannot import name 'Parallel' from 'multiprocessing' The following code tries parallelization with the "denominator" function and ...
-2
votes
1answer
50 views

Clustering large number of locations

I am trying to cluster points inside the USA for which I have the latitude and the longitude. My condition is that, every point within a cluster should be less than 25 miles away from every other ...
0
votes
1answer
70 views

Extract population count from GeoTIFF based on mask layer

I downloaded Population Count data from Gridded Population of the World (GPW), v4 as a *.GeoTIFF file. In a next step, I would like to extract the population count of a given area based on a mask ...
-1
votes
1answer
43 views

Shapely Polygon to numpy boolean mask [closed]

How can I convert my Shapely polygon to a numpy pixel array representing a boolean mask, with True for where the polygon is?
1
vote
1answer
28 views

Check if function-argument is valid vector-geometry in Python GeoPandas

I wanto to build a function (let's call it clip) that accepts a vector-file (can be a shapefile, a geopackage....) and a raster. How can I make sure the argument that the users gives to the function ...
1
vote
0answers
40 views

Random forest classification starting from a JSON file

I have a lot of images of Earth and I need to find the section of the image where there is water using random forest. I also have one JSON file (not GeoJSON) that have all the image's information. ...
2
votes
1answer
145 views

Open QGIS prococessing algorithm dialog with Python

I would like to programmatically show a processing algorithm dialog from Python. I gived a look to processing toolbox and I found that this is possible importing and instantiating the class ...
1
vote
1answer
44 views

Generate an empty large raster using GDAL?

Using GDAL, how can I simply create an empty single band raster? I can't seem to find out how. I know in PostGIS you can create a new table with a 'raster' column type, then insert a band into it. ...
0
votes
0answers
16 views

How can I mosaic list of osgeo.gdal.Datasets and add overlapping grid cells?

I have a list of osgeo.gdal.Datasets that I created from a list of numpy arrays containing geo-referenced ice velocity values for a glacier. I would like to merge these all into a single mosaic and ...
6
votes
0answers
41 views

OGR failing to unpack polygons and respective holes from shapefile

I'm trying to unpack shapefiles in Python (v3.7.4) using the GDAL-OGR library (v2.3.3). Each shapefile has only one feature containing multiple polygons with holes. They cannot be produced differently....
1
vote
1answer
25 views

Apply transparency to a raster layer by using actions

i have a specific action to load an raster layer by clicking on it, however i need to know if is possible to open that specific file and automatically apply a style. My idea is when someone click and ...
2
votes
1answer
43 views

Build Mosaic using gdal based on Modal value

I have an immense (~50,000) set of tiles that I want to mosaic using the mode for every pixel. The tiles have a size of 299x299 and are overlapping each other by 2/3 respectively. For the sake of ...
0
votes
0answers
35 views

Python Displaying a 3D MNT or slope map

I'm working on a scientific programming project and so it's about calculating a slope map, aspect map and a risk map and of course displaying graphical results. I've already done the essential (...
1
vote
1answer
37 views

Exporting Error 'Pattern 'VH' did not match any bands'?

I am trying to process a Sentinel 1 image to add layover and shadow masking. However when I do that and try and export the image to google drive I get an error: Error: Image.select: Pattern 'VH' did ...
0
votes
1answer
51 views

Change in altitude value after resizing .tif file

I have a TIFF file of 7378x6923 (widthXheight) resolution. I resized it to 1200x1200 pixels using Image module in Python. img = Image.open('path to tif file') img = img.resize((1200,1200)) But after ...
2
votes
1answer
58 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 ...
1
vote
0answers
34 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'm using carto-print: carto-print I have tried this method: from xlwings import Book, Range from carto.auth import ...
1
vote
0answers
39 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
28 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
26 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
39 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 ...
-1
votes
0answers
21 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
83 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
1answer
43 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
42 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
94 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
15 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 ...
2
votes
1answer
55 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
1answer
53 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
48 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
42 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
39 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
44 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
49 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
2answers
65 views

Read ASCII Grid file cell value for given long/lat coordinates

I am trying to write a Python script which takes a set of long/lat coordinates as input and returns the cell value corresponding to these coordinates The ASCII Grid file is from PVGIS and contains ...
1
vote
1answer
36 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
36 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
35 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 ...