Skip to main content

Questions tagged [code-review]

Questions requesting a review of working code should be asked at the Code Review Stack Exchange

Filter by
Sorted by
Tagged with
0 votes
1 answer
73 views

Getting GEE data faster

I need country-month level nighttime lights data. I have already printed the data using the minimum example on the https://code.earthengine.google.com/ platform, but the current problem is that it ...
Jane's user avatar
  • 1
0 votes
0 answers
47 views

Using reducers in GEE to calculate mean monthly precipitation from hourly data

Using the Copernicus ERA5-Land Hourly dataset as an ImageCollection, I want to calculate average monthly precipitation data for 344 climate divisions in the US as a FeatureCollection. The climate ...
Summer Olsen's user avatar
1 vote
1 answer
40 views

Runtime in ArcPy versus ArcGIS Pro

I have at least two hundred huge TIFF rasters that I'm trying to process into floodplain polygons. They are cursory flood depth rasters for pluvial, fluvial and coastal flooding. First, I need to set ...
Tebetheia's user avatar
0 votes
1 answer
27 views

Using ArcPy to Intersect Line and Polygon Features of the Same Name

I have a file geodatabase containing line and polygon feature classes of the same name. Below is an example: NATGAS_6IN_Line NATGAS_6IN_Polygon CAD_ARD_6IN_Line CAD_ARD_6IN_Polygon I have 20 line ...
BNew's user avatar
  • 11
0 votes
0 answers
49 views

Error in rep.int(sep, ncolumns - 1) : invalid 'times' value in bayesx function [R2BayesX package] in R

I am trying to run a STAR model within the R2BayesX package using the bayesx function. My model works with the cases of leptospirosis in Colombia ('observed' and 'expected') by department in a ...
Armando_Pezo's user avatar
0 votes
0 answers
73 views

Interpolate raster value using Python

I'm new in coding. I have a shapefile (points) and 15 raster files My purpose is get the values from all raster to point (each point will get value from 2 or 3 nearest cell baseed on distance of the ...
Long nguyen duc's user avatar
1 vote
1 answer
158 views

Optimizing Google Earth Engine code

How can I optimize this code? I know using .getInfo is bad, but I'm not sure how to work around that var dataset = ee.ImageCollection('USDA/NAIP/DOQQ') .filter(ee.Filter.date('2021-...
Zoaib Sihorwala's user avatar
0 votes
0 answers
25 views

Get Geometry of Inserted Point [duplicate]

Description I have a project that must create default values in fields when he is trying to insert a new feature. As shown in the figure beneath. I'm using PyQGIS 3.28 Problem In the image below, ...
Diogo Barros's user avatar
0 votes
1 answer
75 views

Geometry of recently created point

Description I am currently working on a project that requires the creation of default values in certain fields when attempting to insert a new feature. This operation is illustrated in the figure ...
Diogo Barros's user avatar
0 votes
1 answer
255 views

Faster way to compute Moran’s Index from a very large distance matrix between geographic points

I am computing Moran’s Index from a very large distance matrix between geographic points. The time to execute the code is too high. I used the dism function in the geosphere package. Here a ...
Pierre's user avatar
  • 395
-1 votes
1 answer
64 views

ERROR 000539 when trying to calculate a field and using code block [closed]

I was given these instructions for an assignment: However when I am trying to calculate the field I keep getting this error: I am trying to calculate the field to get something like this:
Mason's user avatar
  • 17
3 votes
2 answers
154 views

Improving ST_Intersects performance in PostGIS

I have the following query, but it takes a long time to run. I tried creating an index, but there hasn't been much improvement. Any suggestions? CREATE INDEX temp_clusters_geom_idx ON temp_clusters ...
user3222101's user avatar
0 votes
1 answer
211 views

Clipping LAScatolog with a large polygon shapefile using is extremely slow

I´m using the lidR (Version 4.0.0) package to clip a LAScatalog (with 119 .las files, ~52.9 Gb) using a very large polygon shapefile (~865K buffers with 25m diameter each). I´m stuck in this task ...
Rui's user avatar
  • 9
0 votes
1 answer
555 views

How can I automate a consolidated back up of all AGOL feature layers with python? [closed]

What I've Tried: I have used the script in this article before. However it does require more input than I would like, and the feature layers are downloaded as individual FGDB instead of into a single, ...
Austin Averill's user avatar
1 vote
0 answers
120 views

Speed up intersection on large polygons with PyQGIS?

Is there a way to speed up my script? I am new to PyQGIS. I am using QGIS 3.16. What I need: I have 50 polygons (up to 1.675.000 hectares, mean 420.000 ha; one shapefile per polygon) and for each of ...
Pompoensoep's user avatar
0 votes
1 answer
96 views

Chart of 14-day cumulative rainfall

I need to chart/download a list of 14-day summed precipitation values, and I was not able to get this script to run. I seem to be running into an error related to the 'system:time_start' property. I'm ...
brbell01's user avatar
0 votes
0 answers
235 views

Seeking fastest way to export Google Earth Engine feature class

