Questions tagged [python]

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

Filter by
Sorted by
Tagged with
-1
votes
0answers
23 views

Python Script that flags incorrect attribute numbers based on another attribute's number [on hold]

I have an Excel file that contains two columns. One column is a shape area field for impervious surface and the other column is a stormwater fee constant based on the impervious surface. The ...
1
vote
0answers
9 views

Infere stops and traffic signal from GPS traces

I work in a hive database of GPS traces. I would like to know whether there is a library in Python or in R (OR SIMILAR PROJECTS) that deals with the same. My approach is to calculate distance between ...
0
votes
2answers
83 views

Integrate JSON file inputs (specifically latlng) in Leaflet with JS

It's my first time using Leaflet and I wanted to simply put two markers based from my inputs. I managed to connect my JSON file with the JavaScript and the only problem I have is how to dynamically ...
1
vote
1answer
28 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 ...
0
votes
1answer
45 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': ...
0
votes
0answers
11 views

Speed- and COG-aware trajectory interpolation/resampling using Python

I have a set of ship trajectory points that were irregularly sampled and I would like to resample them to a fixed frequency (e.g. every minute). Rather than just linearly interpolating between ...
1
vote
1answer
45 views
+50

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

Horizontal color lines artifacts / bug with GDAL Tiff

I would like to document a bug I encountered, and scratched my head against several hours: I wrote a python script for extracting (cropping) many images from a big TIF image. I used both gdal....
1
vote
1answer
29 views

Find in between coordinates for the given latitude and longitude from a CSV file

I have a CSV file which has the latitude and longitude values for the start and the end coordinates as follows. In these the first lon and lat values are the start point then the second coordinates ...
3
votes
1answer
23 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 ...
1
vote
1answer
209 views

Windowed writing in rasterio?

I have two large datasets, RP1 and RP2. I would like to subtract one from the other, however the datasets are extremely large and so exit out with a MemoryError when I try a direct read: RP1 = ...
1
vote
0answers
27 views

Downloading XYZ tiles within QGIS? [duplicate]

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 ...
0
votes
1answer
253 views

How to select all points inside a polygon in PostGIS?

I have a table samplecol that contains (a sample): vessel_hash | status | station | speed | latitude | longitude | course | heading | timestamp | the_geom ...
1
vote
0answers
22 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
1answer
50 views

Compiling PDAL with both Python2 and Python3 bindings support

I would like to build PDAL with both together support for Python2 and Python3 bindings (on Ubuntu 16.04). Fig. 1: Screenshot of the Python stuff within cmake-gui. How could I achieve this? If a ...
16
votes
5answers
39k views

Finding if two polygons Intersect in Python?

I'm looking for an algorithm, a high level solution, or even a library which can help me determine if two polygons intersect, in Python. I have the vertices of the two polygons (These are single part ...
3
votes
2answers
712 views

QGIS using the heatmapplugin from the console

I have to make a lot of heatmaps from csv's. Therefore I'm making a python script to run in the console. So far I can load csv's and save them as shapefiles. To get to the heatmapplugin I'm using the ...
0
votes
0answers
26 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 ...
2
votes
1answer
62 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 ...
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 ...
1
vote
0answers
22 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 ...
1
vote
1answer
132 views

Converting NetCDF dataset array to GeoTiff using rasterio Python

I have read a NetCDF file using the netCDF4 library and then read one of its datasets ("Evapotranspiration") into a variable (variable contains array) using the following code. Subsequently now I am ...
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
21 views

gdal FlattenTo2D makes geom null

I have a df that has geoms as ogr geom in 3D. I was trying to convert to 2D but it empties out the geom. ipdb> df['default_geom'][0] <osgeo.ogr.Geometry; proxy of <Swig Object of ...
2
votes
1answer
70 views

Enabling tile caching for layer?

I published around 1000 layers in geoserver without enabling tile caching for layer. How to check a cache is enabled for a layer or not? How to enable tile caching (check box) for a layer under ...
2
votes
1answer
26 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/#/...
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 . ...
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
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....
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 ...
2
votes
0answers
21 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
0answers
26 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
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 ...
11
votes
3answers
1k views

Histogram Matching using Python to improve mosaicking process of multiple overlapping rasters?

I am trying to do histogram matching using Python to improve the mosaicking process of multiple overlapping rasters. I am basing my code on that found at: http://www.idlcoyote.com/ip_tips/histomatch....
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
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
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....
0
votes
0answers
23 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 ...
0
votes
1answer
33 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 ...
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 ...
-3
votes
1answer
16 views

run function multiple times [closed]

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 ...
2
votes
2answers
102 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
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='...
1
vote
1answer
218 views

Unable to find either renderd.py or generate_tiles.py?

We created a Ubuntu 14.04.1 LTS x64 OSM tile server from packages using the excellent instructions provided by http://switch2osm.org/serving-tiles/building-a-tile-server-from-packages/ The tile ...
2
votes
2answers
155 views

PyQGIS (3.2) and H5PY DLL problem

I am working in a project in which I need to use PyQGIS and H5PY. The problem comes when I load qgis library and h5py, for example: import qgis import h5py I get this error: from ._conv import ...
0
votes
1answer
50 views

Geopandas intersects/contains fails between GeoDataFrames

I am struggling to make the GeoDataFrame functions: intersects/contains work between GeoDataFrames instances. Let t be a GeoDataFrame with contents: id ...
3
votes
1answer
67 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 ...