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

How to redesign confusion matrices from Ecognition with python and seaborn?

I am using eCognition manual classification as a baseline for performance comparison with other 3D classification methods. For each method, I am creating confusion matrices in python with sklearn and ...
1
vote
1answer
36 views

Difference between mask and bbox in geopandas read_file

Geopandas read has as options bbox and mask. https://geopandas.org/reference/geopandas.read_file.html What is the difference between those two options?
1
vote
0answers
27 views

Highly Imbalanced dataset

I have a dataset (vector data) that contains the polygons and their corresponding crop type. This data is highly imbalanced i.e, I have a lot of classes that contain one sample only, as shown in the ...
0
votes
0answers
21 views

How to extract tiles corresponding to a geometry from a dataset?

I'm using the GEE API in a Jupyter notebook. I'd like to use the following dataset to carracterise the tree cover of a specific area. This dataset is unavailable on Gee but is available for download. ...
0
votes
1answer
30 views

Installing packages for ACOLITE atmospheric correction; RuntimeError - HDF4 DLLs

I would like to use ACOLITE atmospheric correction with python, however, I cannot install pyhdf. The RuntimeError is following: RuntimeError: Cannot find required HDF4 DLLs -- check LIBRARY_DIRS I ...
1
vote
1answer
90 views

Plot a circle with a given radius around points on map using Python

I have created a map using GeoPandas with a few markers that represent some coordinates on the map. I want to do draw a circle around each marker with the marker placed in the center of the circle. ...
0
votes
1answer
36 views

How can I create multipolygon using shapely?

