Questions tagged [dictionary]
is an abstract data type composed of a collection of (key, value) pairs
107
questions
1
vote
1
answer
37
views
Issue with GEE remap function
I am running into a strange error that I cannot seem to fix.
I want to reclassify an image in Google Earth Engine using lists. The values in one list bins represent the pixel values in the raster ...
1
vote
1
answer
153
views
Reading single feature as dict into GeoDataFrame with GeoPandas
I have a Leaflet map where a user can select a feature and be able to download some data for that feature. I'm getting the object like this to pass to Python:
data = {
"type": "...
0
votes
2
answers
34
views
Filter an ee.Dictionary by keys
Is there a way to filter an Earth Engine dictionary by keys?
var dict = ee.Dictionary({
"date": ['2020-10-02', '2020-10-04', '2020-10-02', '2020-10-01'],
"count": [1, 1, 3, 2],
...
1
vote
1
answer
63
views
How do I turn dictionary object values into columns for .csv export?
I've trained a random forest classifier, and classifier.explain() gives a dictionary containing the following keys:
0: classes
1: importance
2: numberOfTrees
3: outOfBagErrorEstimate
4: trees
I store ...
0
votes
0
answers
27
views
GEE error: 'Dictionary does not contain key: soil_moisture_am'
I am creating a FeatureCollection "randoms" that stores random points along with the field 'IDate', storing random times in milliseconds since 1970 (code below).
var randoms = ee....
0
votes
0
answers
28
views
Reference dictionary keys in ArcGIS Tool Validation
I have a Python script that is stored in a custom toolbox in ArcGIS Pro. The script has a dictionary myDict that I want the keys of to appear as a drop-down list as an input for the tool.
I know how ...
0
votes
0
answers
53
views
Update field using dictionary and list
I have two layers, layer A and layer B. I need to update the SC field on layerA from layerB SC_1 field. I have the following that does a spatial join, then use a Distinct list to populate the SC_1 ...
0
votes
0
answers
48
views
ArcGIS Pro - Labels inside polygon a set distance from boundary
I am using an abbreviation dictionary with my labels, however sometimes the label is too close to the polygon boundary so I'd like to set a "distance from the polygon boundary" threshold ...
0
votes
1
answer
64
views
PyQGIS seems to be converting dict into QVariant
I created a PyQGIS plug in that creates loops over the features on a layer to create the body of an API post request. However, when I try to run that API call I get an error telling me the json ...
0
votes
1
answer
87
views
Find duplicates and merge attributes arcpy
I have a point shapefile which has duplicate points based on an "ID".
ID1 + permit1 + resources associated to permit
ID1 + permit2 + resources associated to permit
ID2 + permit1 + resources ...
0
votes
0
answers
36
views
FeatureCollection (Error) Dictionary.get:
I am new in code editor, i followed a video on this code,in the video it is running correctly without errors, but i get FeatureCollection (Error)
Dictionary.get: Dictionary does not contain key: ...
3
votes
2
answers
90
views
AttributeError when calculating area in hectares in PyQGIS
I want to calculate the area of the polygon and add it to the attribute table as another column. I used this script:
from qgis import processing
inlayDir = iface.activeLayer()
P3_boundary = r'C:\...
0
votes
1
answer
84
views
Using Python dictionary to update street type in another field in ArcGIS Pro
I am using a dictionary to update street type in another field in ArcGIS Pro 3.0.3
I am a novice python user and I am having problems updating a string field with a dictionary.
I am joining ...
1
vote
0
answers
133
views
How to fix list brackets for list of coordinates [closed]
I am trying to populate an empty list with pairs of coordinates taken from a dictionary of pairs of coordinates.
Here is my code that is creating this list:
#Skip shorter rows
if ...
0
votes
1
answer
125
views
Subtract Dictionary Values in Google Earth Engine
I have been trying to subtract a dictionary value from another in Google Earth Engine but it returns Nan
var dict = ee.Dictionary({
B1: 182,
B2: 219,
B3: 443
});
print(dict.get('B1'));
print(...
0
votes
2
answers
307
views
Using variables within function to assign values into dictionary using Google Earth Engine JavaScript API
I'm building a function that updates a dictionary (in a feature of a FeatureCollection) with values calculated within the function.
I use the variables 'HighDeg', 'MildDeg' and 'NoDeg' to store the ...
0
votes
1
answer
90
views
Sorting a dictionary according to the key
I have made a dictionary with two lists in Google Earth Engine and I want to sort them according to the "xVals" in the code. By default, the order is improper. I need it in ascending order ...
4
votes
1
answer
163
views
Filter attribute information based on three different parameters and return ids using PyQGIS
I am having an attribute table information for line features. Each Line feature has LINK ID's which are supposed to be unique but in some places are repeating. Also I have a field "NEW" ...
0
votes
0
answers
105
views
ArcPy merge output only has the first feature class in list
I have a script that generates several feature classes. I use a function to create the feature classes within a loop. The loop outputs a dictionary with a name string as key and the feature class path ...
0
votes
1
answer
64
views
Creation of linked dictionaries using PyQGIS
My layer contains buildings. They have a number (num), a height and a height class (h) between 1 and 4.
The script aims to for each building list:
the neighboring buildings (NEIGHBORS),
the heights ...
0
votes
1
answer
161
views
Creating layer from Python dictionary using ArcPy
I'm writing a script to find duplicate cables in a layer. I want to create a layer from the result to find the closest cables to those already cut with ArcPy but I can't find a way to do it.
The ...
0
votes
2
answers
206
views
sort dictionary datasets based on values in ascending order
i want to sort my dataset and use an example dataset to chack the code. that works and here is the code:
var b=ee.List([4.5,2.8,7.4])
var c= ee.List(['a','b','c'])
print('b',b)
var dict=ee.Dictionary....
1
vote
1
answer
2k
views
Sorting dictionary values and getting sorted keys in new dictionary using Google Earth Engine
How can I sort a dictionary's keys in Earth Engine based on their values?
For example, I have such a dictionary defined in Earth Engine after some calculations and I want to sort that based on ...
0
votes
1
answer
301
views
Implementing ArcPy Describe function into file dictionary
I'm currently using Python to create a dictionary when given a user input argument, collects the file data types and names in the dictionary determined by the ArcPy Describe function, so the output ...
0
votes
1
answer
114
views
Landcover image coverage of each class in study area
I want to define a dictionary with landcover type and their coverage in my study area.
I wrote the code as below,
but it is not working as I want.
How can I define a dictionary or another datatype to ...
-1
votes
1
answer
222
views
Creating a dictionary using data types from user input
To better organize data, I want to create a dictionary that takes a directory path as an argument and groups the items by datatype (for example: u'ShapeFile': ['abc.shp']). However, I run into an ...
0
votes
1
answer
227
views
Update cursor with nested dictionary with ArcPy
I'm trying to update a mosaic dataset tables attributes with values from a CSV. The CSV and dataset share a field that uniquely identifies each record, and all of the fields to update have exactly the ...
0
votes
1
answer
297
views
Create Dictionary Symbology in ArcGIS Online
After some struggling I have been able to create my own dynamic symbols using the Dictionary Symbology in ArcGIS Pro. It does exactly what I want, stacking different symbols based on attribute values ...
1
vote
1
answer
688
views
Converting CSV file with polygons in dictionary format into GeoDataFrame [closed]
I have a CSV file with data in below format. I want to read this using Python into a GeoPandas' DataFrame where boundary becomes geometry. I'm not even sure where to begin with.
pincode city ...
1
vote
1
answer
214
views
Using .CSV file as an external dictionary, but can't find a way to reference/make a key for Null in order to assign it a value using ArcPy
I am using ArcGIS Desktop: ArcMap 10.8.1 and using Python 2.7.18. I have a script that uses a .CSV file as an external dictionary (opposed to creating a dictionary within the script) but I cannot find ...
1
vote
1
answer
716
views
Extracting data from earthengine object in colab notebook (Python)
I'm using Earth Engine with the Python API in colab, reducing Landsat NDVI over a ROI. I run the following:
imagereduce = image.reduceRegion(**{
'reducer': ee.Reducer.mean(),
'geometry': ...
2
votes
0
answers
249
views
How to remap GDAL options from string version to a dictionary version
I'm using gdal.warp to merge some files (see this former question of mine). I'm trying to use a dictionary instead of a long string to configure the options. However I'm having funny results with ...
1
vote
1
answer
678
views
Using SearchCursor and UpdateCursor to get multivalues from one table/field to single value of another table/field?
I'm trying to use a combination of arcpy.da.SearchCursor and arcpy.da.UpdateCursor to read and store a couple of values from Table 1 Field A, then insert those values as a single string within Table 2 ...
3
votes
1
answer
343
views
Accessing Python dictionary by field value in QgsExpression
I'm writing a QGIS processing plugin. In this plugin, I use the processing algorithm pointsalonglines, and for the distance parameter, I'd like to use an expression which gives back the value of a ...
1
vote
1
answer
993
views
Setting value, key pair in Dictionary using Google Earth Engine JavaScript API
A simple script in the Google Earth Engine code editor,
var dict = ee.Dictionary();
dict.set('num', 10);
print(dict);
gives Object (0 properties) as the output
even when i do print(dict.keys()) or ...
1
vote
0
answers
78
views
UpdateCursor is only updating the first letter from the value of my dictionary [closed]
I am using an update cursor to update an attribute field with the value of my dictionary. Both the field and the value are strings. I am confused why the update cursor is only updating the field ...
11
votes
5
answers
2k
views
Getting dictionary for each feature with their attribute values using PyQGIS
I need to obtain, for each feature of a layer, a dictionary with the attribute names and their values using PyQGIS.
I can get all the attributes of the layer using:
from qgis.core import QgsProject
...
0
votes
0
answers
51
views
Getting a dictionary for each feature of a layer with their attribute values using PyQGIS [duplicate]
I need to obtain, for each feature of a layer, a dictionary with the attribute names and its values using PyQGIS.
I can get all the attributes of the layer using
indiv = QgsProject.instance()....
0
votes
2
answers
206
views
ee.Dictionary.set('var', null)
How can one set google earth engine dictionary value to null?
The code ee.Dictionary.set('var', null) results in the error Dictionary.set: Parameter 'value' is required.
I am mapping through an image ...
2
votes
1
answer
11k
views
Solving "Mixing dicts with non-Series may lead to ambiguous ordering" error
I am trying to analyze GeoJSON data using Pandas library but getting this error:
Mixing dicts with non-Series may lead to ambiguous ordering.
How am able to eliminate the error since the output i ...
1
vote
1
answer
2k
views
How to get dictionary value from reduceRegion in GEE Python
The result printed in Python is empty dictionary.
How to get the value of regionReduce(mean)?
#%%
# Load input imagery: Landsat 7 5-year composite.
image = ee.Image('LANDSAT/LE7_TOA_5YEAR/2008_2012');
...
2
votes
0
answers
203
views
Creating line geometry from latitude/longitude dictionary
I want to create LineString geometry between points, based on a latitude/longitude dictionary.
My code worked in QGIS 2.x but in QGIS 3.x, my new shapefile is empty.
I have replaced QgsPoint and ...
1
vote
1
answer
135
views
Invalid Syntax on Update Cursor update
I'm using a dictionary created by a search cursor from one feature class to update another feature class with an update cursor. I'm getting an invalid syntax error for the cursor.updateRow(row) and.....
2
votes
1
answer
871
views
Computation with dictionary-values in GEE
I have FeatureCollection in GEE , so for each feature there is data in the properties about total number of pixels, means and more data.
I would like to add new column with computation based on this ...
1
vote
1
answer
166
views
Using a dictionary to find unique values from one field, populate second field with consecutive integers [duplicate]
I have an attribute table with three fields: Id, Name, and Id_2 and 18,701 records. I would like to populate Id_2 with consecutive integers for each unique value in the Name field. Prior to running ...
4
votes
2
answers
1k
views
ArcPy UpdateCursor and Dictionary
I want to update the 'Start_End' field in the following shapefile attribute table:
The attribute table consists of 6,134 records. For every unique value in the 'Id' field, I'd like to update each '...
2
votes
1
answer
400
views
Compare multiple fields using SearchCursor dictionary and UpdateCursor
I have two feature classes. I need to transfer attributes from a point feature class to a line feature class based on a combination of fields. They do not have matching field names. Here is an example ...
2
votes
0
answers
512
views
Using Arcade for ArcGIS Pro Dictionary style
I successfully created a new dictionary style that adds a symbol if a value exists (boolean); trying to add more symbols if values in other fields exist, but no luck. I am new to Arcade, so probably ...
2
votes
1
answer
642
views
Using arcpy.da.UpdateCursor to populate field with dictionary values
I want to populate a field, named FnotExist, with values from a dictionary. I want to check if the key of the dictionary matches the row value in field FI_PATH and if it does populate the ...
2
votes
0
answers
36
views
Transforming descriptive CSV data to known locations in GIS using Python
I have to transfer CSV data that describes a FROM and TO segment into spatial data. The segment descriptions do not follow any logical convention, but rather describe road junctions, places, or road ...