Questions tagged [array]

An arrangement of quantities, symbols or objects in rows and columns; a matrix

Filter by
Sorted by
Tagged with
6 votes
1 answer
149 views

QGIS - Connection Lines using geometry generator between 2 layers in a relation N-1

I would like to know if there is any way to generate a connecting line between 2 points layers (blocks-points representing a watershed, concpoints-points representing the concentration location of the ...
user avatar
1 vote
2 answers
34 views

Raster to Numpy array for aspecified area, search maximum value using ArcPy and numpy

I want to filter the maximum value within a given area using the fastest method possible. I don't want to load the input files (several 100s of full size, classified Sentinel 2 images, integer) ...
user avatar
  • 79
2 votes
1 answer
48 views

Array (Error) Array: Unrecognized type, may only use numbers or lists, found type Array

I am getting this error when trying to subtract the array with its mean value in Google Earth Engine JavaScript API var from = ee.Array([2,3]) var meann = from.reduce(ee.Reducer.mean(),[0]) var to = ...
user avatar
0 votes
0 answers
23 views

How to go from ImageCollection to array in GEE including reprojecting and resampling?

I have an image collection of which some images together compose my region of interest (in my case the Philippines) and of which some images overlap because of a different date. adm0 = ee....
user avatar
1 vote
1 answer
74 views

Converting array to polyline using Arcade with ArcGIS Pro

Arcade/ArcGIS Pro 2.9: I have an array of polyline vertices: [[[670634.3148,4862051.3579,null],[670719.3321,4862051.0072,null],[670721.44381227,4862055.2956567,null], [670724.26721751,4862059.1529319,...
user avatar
  • 756
4 votes
1 answer
58 views

Advanced labeling in QGIS to automatically get data from new fields and create arrays

I'd like to be able to easily get quick data from different projects I work in in order to avoid having to do sql queries all the time. So here's the thing, today I managed to get the following ...
user avatar
  • 43
2 votes
1 answer
109 views

Unable to write raster from array using rasterio

I have two raster files, raster1 and raster2. I want to take raster1 and divide it by raster2 and produce an output raster for this calculation. I am using python and the rasterio package. For info on ...
user avatar
4 votes
1 answer
76 views

Update array geometry field using array lat & long field in PostGIS

I have two array columns in Postgres named lat and long. Both have 1-5 values in their array field. Like the following Now I need to create geometry from each value based on the array index of lat &...
user avatar
9 votes
4 answers
368 views

Sorting alphanumeric array numerically using QGIS Field Calculator

For each street I have a list of house numbers in a column of a CSV file and I need to sort them numerically: House numbers are separated by -. name list sorted_list street A 5/A-5-4-8-3-6-9-7-1-10-...
user avatar
  • 3,627
3 votes
2 answers
108 views

Comparing arrays in QGIS

I want to compare two arrays and if they match exactly a specific value should be assigned to a field. For instance, if the values in "sumEHZ" are [A,B] or [B,C] the lower value should be ...
user avatar
  • 1,444
0 votes
1 answer
189 views

Loading data from array in popup when country is clicked in React Leaflet

I'm newbie and I have interactive web in react using leaflet library and now I need to load "title" data from array to a map. So when I click on some country, popup will show up with this ...
user avatar
  • 31
4 votes
4 answers
453 views

Replacing strings from multiple array elements delimited by commas in QGIS

In QGIS 3.18, I have a vector layer of 1000+ features with 100+ attributes, many of which are strings of concatenated elements (substrings) delimited by commas. Some of those elements need to be ...
user avatar
  • 1,001
1 vote
2 answers
96 views

How to create a NetCDF file with Albers conical equal area projection in Python

I was wondering how to create a NetCDF file with the following dimensions and variables; <class 'netCDF4._netCDF4.Dataset'> root group (NETCDF4 data model, file format HDF5): Conventions: CF-...
user avatar
0 votes
0 answers
186 views

Ploting GEE image with imshow and adding an cartopy.io.img_tiles using add_image

I transformed a GEE image in an numpy array and I'm trying to plot a this array using plt.imshow() with a background image of cartopy image tiles (cimgt) with .add_image(). However, the array and ...
user avatar
4 votes
3 answers
258 views

Get more than one elements from array in QGIS expressions using square brackets

Using QGIS expressions, if you have an array, you can get the n-th element by simply adding a number (n) in square brackets (starting with 0 for the first element). Like this, array (1,2,3,4,5,6,7,8)[...
user avatar
  • 40k
0 votes
0 answers
67 views

Using ArcPy cursor to insert polyline

I'm trying to use an InsertCursor to write code where I insert a line segment from two points in the shapefile, but I keep getting a type error explained below import arcpy, os, traceback fc = 'C:/...
user avatar
  • 69
0 votes
0 answers
15 views

How to remove an object from an array in MongoDB?

I have the following document in MONGODB. { "_id": 7000, "vehicle": "QEE 185", "driver": "30375703", "drivername": "Robin", "...
user avatar
0 votes
1 answer
172 views

Creating a dependent drop-down list in Google Earth Engine [duplicate]

I am trying to create a dependent drop-down list in Google Earth Engine that will respond to the input from the first list. I am basing this off an example provided by Google Developers... https://...
user avatar
3 votes
2 answers
228 views

Array for_each in QGIS

Is there an expression in QGIS for array for_each to get the element from the output of geom_to_wkt($geometry) of the polygon and correspondingly transform the element (using the expression of LAT ...
user avatar
3 votes
2 answers
138 views

Compare strings, extract unique values from one (QGIS)

In QGIS 3.18. I am looking for a field calculator expression able to return the values of a string (comma separated) in Field B which are not* also values of a string in Field A. For example: Field ...
user avatar
  • 1,001
0 votes
1 answer
37 views

Displaying regions from a list in GEE

I have generated a list with States of India but getting the following error while trying to display a region on the map. Line 11: centerObject() requires a Geometry or Element. Got: Karnataka '...
user avatar
  • 27
0 votes
0 answers
132 views

Acquiring data point coordinates from Geotiff and converting to numpy array

I would like to use scipy.interpolate.griddata to interpolate my Sentinel-1 products (see two sample images below) taken from different orbits resulting in having the uniform datapoint coordinates. I ...
user avatar
0 votes
1 answer
44 views

Flipping range of values in array or raster

I have a continuous raster with a range of 0.135 - 0.921 and I want to flip the range or invert it, so the values are min becomes max and max becomes min. I've tried using np.flip() but that results ...
user avatar
  • 419
1 vote
0 answers
31 views

ArcPy: Populating array column with rank values

I am trying to get the rank values for some values in my fields. I have created an array from fields of an attribute table, sorted them in descending order, and I now want to populate the third column ...
user avatar
3 votes
1 answer
101 views

QGIS expressions: remove several elements at once from an array

The problem Using QGIS expressions with QGIS 3.20, I have an array and I want to exclude a number of elements from this array. Let's say my array is [1,2,3,4,5,6], but I want to get an array like [1,2,...
user avatar
  • 40k
0 votes
1 answer
99 views

Get Numpy array from SHAPE@WKB token

I am trying to get a numpy array from the SHAPE@WKB token that is obtained either using FeatureClassToNumpyArray or cursors, however what I get does not make much sense. Specifically I am interested ...
user avatar
0 votes
1 answer
65 views

Python array based alternative to GRASS r.cost

I am looking for a numpy array based alternative to the GRASS r.cost function. I have a friction surface raster where the value of each cell corresponds to travel time. I would like to find the cells ...
user avatar
  • 1
3 votes
1 answer
51 views

How to count number of attributes and then link back to road network - pgrouting

I have created generated a many-to-many shortest distance route using pgRouting. The output table displays the typical pgRouting outputs (seq, path_seq, edge, node, cost etc.) as well as the road ...
user avatar
0 votes
0 answers
91 views

Visibility Analysis Plugin (QGIS 3.18.3) Returning multiple errors

I am trying to run a viewshed analysis in QGIS 3.18.3 using the Visibility Analysis plugin. I have followed the steps entirely in both of these videos: https://youtu.be/pt1gFXON7W4 https://youtu.be/...
user avatar
  • 1
0 votes
0 answers
45 views

Is there a way for apply point.distance on an array instead of doing double for loop?

I am using the code below to find a distance between one point and a line, but I have a grid of points, and I want to optimize it so I don't have to do double for loop. Is it possible to apply point....
user avatar
  • 1
1 vote
1 answer
32 views

Calculating a single number fra an array in field calculator using other fields

For my final project, I would like to assess the earthquake risk of populated areas in California. For this I have two multipolygon layers containing data for Earthquakes, and populated areas ...
user avatar
3 votes
1 answer
77 views

Calculate the sine of a raster in the power of y / Python

I have this code and my aim is to calculate the sine of my raster in the power of 0.8. import os os.chdir('D:/NOA/Soil_Erosion/test_Project/Workspace/Input_Data_LS_Factor') import rasterio ...
user avatar
7 votes
2 answers
262 views

How to handle the "allow multiple selections" in "Value Relation Widget" results? (QGIS Form)

Using the "allow multiple selections" in "Value Relation Widget" results in {value1,value2,...}. But arrays in QGIS are written like ['value1','value2',...]. How do I handle the ...
user avatar
  • 7,653
0 votes
1 answer
125 views

Searching a value from lists, get repeated results and append results to list in Google Earth Engine

Before, I asked that for search or filter values in two-segment list in Google Earth Engine at this link(Search or filter values in two-segment list in Google Earth Engine) and this question is ...
user avatar
1 vote
1 answer
29 views

Having trouble concatenating with Arcade across fields and having No Data when all columns are empty

I have data that needs to be in a pop-up that is contained across several fields. If the fields have no data, I would like the pop-up to say "No Aviation Resources". Here is what I have so ...
user avatar
  • 11
1 vote
2 answers
143 views

Aggregating elements of array using QGIS

In QGIS 3, are aggregate functions over a set of array elemnts possible? As simple as in the form of: aggregate(array:=array(1,2,3), aggregate:='mean') I'd use it for the task to get an average for an ...
user avatar
  • 1,806
0 votes
1 answer
40 views

Convert Image Band Values from Array into Number

I am trying to convert the pixel values that appeared to be an array (see the snapshot below) into numeric. In its current state, every time I tried implementing reduction, I got an error: Input to ...
user avatar
3 votes
1 answer
208 views

How to sort multi-column lists by first or second column in Google Earth Engine

I have a list with two-segment. var list = ee.List([ [101, 102], [102, 103], [103, 104], [106, 100], [104, 105], [105, 106], ]) How can sort this list by first or second column?
user avatar
1 vote
0 answers
17 views

Comparing two same-shape band arrays, one against a set of conditions to then change the other one

first band and second band can be assumed to be the same shape. I want to test the second band against two conditions (that it's not "invalid_data" and the value is one of the numbers in &...
user avatar
4 votes
1 answer
319 views

Using PostGIS to find the overall difference between two (large) polygon datasets

I need to get the Difference of an input layer with ~30k polygons and an overlay layer with ~500k polygons (of which ~200k intersect the input layer). I am trying to learn PostGIS to do this, as it ...
user avatar
  • 155
1 vote
1 answer
725 views

Convert a large RasterStack to Array in R

I am trying to transform a large RasterStack to an array in order to compute some extraction. The classical approach raster::as.array() is not working since the files are very large and it's taking ...
user avatar
  • 51
2 votes
1 answer
264 views

Converting 2D array image to table using Google Earth Engine

I'm trying to get a table from a 2d-array image. Basically, the Image (called segmentationInfo) looks like this: The 2-D ‘LandTrendr’ annual segmentation array looks like this: [ [1985, 1986, 1987, ...
user avatar
  • 237
3 votes
1 answer
165 views

Automatically create an array of all visible layer names in QGIS

How can I get an array of all visible layer names automatically using QGIS expressions? In principle it should work with the variable @map_layers. Using the following expression works fine for what I ...
user avatar
  • 40k
1 vote
1 answer
100 views

Convert a 2D list of numbers to a ImageCollection with constant values in Google Earth Engine

I have climate indices values as lists and I tried to make the lists into an imageCollection. However, when I tried to use map function, var climate_indices = ee.ImageCollection.fromImages( years....
user avatar
1 vote
0 answers
437 views

Using a shapefile as mask with rasterio mask gives different affine transforms with rasters of the same projection and resolution

I have a list of n file paths to geotiffs of the same resolution and projection but with varying extents. In brief the goal is to use Rasterio's mask module to use a shapefile containing a single ...
user avatar
  • 167
6 votes
1 answer
1k views

QGIS - Expression to aggregate values from an array

In a calculated field in QGIS 3.10.2 I wan't to aggregate values from an array field. For this aggregation I'm using a filter to compare matching id's and return value from another field. I can ...
user avatar
  • 1,305
2 votes
0 answers
65 views

Defining an array as a variable in QGIS

I want to use array_first(@myArray) to get the first value of myArray in a data defined box. myArray is defined in the project variables, but I can't find the correct syntax. I tried : (1, 2, 'abc') [...
user avatar
  • 1,035
4 votes
1 answer
243 views

Join on field with multiple values

I have a field "istat" that contains multiple values ​​of the istat code (municipal code): and a table containing the centroids of the municipalities I am looking for a way to join the &...
user avatar
2 votes
1 answer
121 views

Commit error when splitting several polygons with "array type" attribute (PostGIS / QGIS)

I have a simple PostGIS table : CREATE TABLE public.elem_p ( gid integer NOT NULL DEFAULT nextval('elem_p_gid_seq'::regclass), liste character varying[] COLLATE pg_catalog."default" ...
user avatar
  • 161
1 vote
0 answers
244 views

Save the array labels in a new array [closed]

I have several arrays obtained from K means, each array contains a variable number of classes, e.g. from -1 to 3, from 0 to 4, from -1 to n. I would like to be able to save each class of an array as a ...
user avatar
  • 365