I am going to create polygon, but it produce invalid polygon form this data: [[ 0 438] [ 0 428] [ 0 427] [ 6 428] [ 9 434] [ 11 439] [ 7 443] [ 3 446] [ 0 448] [ 0 452] [ 0 452] [ ...
1
vote
0answers
37 views

Fixing ArcGIS Pro crash with opening notebooks after installing Anaconda

I have had problems with opening notebooks in ArcGIS Pro 2.5 since installing 64-bit Anaconda 3 on my PC (Windows 10 OS). When I create a project in ArcGIS Pro and try to open a notebook within ...
0
votes
0answers
33 views

Adding tool from Python script

I am trying to add Python script as a tool in ArcMap 10.6. I have the result or outcop3 saved in the folder Outputs. I added a output folder in the parameter and made the direction as output but i am ...
0
votes
1answer
34 views

Use plugin code in QGIS python script

I would like to write a Python script in QGIS and would like to use functions from a plugin. For example, QuickOSM plugin has an import function and an "Open" button, that creates a ...
0
votes
0answers
22 views

Concatenate from all the elements from a list of lists to have a string [duplicate]

I have data from a JSONs like as below data={'type': 'Feature', 'geometry': {'type': 'LineString', 'coordinates': [[410910.0885459831, 2479395.4132211693, 0.0], [410903.8088855865, 2479401.860380645,...
1
vote
1answer
46 views

How to reproject point if I only have the source TIFF extent

I made a point shapefile (using PySHP in Python) that represent objects detected through AI. This shapefile has no CRS and each point is X,Y relative to the image it was processed from (actually a ...
2
votes
1answer
49 views

Downsides to saving rasters with NaN as no data values?

I am working with a bunch of satellites images downloaded from Google Earth Engine as .tifs. I have masked some of the pixels in Earth Engine with values of -999999 where there are clouds. Everytime I ...
0
votes
0answers
12 views

An error occurred while processing NPP VIIRS using satpy different sizes

An error occurred while processing NPP VIIRS using satpy. My code: import satpy from satpy.scene import Scene from satpy import find_files_and_readers print(satpy.__version__) if __name__ == '...
0
votes
0answers
19 views

Rasterize feature class in geodatabase using gdal.Rasterize (Python API)

I am trying to rasterize a polygon data set (feature class within a file geodatabase) using the GDAL Python API. I am using gdal.Rasterize (Actually, it would be very interesting to know what the ...
0
votes
1answer
19 views

Transform gee.geometry() into a raster

In the Python GEE API I'd like to create a .tif file of the selected country boundaries. This file will then be the input of a R script. I can easily select the country but I don't understand how to ...
0
votes
1answer
26 views

Difference in area size calculation since update packages

On my mac I use brew to install PostGIS and all dependencies, including geos. Since month or so, I have a failing test in my Python code. A polygon that is entered in WGS84 (srid 4326), the converted ...
0
votes
1answer
56 views

How to transform bounding box from object detection ML to shapefile

I'm working on a Python script to build a point shapefile I can open on QGIS from a list of bounding box (X and Y coordinates) returned by an Object Detection algo. I know the CRS/EPSG and bounds of ...
1
vote
1answer
58 views

`folium.GeoJson` displays all polygons in GeoDataframe but not individual ones

folium.GeoJson displays all the counties of New York State: import geopandas as gpd gdf = gpd.read_file("Counties_Shoreline.shp") m = folium.Map(location=[43.062776, -75.420884], tiles="...
0
votes
0answers
14 views

pyqgis3 raster extent in print composer

hello i want to use pyqgis3 to create a simple map composer with raster. my problem is in my code is the raster Extent in map,this code snippet does not show me the whole raster(full extent) but a ...
0
votes
0answers
18 views

Created GeoTIFF only has NaN values in PostgresSQL

I created a GeoTIFF file from a numpy array, loaded it into a PostgreSQL DB and now I want to retrieve this raster data and convert it back into a numpy array. I know this seems nothing really ...
2
votes
0answers
33 views

Feature is visible in a layer but geometry is None in QGIS using Python

I am using the feature's geometry in a layer to get the centroid point of the polygon. One particular feature is visible in a TOC layer and also able to select a feature. But, while reading that ...
0
votes
1answer
23 views

Band Compositing

This is probably a trivial question, but is it possible to create band composites using bands of different resolutions (10m, and 20m)? I tried that and exported the resulting rasters to JPEG and it ...
1
vote
2answers
43 views

Identify the min and max x-y coordinates of an ee.Geometry (Earth Engine)

I am using the EE API in a Python Jupyter Notebook. I am building a map based on the LSIB_SIMPLE country boundaries. My objective is to display my information in a map and adapt the zoom to fit the ...
1
vote
0answers
19 views

Use PyWPS with GRASS and Space-Time-Datacubes

I'm a complete novice with PyWPS, so I'd be happy about any pointer and help. My issue is, that I want to write a process that calculates the min, max and mean of a Spacetime -Datacube (of NDVIs), ...
1
vote
0answers
17 views

Distance difference between Pyproj and Haversine

I'm measuring the distance between two points with two different methods. This results in two very different results. Please have a look: from pyproj import Transformer from haversine import haversine,...
0
votes
0answers
53 views

Unable to replicate GDAL output

I have a set of GRIB files that are fliped (longitude spans from 0 to 365), and I am using gdal to first transform the data to GeoTIFF, and then warp the gridded data to a standard WGS84 longitude (-...
0
votes
0answers
36 views

Connecting to Cloud SQL database in Colab runtime

I am very new to GCS and Cloud SQL, so forgive me if I am not asking this question well. A colleague and I have been working on a machine learning workflow that generates polygons from some ...
0
votes
0answers
14 views

Why does QGIS throw me an error on startup with processing.run? [duplicate]

I am trying to run python startup script for QGIS with the following code: from qgis.core import * from qgis.utils import iface import os from qgis import processing project = QgsProject.instance() ...
0
votes
1answer
27 views

geemap doesn't display attributions

Is it normal that geemap doesn't display attributions in my notebook? Is there a way to add them? I'm running : import geemap m = geemap.Map(center=[40,-100], zoom=4) m.add_basemap('CartoDB.Positron')...
0
votes
0answers
42 views

How to properly use Open Street Map's API

I'm using GeoTiler in my Python project to display a map view of some data. GeoTiler achieves this by querying some OpenStreetMap API (I assume the Overpass API). I have no intention of ever ...
1
vote
1answer
46 views

QGIS3.10, Find all points that are located on a line

Inside my .shp there are two simple layer: "Points_Example" (Type: Point, EPSG:25832) "Lines_Example" (Type: Line, EPSG:25832) Some of the points are located exactly on the line ...
1
vote
1answer
40 views

How to get the bounds of a GeoJSON file in GeoPandas as a seperate file?

I am trying to generate a polygon which circumscribes all shapes in the given GeoJSON (could be either point, line, or polygon shapes). I figured out how to do this with bounding boxes (.total_bounds)....
0
votes
0answers
36 views

Distance computation for geospatial clustering of lat/lon points

I am working with a pretty large dataset (~500K data points) in Python (GeoPandas) and I would like to perform geospatial clustering on some subsets (~60K points) of the data. My question has to do ...
0
votes
1answer
23 views

Pyproj switching output coordinates

I'm trying to project from ED50 31N to WGS 84. I'm using script below but when I generate the outputs they are inverted from the coordinates I would expect. I expect x_out to be 4.031819616199967 and ...
0
votes
1answer
51 views

Image (band) interpolation

I have a set of sentinel 2A images. I eliminated those that contained too many clouds, and then I created a cloud mask using cloud probabilities and Otsu thresholding method to eliminate cloudy pixels ...
1
vote
1answer
69 views

Stack two numpy array into one image with two bands in order to clip it with anotherr shapefile

I have two np array,'array 1' and 'array2' , and I have one image with 3 bands. I want to stack array 1 and array two to be one image with two bands with the same shape as my image and then to clip it ...
0
votes
0answers
22 views

Convert a ee.Geometry() into a Leaflet polygon

I'm using the Leaflet and gee API in a Python notebook. In this notebook I'd like to display a featureCollection as a layer on a Leaflet map. #retreive the asset asset_descripsion = 'Glad_' + ...
0
votes
1answer
29 views

AssertionError: Invalid MXD filename

I am trying to publish a draft service definition using arcpy.mapping.CreateMapSDDraft and am getting the referenced Assertion Error. I've tried the responses to users with similar questions with no ...
1
vote
1answer
45 views

Display a gee featureCollection on a leaflet map

I'm using the python GEE api and ipyleaflet in a Jupyter Notebook and I'd like to retrieve an asset (FeatureCollection) and display it as an overlay on my map. The retrieving work just fine ...
2
votes
1answer
52 views

Adding EPSG codes to Pyproj

I am trying to correct ellipsoid heights to orthometric height, transforming from WGS84 to EGM2008 using the EPSG code 3855. I have tried with pyroj, as in this question: import pyproj EGM2008height = ...
2
votes
0answers
18 views

Different values when trying to use window in rasterio

I've been having a problem using windows in rasterio, which is probably a misunderstanding on my part. My goal is to dump a specific data from a band into a csv file, first I tried to use a window but ...
0
votes
0answers
27 views

How to integrate a Python Script into Processing Modeler in QGIS

I have a model in QGIS and I've generated a Python Script to calculate the matching between two strings (Levenshtein Distance with the FuzzyWuzzy Package) for one of the OUTPUTS. #####################...
0
votes
1answer
25 views

Access the assets list through GEE API

I'm using the Python GEE API. I'm able to crawl in my tasks through this : #search for the task in task_list filename = construct_filename(country_code, year) tasks_list = ee.batch.Task.list()...
0
votes
1answer
26 views

How to define CRS (WGS84) of a mosaic raster file while all the parental raster files are in WGS84 in Python?

out_meta.update({"driver": "GTiff","height": mosaic.shape[1], "width": mosaic.shape[2], "transform": out_trans, ...
0
votes
1answer
43 views

Proj/PyProj Convert between ocentric and ographic latitudes

I am trying to use Pyproj to perform the conversion between ocentric and ographic latitudes. I can do this using the cct command line tool: echo 0 45 | cct -z0 +proj=geoc +a=3396190 +b=3376200 0....
1
vote
1answer
42 views

Python: Cut out the square from the raster. The square has a 30 kilometres (18 miles) side length and has the center in the given coordinates

The following code displays the coordinates for a city in Poland given by the user, for example Kock. import subprocess import sys from pyproj import Proj, transform import warnings warnings....
0
votes
1answer
25 views

How do I change the display size of a map from a shapefile with matplotlib?

I'm completely new to shapefiles. I was able to use GeoPandas to plot some data over a map of the US I got from census.gov. I'm having getting the map to be at a viewable size. I adjusted the figsize ...
0
votes
0answers
12 views

Raster Edge Identification

I am trying to create a script to create suitability indexes for various urbanized areas. I know that esri has a tool that does this but it doesnt perform the way we are looking to utilize it. The ...
0
votes
1answer
27 views

Access GDAL result output

I have used rasterize function from GDAL in order to rasterize a shapefile that I have according to existing raster. The problem is that I'm not able to find or to show the resulting raster. This is ...