Questions tagged [python]

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

Filter by
Sorted by
Tagged with
2
votes
0answers
14 views

Value NAN in netcdf4 file for lat&lon using python

I have two file netcdf4 ( latlon and other file without latlon) i open the 2 file in the same code and i choose one variable and the two variable lon and lat when i write lon i have the value nan i ...
0
votes
0answers
23 views

Downloading XYZ tiles within QGIS?

I understand that it is possible to use a Python expression formula to batch download XYZ tiles within QGIS. I also understand that that expression/formula has been written and has previously appeared ...
1
vote
0answers
21 views

How can I update a subset of raster values using open source python (rasterio, for instance)?

I have a source raster data set (tif file) and a number of polygon features. For each one of those polygons I need to: a) 'clip' the raster. b) change values of those clipped raster cells (with the ...
0
votes
0answers
21 views

Joining file pair for batch gdal_merge.py

I am new to Python and I have been going through past questions and searching trying to determine best way to batch mosaic files. I have a list of .tifs that have been converted from .hdf files I am ...
1
vote
0answers
20 views

Calling a temporary layer in PyQGIS

I have the following PyQGIS script (see below) which works fine except from one issue: The input vector layer I would like to use is a temporary file. How can I call a temporary layer (which does not ...
2
votes
0answers
32 views

Delayed function calling inside QgsTask

I try to add a function to the qt event loop via QTimer.singleShot(...) from within a QgsTask. However the function is never executed. I wrote a short script that isolates this issue: import time ...
0
votes
0answers
30 views

Constructing boundary polygon around raster image when mask layer is ill-defined using GDAL with Python?

I have a raster image and I want to construct a new vector layer that has the boundary of the raster, using python. Below is a sample of the image. The problem is that the nodata value is set to "...
0
votes
1answer
21 views

Insert empty VIEWS into QGIS from PostgreSQL using PyQGIS

The Aim: I am trying to insert a number of empty VIEWS into QGIS using PyQGIS. These VIEWS have been created and stored in a PostgreSQL database. I want to also ensure i can successfully re-open ...
0
votes
1answer
30 views

clipping a vector layer with another vector layer using python

Sorry if this there is a really obvious solution to this question. I did not have any luck googling and looking at different books. I have an OSM vector layer that I want to clip with another vector ...
0
votes
0answers
39 views

Read contents of KML file into CSV format using Python (BeautifulSoup)

I have a KML file called Layers.KML which has multiple sub folders - Tree_Heights_Elevations, 20190516 - Chain Link Fence, 20190516 - Clearing Limits, 2016-0516 - Solar Array . ...
0
votes
1answer
38 views

Reprojecting data with GeoPandas using 'to_crs'?

I am trying to reproject a polygon so that it has the same projection than a raster dataset. raster.crs CRS({'proj': 'tmerc', 'lat_0': 0, 'lon_0': -183, 'k': 0.9996, 'x_0': 500000, 'y_0': 0, 'datum': ...
1
vote
1answer
28 views

Method 'to_crs' to reproject with GeoPandas is missing

I am trying to reproject data using GeoPandas' to_crs method but it seems to be missing. When I type hasattr(gpd, 'to_crs') I get FALSE. Also, when I type dir(geopandas) in the command prompt it doesn'...
1
vote
2answers
38 views

How to calculate number of vertices in GeoPandas

Is there any method to count number of vertices of polygon (or multipolygon etc.) that is in 'geometry' column in datatable, but using GeoPandas? Example: Let's say I have polygon POLYGON ((552971....
2
votes
0answers
20 views

Creating Swath View from Point data using Python?

My situation Input: point data from planting file Feature Attribute: [('DeletionFlag', 'C', 1, 0), ['Field', 'C', 254, 0], ['Dataset', 'C', 254, 0], ['Product', 'C', 254, 0], ['Obj__Id', 'N', 15,...
2
votes
1answer
24 views

Sentinelsat: Error trying to download from Norweigan mirror colhub.met.no

I am trying to download the Sentinel 2 images over an area of Western Norway. Since the ESA archive is very slow, I am trying to use the Norwegian mirror for Sentinel instead (https://colhub.met.no/#/...
2
votes
0answers
25 views

QGIS dll load fail with from qgis._core import *

I have a error in console python, I tried using pyqgis without qgis interface. My problem is when I use: from qgis.core import * Console's the message is: from qgis.core import * Traceback (most ...
1
vote
0answers
28 views

All 0s result from raster calculator in python

Raster calculator is not working correctly for a single calculation using a standalone Python script. I am trying to add 1 to a pre-existing raster. It processes, but the resulting tiff file is all 0s....
1
vote
1answer
57 views

QGIS script for filling fields in attribute table

I want to write a script that will fill field values in the attribute table the following way: There are dots with attributes and lines I am creating. I want the script to use the field value of the ...
0
votes
0answers
22 views

Visualizing queue length with colored Polylines - Folium

I have a bunch of PolyLines that i want to color code based on the length. I managed to change the color of the entire line, based on the length of a line segment (between 2 of 6 points), but I am ...
-3
votes
1answer
16 views

run function multiple times [on hold]

i have a list: my_list[8000,8001,8002] function: def print_function(number): print(number) What do i want? I want to run the function multiple times, in this example 3 times with the numbers ...
0
votes
1answer
34 views

Remove Cloud Cover with Python Earth Engine API

I am attempting to use google's cloudscore methodology to remove clouds from LANDSAT8 imagery. I am using python to do this. I can get this to work in java from the web code editor, but am unable to ...
1
vote
0answers
47 views

How can I compute confusion matrix using Python [on hold]

My project is about "Extracting water and urban features from satellite images". I have extracted urban and water features using Python code. Now, I want to do accuracy assessment. I know two primary ...
2
votes
1answer
32 views

Unable to load geometry field from geodataframe to a PostgreSQL table 'geometry' field

I am trying to load a geodataframe to a PostgreSQL table, but I am struggling with the geometry field. First I read feature class using Geopandas: geodata = (r'path_to_gdb', driver='FileGDB', layer='...
0
votes
1answer
29 views

Cannot access LibKML driver using OGR in Python

I am trying to read a kmz file using OGR in Python. I believe the standard driver for reading .kmz files is LibKML (Can ogr2ogr read .kmz files? How?), but I am only getting None when I am building ...
2
votes
2answers
101 views

How to load the geometry field of a feature class to PostgreSQL?

I am trying to load a polygon feature class in a file geodatabse to a PostgreSQL table (extension PostGIS installed). This the process I'm following: I create table in PostgreSQL with required fields ...
2
votes
1answer
64 views

Creating equally spaced coordinates on California state map created with basemap?

I have created a California state map with basemap Python library and this shapefile. Code is below from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt fig, ax = plt.subplots(...
2
votes
1answer
37 views

arcpy.da.NumPyArrayToTable() RuntimeError: Unspecified error

Using arcpy for ArcGIS Desktop 10.7.1... In order to append data from a Pandas data frame to an ArcGIS table, I am attempting to create a temporary in-memory table from the Pandas data frame as ...
1
vote
0answers
25 views

Opening EOS netCDF4/HDF5 file with correct format using xarray?

I am using xarray (version 0.12.2) to work with the MODIS/Terra+Aqua MAIAC Land Aerosol Optical Depth dataset (MCD19A2.006). xarray successfully opens that dataset with the correct variables and ...
1
vote
0answers
11 views

Setting layer blending as additive with opacity in Kepler GL for Python

I'm using KeplerGL in python (in a Jupyter notebook) to plot polygons on a map with different layers. After setting the layers, I've tried to find where can I edit their opacity when adding them up, ...
0
votes
0answers
36 views

Hacks to make Python scripts faster? [closed]

I've got a GDAL/OGR-based Python script that's drawing buffers around roads. In any particular area, it goes road by road (feature by feature) drawing a buffer around a road, and appends that road's ...
1
vote
0answers
22 views

Geopackage vector data type

I am reading a shapefile in Python using geopandas, join some tabular data and export to geopackage using geopandas. The entire process is very easy. However, when I export the vector data, the file ...
0
votes
1answer
29 views

Finding overlapping areas between two or more GeoTIFF files

How can one programmatically understand overlapping areas between two or more GeoTIFF files captured at various timestamps for the same location?
0
votes
0answers
43 views

Obtaining geographic coordinates of satellite images using Python? [closed]

Using a satellite image of a band it is possible to obtain the geographic coordinates and the value of the color in a matrix. I just obtained an array using GDAL but it just represents the colors of ...
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
votes
0answers
21 views

Using pandas to extract out EOL from a column in excel file [closed]

I have an excel file which contain a lot of data and a lot of non-useful information which I wish to extract out it and keep the certain key word that I want. Now my question is, how can I trim the ...
1
vote
1answer
31 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
31 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
22 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
38 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
35 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
19 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
42 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
37 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
23 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
67 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
34 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
80 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
44 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
38 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 ...
-1
votes
0answers
29 views

Understanding rtree indexes [duplicate]

I m using Python rtree library provided by libspatialindex. I have data on longitude and latitude. How can I index these below data into rtree?