I have a list of 3800 coordinates which corresponds to the air pollution monitoring stations. I am using python API to extract "MODIS/006/MCD19A2_GRANULES" for those points and export the ...
Saeed Nadi's user avatar
4 votes
0 answers
79 views

Looking up whole time-series for specific point from 45 GB file

I want to look-up 8760 times for a single lat/lon combo in less than a second from 43.82 GB file of wind data containing: 8760 times (every hour in a year) 721 latitudes (every 0.25° from -90.0° to ...
user212905's user avatar
0 votes
0 answers
167 views

Speeding up WFS layer search in OpenLayers using CQL_FILTER?

I have a function to search feature in my layer and zoom, highlight to search results. But my data is quite large with more than 1 million lines so it takes quite a while for a result to be displayed. ...
Jayzz's user avatar
  • 85
2 votes
0 answers
187 views

Improving performance of spatial intersection and aggregation query

Edit: Per a comment, here is some more context and the basics of what I'm looking to do, that I think would better enable someone to offer input from a first principles perspective. Its a lot of ...
mtreg's user avatar
  • 292
1 vote
1 answer
657 views

Treat NA as 0 in custom function for lapp in {terra} R library

I am trying to use the lapp function from the terra rstats library to do some raster-math. But when cells have NA in them, it is giving me the 'wrong' result. Here is my current function and result. a ...
TheRealJimShady's user avatar
0 votes
0 answers
738 views

A faster way to extract geometry xy of geodataframe

I need a faster way to extract geometry xy of a large dataset which is in a geodataframe format. I have developed a lambda function as below to do that but I need a faster way. The following is a ...
rgholizadehr's user avatar
1 vote
0 answers
60 views

Get file path of Geopackage with PyQGIS [duplicate]

I want to get the Geopackage file path where my layer is stored in. Layer = QgsProject.instance().mapLayersByName('DAT')[0] print(Layer.source()) But this only gives me the path with layer pointer: /...
Nunkuat's user avatar
  • 495
0 votes
0 answers
544 views

Optimizing code to run faster in Google Earth Engine

I am trying to query properties (~10) from Earth Engine datasets (Temperature, Precipitation, GLDAS outputs, etc.) for a given coordinate point and time range in my dataset (90,000 points). I’ve done ...
Akhila Ram's user avatar
2 votes
1 answer
81 views

Reducing number of for loops in ArcPy code

I want to clean this code in such a way that there are not so many for loops. For loops in the following code are placed to trap FCs in multiple group layers and do some work on them. My Data in TOC ...
Abdul Rauf's user avatar
1 vote
0 answers
40 views

TPI calculation by PDAL [closed]

Is there a convenient way to calculate the topographic position index by PDAL? I have LAS file and what I do is iteratively for every point calculate the TPI. The coordinate information I take from ...
Марина Лисниченко's user avatar
0 votes
1 answer
246 views

Export image collecton with name using Google Earth Engine

I am using GEE for a new collection of images and I need to export it by automating the name of each image, for example, that month one is called January, and so on, how can I do it? My code is here: /...
María's user avatar
  • 15
0 votes
0 answers
204 views

Loop over dataframes and extract specific values to generate multiple rasters/plots

I would seek help to revise this script. I need to generate multiple plots. For example, the following code works well ggplot and gsave but I would prefer to use raster, and I tried something such as ...
Amber's user avatar
  • 39
0 votes
0 answers
371 views

Optimizing minimum distance calculations between multiple polygons in R

I have a list of polygons and would like to create a minimum distance matrix by calculating the minimum distance between each possible pair. I am currently using the code below, but this is running ...
mnicolai's user avatar
0 votes
0 answers
84 views

Speeding up my Python code for reading from Excel, performing geospatial analysis and writing to Excel files

I have written a Python snippet that reads lat and long stored in an Excel file. Converts them to a point which is then used to perform multiple geospatial analysis including buffer, intersection, and ...
alauddin's user avatar
1 vote
0 answers
1k views

Downloading and merging 0.5 minute WorldClim data for (long) list of coordinates using R

I want to download temperature and precipitation data from WorldClim for a huge list of coordinates. I am working in R, and have a solution using getData() from raster(), but it's going to take ...
Thomas's user avatar
  • 111
-3 votes
1 answer
102 views

Reducing number of lines / more efficient coding method for field maps [closed]

I am looking for ways to reduce the number of lines when making field maps in ArcPy (note, I am using ArcPy with ArcMap 10.6). I cannot seem to figure out a way, and am stuck with a significant amount ...
Ayayayayaoh's user avatar
0 votes
1 answer
276 views

Calculating Rumple_Index for clipped Inventory Plot LAS files

I have successfully implemented the Rumple_Index example provided in the LidR book. I am now trying to calculate the same Rumple_Index for my forest field plots. I am trying to integrate the ...
M-Woods's user avatar
  • 11
1 vote
1 answer
139 views

Improving PyQGIS distance matrix efficiency

I have written a custom processing tool, which I use within a large graphical model in QGIS. I am looking for a way to speed it up. First step of this processing tool is to connect every point of one ...
MrXsquared's user avatar
  • 34.9k
1 vote
1 answer
5k views

Converting TIFF file and changing CRS

Is there a fastest way to: Load a .tif file; Convert it into GeoDataFrame; and Change Coordinate Reference System? I am using Python, and what I tried to do is: Use rasterio to check if the Source ...
traveller's user avatar
-1 votes
1 answer
813 views

Problem Visualizing and Downloading LANDSAT 5 Images With Google Earth Engine

I am new to GEE. I'm working with Landsat images. First, visualizing them in the map, then downloading them and working with them afterwards in QGis 3.6 to obtain certain indexes (NDVI, NDWI, Wetness) ...
AlbertoH's user avatar
1 vote
1 answer
1k views

Easier Way to Record Yearly Mean NDVI

For my Google Earth Engine project, I am finding the mean NDVI for each year between 2000 and 2020 in protected areas a part of the World Database on Protected Areas (WDPA). As an example, I have ...
Laura Mills's user avatar
0 votes
1 answer
122 views

How do I add the soil moisture data I am trying to get onto my Google drive?

Here is my code How do I add the soil moisture data I am trying to get onto my Google drive? var dataset = ee.ImageCollection('NASA_USDA/HSL/SMAP_soil_moisture') .filter(ee.Filter....
Megan Ani Mirkhanian's user avatar
1 vote
2 answers
207 views

Making ArcPy code run faster

I have an ArcPy code that I am using to find various characteristics about certain watersheds in Indiana. I start with a shapefile of all 800 watersheds and go through it row by row and perform a ...
Shannon 's user avatar
0 votes
0 answers
210 views

Error when displaying progress bar

My initial code read an image, apply a median filter to it, and save the smoothed image. It looked like this : #Image reading rasterpath = r"C:/Users/SIEXT5646/Desktop/Donnes/2018_gris.tif" ds = gdal....
Caroline_GR's user avatar
4 votes
2 answers
4k views

Filling dictionary with list of row attributes using arcpy.SearchCursor

I have a dBase database file and I'm viewing and editing the table in ArcGIS Pro. I want to use the arcpy.da.SearchCursor function to fill a dictionary and create a key-value pair by iterating ...
user128371's user avatar
2 votes
1 answer
449 views

Creating NDVI from raster using ArcPy

I have to create NDVI's for multiple raster images, and so want to find out the most efficient way to do it. The code below works, but I wondered if there was a more efficient way to do it? # ...
Andrew Einhorn's user avatar
6 votes
1 answer
391 views

Optimizing Intersection Area Loops on big layers using PyQGIS

Using 3.10.1-A Coruña on Windows 10 I am looping over some (10) national shapefiles and finding intersection and areas but the process is very slow. I have two loops - one loop for each postcode and ...
Corpuscular's user avatar
0 votes
0 answers
2k views

Tool script for GeoJSON to Shapefile

I am creating an ArcMap tool script that takes user input and then takes a GeoJSON file from a specified folder and then opens it in ArcMap as a shapefile. The issue I am running into is that I am ...
Pierce_h's user avatar
3 votes
0 answers
541 views

Alternative to Rasterio Mask module for clipping a raster using masked geojson

I am clipping a raster (.tif file) using a mask vector (.geojson) file. with rasterio.open(url) as src: out_image, out_transform = rasterio.mask.mask(src, shapes, crop=True) But, this ...
Sreeraj's user avatar
  • 729
1 vote
1 answer
72 views

Improving ArcPy script for ArcMap to only return rows of selected polygons instead of all polygons in layer

I am debugging a code provided to me that merges two polygons and alters the fields of "FID1' and "CALC_AREA." I have realized that the current code searches every layer in the map document for ...
Pierce_h's user avatar
0 votes
1 answer
58 views

Creating dictionary of link and its adjacent links (having common vertex) in ArcPy

How do I create a dictionary that has the linkID of a link as key and linkID of touching links as values? I have used this code in ArcPy but it takes a very long time. arcpy.CopyFeatures_management(...
pnkjmndhl's user avatar
  • 794
0 votes
1 answer
1k views

Google Earth Engine : error: Cannot use 'in' operator to search for 'type' in {"type":"LinearRing","coordinates":

I'm trying to export Sentinel-1 bands with this code in Google Earth Engine but I have recently this error: Cannot use 'in' operator to search for 'type' in {"type":"LinearRing","coordinates": I ...
madyouni haifa's user avatar
1 vote
0 answers
178 views

Optimizing Google Earth Engine cloud cover for Sentinel 5p

I am trying to generate cloud free Sentinel 5p images, I have a basic cloud detection code working but it runs very slowly (most likely due to nested map and reduce features). Is there a way to do ...
tanvi jain's user avatar
2 votes
0 answers
411 views

Making Dijkstra faster

I would like to compute shortest path between 2,5 millions pairs. I created table with id, origin, the nearest node of origin, destination, the nearest node of destination. I also created index on ...
Michal De's user avatar
  • 205