Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [dictionary]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Adding properties values from dictionary to variables in Google Earth Engine?

I want to create separate variables from properties of dictionary object in Google Earth Engine. I been trying with object.get() but it prints that object.get() is not a function. //EXPORTAR var ...
1
vote
2answers
49 views

Transferring Data From One Table to Another Using Multiple Keys in ArcPy?

I have data in one field and I want to transfer it to a specific field in another table based on specific keys Such as ID, road_type and veg_type. My original table looks like this ID Road_Type ...
1
vote
1answer
56 views

Summing Values for Each Item in a Dictionary

# Create dictionary with segmentid as key, calculated length as value1, measured length as value2 fiberCableLengths = defaultdict(list) with arcpy.da.SearchCursor(fiberCable, ['segmentid', '...
1
vote
1answer
43 views

Filling a dictionary whose values are a list container

import arcpy, datetime arcpy.env.overwriteOutput = True # Number of days to subtract tdelta = datetime.timedelta(days=21) fiberCable = r'C:\Users\broadhurstn\Documents\ArcGIS\Default.gdb\...
0
votes
2answers
47 views

Iteratively Filling a Dictionary and Updating a Feature Class

import arcpy fiberCable = r'C:\Users\broadhurstn\Documents\ArcGIS\Default.gdb\FIBERCABLE' fibercableToConduit = r'C:\Users\broadhurstn\Documents\ArcGIS\Default.gdb\FibercableToConduit' conduit = r'C:\...
0
votes
0answers
23 views

TerraSync Alternative for Trimble Geo7 - Supporting Attribute Relationships/Nested Criteria

Does anyone know of a product that can be used on a Geo 7x that supports more complex data dictionaries? For example, if I am collecting a new location (point), and require the user to enter certain ...
0
votes
2answers
43 views

Using dictionary of file names and DD coordinates to create points in shapefile using shapely?

I'm working on a Python script that strips the GPS info from images and uses that info to create a shapefile from that info. Right now I have all the file names as keys to tuples of decimal degrees ...
0
votes
1answer
89 views

Parsing CSV data and updating a dictionary and creating a polyline

I am a little stuck on my code. I am new to Python and am learning as I go, but have usually been able to figure it out till now. The code was working up till I put the dictionary part in and now ...
0
votes
2answers
371 views

Switching from Nested Search Cursors to Dictionaries

I'm working with a table that has in excess of 800K records and my method of using nested cursors is not practical. I've been reading and it looks like I should switch to dictionaries, but after much ...
0
votes
1answer
53 views

Passing dictionary to map function

I have a points feature collection and have added the latitude and longitude to each point's properties as well. Now I want to do a processing on each point and want to use the map function. The ...
2
votes
1answer
256 views

Create a line chart from a dictionary of values in google earth engine

I am currently trying to create a line chart for each land-cover type across three bands I selected from MODIS. Problem is most of the ui.Chart functions require a feature or an image. Please help? ...
4
votes
1answer
67 views

ArcPy Memory issue re-using dictionary?

Before I start I should mention that before this I have never worked in Python before. I am trying to process a large fc to fc update, 3 million plus rows with 70 columns. I tried using updatecursor ...
2
votes
1answer
47 views

Why is data from Collections.DefaultDict(list) a string?

While creating a defaultdict(list) containing street names, x and y coordinates, my x and y entries are converted to strings. This prevents me from doing calculations on them. I've been looking around ...
0
votes
1answer
47 views

Comparing Two Tables Using Arcpy

I'm trying to check the "fiberEquipment" table against the "material_cd" table and find instances where there are discrepancies. E.G -- Checking that "material_cd" 10785823 in "fiberEquipment" has all ...
4
votes
3answers
304 views

Converting full road names to abbreviation using ArcGIS field calculator?

I have a data table with a column 'names' that have street names with street type (Road, Lane, Street etc.). I need to get the names in a format like in column 'new_names'using field calculator in ...
2
votes
1answer
180 views

Reformatting Dictionary Object to rows and columns using Google Earth Engine?

I'm new to javascript & GEE, trying to reduce a global FeatureCollection by computing sums of two specific properties, grouped by country (using this helpful link). The output is a Dictionary ...
1
vote
1answer
232 views

