POST
|
you've saved my sanity Johannes I really appreciate it!
... View more
06-14-2021
07:39 AM
|
0
|
0
|
847
|
POST
|
Hello! I have a dataset containing rural-urban data that I need to process. my code generates the isUrban field, I then need to use an update cursor to classify that field as "Rural" or "Urban" based off of the RUC11CD field (I'm currently trying to do this as a boolean), if RUC11CD is equal to or greater than "4" it needs to be classified as "Urban" (or true if i stick with boolean) . i've read the documentation on update cursors and watched some videos. but i've been stuck for 3 days with no idea what i'm doing wrong. my cursor iterates through my table but classifies everything as false (see screenshot). my cursor code currently looks like this field_Name = "isUrban"
field_Nametype = "INTEGER"
field_NameVal = arcpy.ValidateFieldName(field_Name)
#Adds the new field if it doesn't already exist
fList = arcpy.ListFields(fc,field_Name)
if not fList:
arcpy.AddField_management(fc, field_Name, field_Nametype, "", "", "")
sheet = arcpy.management.MakeTableView(Rural)
fieldcheck = arcpy.ListFields(sheet, "isUrban")
if len(fieldcheck) == 0:
arcpy.AddField_management(sheet, "isUrban", 'INTEGER')
if len(fieldcheck) == 1:
arcpy.DeleteField_management(sheet, "isUrban")
arcpy.AddField_management(sheet, "isUrban", 'INTEGER')
fields = ["RUC11CD", "isUrban"]
# Create update cursor for feature class
with arcpy.da.UpdateCursor(Rural, fields) as cursor:
for row in cursor:
if fields[0] >3:
fields[1] = True
else:
fields[1] = False
cursor.updateRow(row) if i set the new field to be a string and the fields to be 'true' or 'false' as strings the field returns blank cells
... View more
06-14-2021
06:58 AM
|
0
|
2
|
893
|
POST
|
Hello I have a raster layer and a feature class that I need to combine. I have been advised that the best way to do this would be through numpy arrays. converting the raster layer was simple enough rast_nparr = arcpy.RasterToNumPyArray("UKJstdRM") however i'm having real trouble getting the feature class to convert. I should make it obvious this is my first time using the library so i don't really understand how it works so this might be a very simple fix at first I thought it was because everything was contained in a layer file and not a feature class feature_class = arcpy.CopyFeatures_management("UKJ_areas.lyr", "UKJ_FC")
fet_nparr = arcpy.da.FeatureClassToNumPyArray (feature_class, ["Shape","objectid","nuts315cd","nuts315nm","MEAN_parti"]) however when I run this code i get an error indicating that "a column was specified that does not exist" i've tried removing some columns to try and fix the issue with no luck so i'm assuming i'm using the functions wrong. Hope someone can help
... View more
06-06-2021
07:33 AM
|
0
|
2
|
1470
|
POST
|
Hello I have a shape file and two tables, a data and a link table. the shape file is at one, coarser level of governance, the data table is at a finer level of governance and the link table contains both levels of governance, allowing me to link them through a table join. (this will make sense with screenshots i promise) I need to workout the mean participation value from the data table for the coarser level of governance, what this means is i have multiple values from the finer level that i need to calculate the mean for then link to the coarser level. I've tried using the summary statistics tool on a joined then exported table with casefields but the return seems to be an integer, not a float Screenshots Feature layer table, working field is NUTS315CD/NUTS315NM Link table, Contains NUTS318CD(same codes as the previous table just different naming convention) and finer level of governance codes needed to link to the data table data table, county is the same as LAD16C from the link table, participation is the data i need to calculate the mean for merged table that i'm trying to run tools on Do you have any pointers for tools or scripts?
... View more
05-23-2021
04:48 AM
|
0
|
1
|
1244
|
POST
|
Yes thats correct, effectively they are two levels of governance, so there are multiple LAD16CD values for each NUTS318CD value. I need to workout the average participation value for each NUTS3 code, as that is the level for my feature layer. I think i need to extract unique values of the NUTS318CD field but i'm stuck on how i would go about calculating the average for each field if you understand my meaning
... View more
05-22-2021
03:10 AM
|
0
|
0
|
950
|
POST
|
Hello I have been given two tables, one has data that i need to link to the attribute table of a layer, but has no direct link to the layer. The other table contains fields that link the layer attribute table and data table together. data table (county links to link table fields) Link table links LAD16CD to county of the data table and NUTS318CD of the feature layer Feature layer attribute table I need to link the tables together then extract the values for each county of interest and calculate the mean participation value from the data table and then link the mean to the feature layer. in essence I need to have the attribute table of the feature layer have a field that contains the mean participation data for each NUTS3 code i have no idea what approach to take and could do with some advice. current code that prunes the data looks like this arcpy.env.workspace = r"C:\Users\danie\Desktop\Python_assessment\data"
arcpy.TableToTable_conversion(os.path.join(data,'LAD_to_LAU1_to_NUTS3_to_NUTS2_to_NUTS1_January_2018_Lookup_in_the_UK'), Outdir, 'LAU.dbf')
arcpy.TableToTable_conversion(os.path.join(data,'SportsStatisticsForPython'), Outdir, 'Sports.dbf')
#declare paths to dbf paths as variables
LAUtoNUT = Outdir + 'LAU.dbf'
Sports = Outdir + 'Sports.dbf'
fieldNameList = ['LAD16CD','LAD16NM','NUTS218CD', 'NUTS218NM','NUTS118CD','NUTS118NM'] #non required fields
arcpy.DeleteField_management(LAUtoNUT, fieldNameList) #removing fields from table
arcpy.JoinField_management(LAUtoNUT, "LAU118CD",Sports , "county", "") #joining the data and link tables
arcpy.management.CopyRows(LAUtoNUT, Outdir + 'processed_data.dbf', )
... View more
05-21-2021
05:51 AM
|
0
|
3
|
1013
|
POST
|
Unfortunately that didn't work, reading the error the tables need object ID's but that doesn't make sense in the context of my project?
... View more
05-16-2021
02:59 AM
|
0
|
3
|
4982
|
POST
|
Hello I'm using ArcMap and Python 2.7 to do a project I have been given a shape file and some .CSV's, i need to workout the average value for a field in a given polygon using python CSV's: LAD_to_LAU1_to_NUTS3_to_NUTS2_to_NUTS1_January_2018_Lookup_in_the_UK.csv SportsStatisticsforPython the two CSV's join well using the ArcMap UI, however when running the join tool both from the Data Management toolbox and the in ArcMap Python Console i get the following error after trying to link "counties" of the SportsStatisticsforPython.csv to the "LAU118CD" field of LAD_to_LAU1...etc (see screenshots at the end of post) ExecuteError: ERROR 000339: Input LAD_to_LAU1_to_NUTS3_to_NUTS2_to_NUTS1_January_2018_Lookup_in_the_UK.csv does not have OIDs Failed to execute (AddJoin). can someone explain why its not working and how could go about fixing it, preferably in Python 2.7 as i will need to write a script that joins them together then finds the mean participation value for each county, which will then need to be linked to the relevant county in my shape file. screenshots of the CSV and shapefile attribute tables SportsStatisticsforPython.CSV LAD_to_LAU1..etc...etc.. Shape File Attribute Table
... View more
05-15-2021
03:15 PM
|
0
|
5
|
5094
|
POST
|
Hello I have to to standardise some rasters using a loop and following equation X1= (X - X.min())/(X.max()-X.min()) where X is the original dataset, and X1 the new standardized dataset, which has a minimum value of 0 and a maximum value of 1. I was wondering how I would go about doing this? the current code I have is for calc in projected_rast:
print calc
minLSTresult = arcpy.GetRasterProperties_management(calc, "MINIMUM")
maxLSTresult = arcpy.GetRasterProperties_management(calc, "MAXIMUM")
standardised = ((calc - minLSTresult)/(maxLSTresult-minLSTresult))
standardised.save() were projected_rast is a list of strings to my rasters
... View more
05-14-2021
06:15 AM
|
0
|
3
|
1076
|
POST
|
I removed the query and reuploded as a separate web layer and the issue is still persisting
... View more
05-20-2020
01:09 PM
|
0
|
0
|
546
|
POST
|
not as far as i know, i have a query affecting one of the columns but that is it
... View more
05-20-2020
08:02 AM
|
0
|
2
|
546
|
POST
|
I'm making a story map for my final year project comparing how greenhouse gasses have affected greenland ice retreat
i've made a time series map showing the output of carbon dioxide of each country that scales a point located on the centroid with the assossiated carbon output.
in ArcGIS Pro it works fine, more than fine, but when i share it as a web layer the table fails to upload properly and i get this error
I did not have any errors when sharing the data through the share as web layer tab appart from error 24041 which i have been advised is not causing the issue
any guidance would be very much appreciated
... View more
05-17-2020
05:53 AM
|
0
|
4
|
742
|
POST
|
Hi David If you'd be willing to i'd be incredibly grateful! there is a transposition tool included in the program but i've spent the last few hours trying to get it to behave and so far had no luck Here is the link to the data set https://plymunigis.maps.arcgis.com/home/item.html?id=faf3a3b7c22c495abef104a10ec2519a please let me know if you have trouble accessing it Thanks again!
... View more
05-10-2020
07:37 AM
|
0
|
1
|
1201
|
Title | Kudos | Posted |
---|---|---|
1 | 05-20-2021 04:12 AM |