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

Unsupervised classification using Python? [duplicate]

Is there a way to use unsupervised classification with satellite images to determine similar regions using python with gdal or with any library?
1
vote
1answer
35 views

Error on Line 109 of Creating Random Points in Layer Bounds Tool

I am using the latest version of QGIS 3.6.3 and I am getting the same error regardless of what I do when trying to run the Create Random Points in Layer Bounds tool. Here is the error: QGIS version: ...
1
vote
1answer
37 views

Calculate area, length, width of rectangles in shapefile with Python

I have a list of rectangles imported from a shapefile into Python in degrees. (EPSG:4326) rectangles = [{'type': 'Polygon', 'coordinates': [[(-61.55002968237319, 73.546895599812856), (-61....
2
votes
0answers
24 views

Run Schelling's model of segregation on a geographical map instead of the matplotlib plot or grid

If you don't know what is Schelling's model of segregation, you can read it here. I have written the following code to run the Schelling's model of segregation simulation. import matplotlib.pyplot ...
1
vote
0answers
48 views

Raster nodata = -3.4028234663852886e+38 [closed]

I'm very new to raster manipulation, and I'm getting a nodata value of -3.4028234663852886e+38 when importing USGS NED 1/3 arc-second n41w074 1 x 1 degree IMG using rasterio on Python. What is it ...
2
votes
2answers
44 views

Creating new GRASS locations while looping in Python script

I am making a Python script for processing my data. import grass.script as grass import numpy as np def main(): f = open("D:\\Glaciers_selected.csv", 'r') fl = f.readlines() for x in ...
0
votes
0answers
30 views

Creating virtual tiles of raster in Python?

I have a large raster and want to analyze it on smaller subsets but also want to save space so I am trying to avoid actually tiling the raster. Is there a way to make virtual tiles that python can ...
1
vote
1answer
110 views

AttributeError: 'NoneType' object has no attribute 'bounds'

I have the following geodataframes, corresponding to a regular grid: id grid_id geometry 0 48 0 (POLYGON ((2.052457758079306 41.42493869117656... 1 49 1 ...
1
vote
1answer
57 views

Get non-masked values of multiband numpy masked array

I am working on a multiband image with python. I imported my image as a masked numpy array of shape (bands, rows, cols) using rasterio. The mask is the same for all bands. I would like to get the ...
1
vote
0answers
28 views

How do I convert IGb08 coordinates into an ECEF frame?

I'm relatively new at GPS positioning, and have come across precise orbital calculation files here. I've parsed the sp3 files and gotten the values into something I can work with, but I don't know ...
4
votes
1answer
81 views

Extracting data within geometry (shape)

I have a NetCDF dataset which I normally call using the xarray function. I have recently been doing some transect analysis on the dataset, which looks something like this (the area between the ...
1
vote
1answer
39 views

Planet not able to get a response from quick-search API call

My question is related to: Planet API not being accepted for quick search but is on stats and planet quick-search api not recognizing authentication?. I am not able to successfully get a response ...
1
vote
1answer
84 views

Why is there a difference in length for two lines created from the same points, one with ArcGIS Pro and the other with Geopandas? [closed]

Update Question off-topic because I launched the ArcGIS treatment again and for an unknown reason this time I obtained the 21.56km length I was expecting. It means the error comes from either my ...
1
vote
0answers
62 views

Unable to import GDAL in Python 3.7 [closed]

I have installed GDAL using conda and it installed successfully. But when I try import gdal in jupyter notebook, it is showing this error. -----------------------------------------------------------...
1
vote
1answer
42 views

Transform HTML area to GeoJSON

I have this file http://www.meteofrance.com/mf3-rpc-portlet/js/datas/zones_AVDEPT73.json where the "zone" field is put in an area HTML element (so does "shape"). I have a little script that takes the ...
0
votes
1answer
53 views

Using ArcPy in Python class

I am trying to create a tool that creates dimension lines but I am getting error. Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "<...
2
votes
2answers
73 views

Calculate coverage percentage of an area covered by shapefiles using GDAL? [closed]

I have thousands of shapefiles covering around the world. I need to calculate coverage percentage. For example, a pixel located in Hawaii was covered by 100 of all shapefiles, then this pixel value of ...
1
vote
2answers
54 views

What is the correct GDAL Calc Syntax?

I need to calculate in gdal_calc the following python script. if (A == 0 and B == 0): wd = 0.0 else: wd = np.arctan2(A,B) I have tried if(A = 0 && B = 0,(0.0), else,(...
1
vote
1answer
99 views

Create elevation-service from geotiff using python and gdal

I'd like to create a little server for us, that tells us the elevation of a point in a geotiff file. I already got it working basically using the following: dataset = gdal.Open('test_file.tif', gdal....
1
vote
0answers
75 views

Export multiple Images in one task - GEE Python API

Context: I process a set of image using the Google Earth Engine Python API. I want to apply the process on a set of image and save the output (in my case export to GEE Assets). What I have done: ...
1
vote
0answers
33 views

Performant way to join 3D LiDAR mesh to 2D data

I'm new to 3D data and want to know what I should be searching for when I'm looking to find all the triangles in a 3D building mesh that fall within a 2D footprint. The mesh comes from LiDAR and ...
0
votes
0answers
47 views

AttributeError: 'Series' object has no attribute 'has_z'

I got the following GeoDataFrame taken from a CSV file and after some slincing and CRS and geometry asignment ctf_nom geometry id 0 Prunus ...
1
vote
0answers
16 views

Store the lat long coordinates in matplotlib figure to a table in Python

The matplotlib figure is made of polygons and I want to take the centroid of each polygon and convert it into raster data and store it in a table.
0
votes
0answers
41 views

Extract values of pixels from each band of a multi-band raster with a shapefile in Python

I have downloaded multiple products from EO-1 satellite and I have created digital rasters out of them. Each of them contains 10 or 242 bands (those are hyperspectral). I have also created a shapefile ...
3
votes
1answer
56 views

WinError 32 error when trying to delete shapefiles with QGIS python

I've looked at some answers on here about deleting shapefiles with QGIS but I still seem to be running into errors. I am trying to delete shapefiles that have no attribute data in them (so 0 rows). My ...
2
votes
1answer
78 views

How to use a specific transformation for a coordinate projection with Python

I try to use Python to project single coordinates from Gauß-Krueger-coordinate system (EPSG:31467) to ETRS89-UTM (EPSG:25832). I'm using the way Antonio Falciano showed here. So my script looks like ...
1
vote
0answers
60 views

Faster zonal stats for equal rasters with Python

I'm trying to extract data out of many raster images with different bounding boxes. Using the great rasterstats.zonal_stats it's a good approach, but it takes a considerable amount of time, especially ...
1
vote
0answers
52 views

Georeference an unreferenced image using rasterio in Python

I have unregistered/unreferenced 6 band TIFF images that I have been trying to export as georeferenced GeoTIFFs. The GPS coordinates of the corners of each image is known and each image is 1024 height ...
2
votes
0answers
21 views

How to delete a file after processing an algorithm in QGIS 2.18?

I am trying to delete an intermediate file ("Temp_merged.shp") after running the singleparts to multiparts algorithm in QGIS 2.18. import glob, os, processing path_to_shp = "C:/Temp/Tracks/" ...
1
vote
1answer
23 views

Splitting or decomposing LineString into original single lines or segments using shapely?

I am trying to split a LineString into single segments: from shaply import LineString,MultiPoint from shapely.ops import split xp = [-2,1,2,2.5,4,1,-1,2,4,5,6] yp = [-2,1,1,0,1,2,2,3,4,4,4] ...
3
votes
1answer
63 views

Merging many rasters with Python script within QGIS using GDAL?

I have many rasters that im trying to combine in order to produce contours. They are in the .bil format so I understand that i need to translate them using gdal first but none of my attempts have ...
2
votes
1answer
65 views

How to write a single pixel or a line of pixels to GeoTIFF using GDAL/Python

Let's say I want to write a single pixel or a 1D array of pixels (e.g.all at the same latitude) of pixels to a single-band of a Float32 GeoTIFF using the Python GDAL bindings. How can I do so? Or is ...
3
votes
1answer
91 views

Using GDAL's Rasterize (Vector to Raster) utility?

I am trying to convert a point layer to a raster file using QGIS python consle. I want the output raster with the extent of a raster file. The new raster should have the point values from the ...
3
votes
1answer
54 views

What are the differences between a WFS and a simple API? [closed]

So I have worked with OSM in the past and have been really happy with the API of Overpass turbo. Now I want to integrate some other data and that one is provided via WFS. Why is some geodata offered ...
0
votes
1answer
27 views

Get just not null values from intersection of shapefile and buffer with Python

I generated a buffer using this question: Creating buffer circle x kilometers from point using Python? I did an intersection with this buffer and a shapefile using: intersection_origem = shp_geom....
3
votes
1answer
58 views

Reclassify multiple raster files with GDAL [closed]

I have a directory containing multiple .tif files which I want to reclassify and save to a new directory. The following code already worked for a single raster. Unfortunately, I don't know how to use ...
0
votes
0answers
55 views

Python - Issue to create choropleth map based on GeoJSON file: AttributeError

I'm trying to build a choropleth map, I cannot figure out why I get this error: AttributeError: 'NoneType' object has no attribute 'get' Here is my code: station_nb is a dataframe with values ...
3
votes
1answer
98 views

Setting CRS : TypeError: 'NoneType' object is not callable [closed]

I'm working with a naive geometry column imported from a csv file, like this: name geometry id 1 Abubilla (POLYGON ((424405.897979997 ...
1
vote
0answers
83 views

Resolving CRS Error in rasterio

I am trying to use the pysheds package to calculate flow accumulation from a DEM. However, when reading the DEM .tif-file, I get the following error. I can't find any more information as to what this ...
1
vote
2answers
55 views

How to save raster with projection into Python

I applied a raster processing that is already in a known coordinate system with this code, import cv2 import numpy as np from matplotlib import pyplot as src img = cv2.imread(r'E:\2_PROJETS_DISK_E\...
0
votes
0answers
28 views

Fiona installation in Python 3.6 ERROR: Command “python setup.py egg_info” failed with error code 1 [duplicate]

I'm trying to install Fiona using pip in Python (v 3.6.8). I'm using the following command: python36 -m pip install Fiona I'm getting the following error:
1
vote
1answer
60 views

Why does spatial join on geodataframes return empty result?

I have two geodataframes that I want to perform a spatial join on; one is points, one is polygons. They are both dtype: int64. They both have .crs = {'init': 'epsg:4326'}. I have verified both of them ...
3
votes
0answers
67 views

Why an extra iteration on the first feature of a GeoJSON layer?

I'm using Python and GDAL to iterate over the features in a GeoJSON layer and I'm seeing this strange behavior where the first iteration is repeated a second time before moving onto the next feature. ...
1
vote
1answer
31 views

Why does geodataframe never complete?

I had a feature class made up of 1,700,000 polygons. I used Geopandas to create a geodataframe: state = "MD" state_gdb = r"C:\Projects\Pop_Alloc\{}_Data.gdb".format(state) join_feat = "{}...
1
vote
1answer
64 views

Finding shortest distance from point(s) to number of polygons at varying angles using shapely?

My aim is to calculate the distance a point is from land in Python, trying to replicate the functionality of fetchR. Given an origin and distance, I create shapely LineStrings which radiate out from ...
0
votes
0answers
85 views

GDAL polygonize only particular values

I want to polygonize .tiff raster file for specific values. For example, using one method I firstly reclassified the raster by gdal_calc.py --calc="A*logical_and(A>0,A<1)" then used gdal....
-1
votes
1answer
73 views

Uploading an asset into asset folder Earth Engine Python?

Would like to know if there is a way to upload a TIF as an Earth Engine asset, but have it ingested and stored in a specific folder in my Earth Engine assets via Python. I have a bunch of images to ...
0
votes
1answer
30 views

Python add dynamic text to ArcMap map outside of dataframe

Is it possible to reference a variable from Python in a textbox in ArcMap? I found a way to create a label associated with a point. But is it possible to reference a variable in a textbox outside of a ...
2
votes
0answers
38 views

Generate arc from projection coordinates

I have a mind to generate arc from given parameters: start point coordinates arcDistance arcBearing arcOrigin coordinates. My concept is, calculate the end point of arc (function geo.sphere....
0
votes
1answer
55 views

Get maximum pixel value within numeric range

I am working with MODIS Global Primary Production (GPP) rasters and I am trying to pick the max GPP pixel value in a series of 15 dates for a study area and create a new raster layer. MODIS GPP ...