Function to convert Dictionary to Image works for an image but not for an image collection

I have written a small function that first takes an image, calculates mean for each of its bands and then converts the dictionary of the mean value to an image with each mean value acting as a new ...
0
votes
1answer
557 views

Populating a Dictionary with an Update Cursor “Typeerror: 'Dict' Object Is Not Callable”

I'm getting the following error "Type Error: 'dict' object is not callable", with the code below: import arcpy def printDict(dictionary, printCount=False): for key in dictionary: arcpy....
0
votes
1answer
20 views

Making the results from function a string [closed]

I am trying to get the features count from feature, then put it in a dictionary that I can call later: ct_dict = dict() ... fipsList = ['13245','06007'] for fip in fipsList: mergedJoinCentroids =...
1
vote
1answer
142 views

Using a dictionary to update one attribute based on another

I need to update a large dataset based on information in an Excel table. I figured the easiest way to do this would be using a dictionary I can fill out from the Excel table and run it on a feature ...
1
vote
0answers
21 views

Creating domains from specific values in table using ArcPy?

I have an .sde table that I'm trying to extract specific values from and create domains with them. The problem I'm running into is that there are multiple duplicate values in the table (which is fine, ...
1
vote
1answer
80 views

Populating dictionary using ArcPy creates only 1 entry?

I am new to arcpy, and I am trying the simple operation of creating a dictionary that will pair my fcs in a gdb with their corresponding coordinate system. The operation itself works, but it only ...
0
votes
1answer
272 views

Using ArcPy to check for duplicates AND Latest date? [closed]

I am stumped (and new to Python). I have a feature class with a field that contains a centroid in MGRS. That field is called MGRS. I also have another field called ED_Date that is the production date ...
1
vote
1answer
70 views

Using a dictionary along with geoprocessing tools?

I am new to python and trying to create a script that will select specific parcels from a large parcel layer. Is it possible to create a dictionary with the names of the parcels as the key and the ...
1
vote
2answers
64 views

Identifying small polygons that are inside larger bounding polygons within same feature class using ArcPy?

I've tried digging around for an answer to this question, but I've only been able to find answers that are either too broad or too different from my case, so here goes! Context: I have a layer of ...
3
votes
2answers
310 views

Creating raster layer from dictionary in PyQGIS?

In a dictionary such as below, I have a series of x,y coordinates as key and distance measured as values in dictionary. I want to convert this dictionary to a raster layer with PyQGIS, Can I do it? ...
0
votes
1answer
4k views

How to sum values for any x,y coordinate as key in a dictionary by PyQGIS? [closed]

I have a dictionary that it's keys are the x,y coordinates and values are any number example: {(232211,3.7094e+06): [83.77895325168048], (232111,3.7093e+06): [176.90244718253913], (232211,3.7095e+...
1
vote
1answer
522 views

Using dictionary and cursors to calculate a field based on values from another table - KeyError [0]

I'm new to dictionaries and am still a Python beginner. I'm trying to update field(s) based off of field values in another table using the OID field as a key. The search cursor dictionary has been ...
0
votes
1answer
327 views

Update Cursor with Lists as Dictionary?

I have a field, "Access" that I want to populate with 4 variables based on the attribute of another field, "Des_Tp".For example, if a feature has "Des_Tp" = 'NP', then I would want to code it as open ...
1
vote
1answer
619 views

Update field's rows with a value of dictionary

I'm new in programming and I'm struggling with my code. I have a dictionnary of districts and communities for each, like this: MyDict = defaultdict(<type 'set'>, {u'DISTRICT': set([u'community1'...
2
votes
1answer
230 views

Issue utilizing Keys:Values from Dict with da.UpdateCursor

I have a field that holds a variety of strings. These strings were field names and corresponding values that were concatenated into a single field per feature. Using .split/indexing I was able to ...
0
votes
1answer
1k views

Calculate field values using arcpy.da.UpdateCursor

I am trying to create and update a field with a count of line features (tLayer) within a distance of point features (sLayer). I am attempting to use a combination of AddField_management, arcpy.da....
3
votes
0answers
68 views

Python Script to JSON as Geo-processing service [duplicate]

I have been having some trouble with this script that I created. Ideally, I would like to query between to a layer file and feature class to find certain features in the class withing a certain ...
1
vote
1answer
411 views

SearchCursor too many values to unpack

I'm trying to build a dictionary from a table view in ArcMap using SearchCursor. Here is the snippet of code I'm having issues with: valueDi = dict([(key, val) for (key, val) in arcpy.da....
1
vote
1answer
41 views

Ensuring script recognizes field values that have already been “used” in previous row?

How do I ensure the script recognizes field values that have already been “used” in a previous row (not necessarily the one just above it)? Below is my source table – the result of a spatial join ...
3
votes
1answer
720 views

Using arcpy dictionaries to select attributes from a different layer

I'd like to incorporate the use of dictionaries to access data between tables. So far I have been able to create the dictionaries that I need from my feature class fields. I have one dictionary that ...
0
votes
2answers
954 views

Create Python Dictionary from feature classes, fields, and domains

I want to create a Python dictionary with a Feature class as the key and the fields of the feature class and domains of the feature class as separate values. I'm starting off by simply attempting to ...
0
votes
1answer
1k views

Append count of unique values to dictionary keys and then sum the occurrences

I am trying to compare the occurrences of codes from a column within feature classes against a list from a spreadsheet column and then add these to a dictionary where the feature class name is the key ...
1
vote
1answer
6k views

Converting xml -> dict -> xml using Python? [closed]

I want to convert xml (qml) file to dictionary, then convert this dictionary to new xml. (Also want to edit something, but first lets just convert it in both way without it.) I'm using xmltodict ...
0
votes
2answers
2k views

Creating a dict with Search Cursor

I need to find how many routes are assigned to each account number in a feature class. I'm using search cursor twice, first to build a set of account numbers, second to get the number of times a route ...
1
vote
1answer
854 views

Creating python dictionary that maps each domain to multiple coded values in File Geodatabase?

I have a File GDB that has domains and coded values. I would like to extract those values from the GDB and build a dictionary. For example: I have hundreds of domains and with each domain has a set ...
0
votes
1answer
156 views

Automation KeyError using Search Cursor / Data Dictionary [closed]

I recently received help in modifying a previous code for structures as part of project. The first time I ran it the code worked fine, but when I went to double check it. I keep receiving: Runtime ...
2
votes
2answers
1k views

Update value in one table (feature class) by coping it from another table. The match between table is done on values from another field

I have two tables (actually both are feature classes in filegeodatabase). They pretty much identical except. one is in lat/lon. second one is projected. both have field line_length and objectid. ...
2
votes
1answer
455 views

Python script: “points to polygons” skipped fourth vertex

Using ArcGis 10.2 I have a script converting the nodes of a net into polygons. The polygons should be either triangles or rectangles but the script doesn't build polygon as rectangle, skipping the ...
1
vote
1answer
2k views

Using arcpy.da.UpdateCursor with dictionary?

I'm working through some da.UpdateCursor scripts to make updates to a fgdb. Although the script below works successfully, I want to use the dictionary that I have created rather than the manual [ ] ...
2
votes
0answers
98 views

Trimble pathfinder data dictionary default value exclusion

Is it possible to have a numeric attribute in trimble pathfinder without having to use a default value? I am trying to make a numeric attribute compulsory to fill in BUT because the data dictionary ...
0
votes
2answers
2k views

Update Multiple Columns within One Update Cursor

Are you able to update several fields within an attribute table at the same item within one Update Cursor command. Code Example: with arcpy.da.UpdateCursor (fc, fields) as cursor: for row in ...
2
votes
2answers
85 views

Updating Z value within XYZ.txt file using ArcPy?

Following Creating polygon from 2 txt files (Parent ID + Coordinates) from a few weeks ago, the script works very well. Now I need to reverse the process in order to update the Z value in the original ...
2
votes
1answer
2k views

Using ArcPy to Read from Excel Spreadsheet to Python Dictionary

How would I go about creating a script that reads a specified excel spreadsheet and places the values in a dictionary? I have read about the xlrd library and how the library in such endeavors to read ...
1
vote
0answers
96 views

Lat/Long attribute to Trimble Pathfinder Data Dictionary

Is it possible to add beginning and end point lat/long attribute to Trimble Pathfinder Data Dictionary before collecting data in the field?