Questions tagged [dictionary]

is an abstract data type composed of a collection of (key, value) pairs

Filter by
Sorted by
Tagged with
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 ...
ESimonson's user avatar
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": "...
MKF's user avatar
  • 561
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], ...
Pierrick Rambaud's user avatar
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 ...
Matt's user avatar
  • 131
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....
rxc_3049's user avatar
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 ...
DeltaKilo's user avatar
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 ...
2Quiker's user avatar
  • 11
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 ...
niklas24's user avatar
  • 573
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 ...
Rafael Canelon's user avatar
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 ...
Katie B.'s user avatar
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: ...
Tshepho Manyothwane's user avatar
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:\...
PyCher's user avatar
  • 171
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 ...
Warren Navarro's user avatar
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 ...
GreggUnited's user avatar
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(...
Cristan Dave Zablan's user avatar
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 ...
Camila's user avatar
  • 1
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 ...
Aishwarya V's user avatar
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" ...
soumik chakraborty's user avatar
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 ...
JackOfTales's user avatar
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 ...
fcka's user avatar
  • 893
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 ...
amaranaitsaidi's user avatar
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....
Solmaz's user avatar
  • 139
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 ...
Solmaz's user avatar
  • 139
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 ...
Ellie 's user avatar
  • 69
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 ...
Solmaz's user avatar
  • 139
-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 ...
Ellie 's user avatar
  • 69
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 ...
mapface's user avatar
  • 431
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 ...
hesmebye's user avatar
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 ...
user3733504's user avatar
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 ...
fortheloveofgis's user avatar
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': ...
esmewayyyy's user avatar
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 ...
Pythonist's user avatar
  • 337
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 ...
user1457123's user avatar
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 ...
Julie's user avatar
  • 53
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 ...
balakumaran's user avatar
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 ...
Joe 's user avatar
  • 41
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 ...
Raúl Casado's user avatar
  • 1,059
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()....
Raúl Casado's user avatar
  • 1,059
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 ...
Egor Prikaziuk's user avatar
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 ...
Francis Odero's user avatar
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'); ...
kangning li's user avatar
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 ...
Plume's user avatar
  • 129
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.....
JackOfTales's user avatar
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 ...
ReutKeller's user avatar
  • 2,047
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 ...
user3467260's user avatar
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 '...
user3467260's user avatar
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 ...
dbChic_noob's user avatar
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 ...
David Szczebak's user avatar
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 ...
user128371's user avatar
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 ...
S.G4's user avatar
  • 41