POST
|
Hi, I'm having issues setting a row value to 0 when joining a csv to a shapefile. When the shapefile value is not in the csv, the row is getting set to 0 instead of null. This is a huge problem as i'm showing 0 change instead of no data. I tried row.setValue(field, None) and row.setNull(field) and both produce the same result. In the .dbf file of the shapefile, there is no value but in the UI attribute table a 0 is shown. Any advice on how to fix this would be very appreciated. Thanks! Shane arcpy.AddField_management(shpfile, "TEST", "DOUBLE", field_is_nullable = 'NULLABLE') newcols = ["TEST"] with open(csvfile, 'rb') as csvfile: lib = dict() csvfile = csv.reader(csvfile, delimiter = ",") csvfile.next() #skip the headers for line in csvfile: lib[line[csvjoinindex]] = lib.get(line[csvjoinindex],line[csvstartfield:]) rows = arcpy.UpdateCursor(shpfile) for row in rows: shpjoinval = str(row.getValue(shapefilejoincol)) try: vals = lib.get(shpjoinval) for ind, field in enumerate(newcols): row.setValue(str(field),vals[ind]) rows.updateRow(row) except: for ind, field in enumerate(newcols): row.setNull(field) rows.updateRow(row)
... View more
09-23-2015
03:42 PM
|
0
|
2
|
5072
|
POST
|
Hi, I'm quite new to arcpy. I found a way to remove all of the layers in a dataframe using arcpy, but i still see the dataframe border on the maps. Is there a way to remove an entire dataframe or remove the dataframe border using arcpy? Here is my code: for lyr in arcpy.mapping.ListLayers(mxd, "", df): arcpy.mapping.RemoveLayer(df,lyr) Thanks! Shane
... View more
01-27-2015
04:24 PM
|
0
|
2
|
4366
|
POST
|
Hi Jeff, I'm still experiencing this problem after installing 10.2.2. Can you provide any update? Thanks, Shane
... View more
08-06-2014
11:39 AM
|
0
|
0
|
450
|
POST
|
I was able to make a map without borders. I am still having issues with the break values. Is there a way to keep updating the breakclasses and legend between ApplySymbologyFromLayer_management and the exporting process? Thank you!
... View more
03-22-2013
05:39 PM
|
0
|
0
|
450
|
POST
|
I am having the same issue. Were you able to get around this issue? Can you please post the code with the workaround. I am still having issues with the symbology outlines. Thank you in advance!
... View more
03-22-2013
02:58 PM
|
0
|
0
|
849
|
POST
|
Hi, In advance, I apologize for the format of this comment. I am new to ArcGIS and am in need of help with arcpy. I am having issues with the graduated symbology export process. I am using a layer file to define the symbology for each new column of data that i am mapping. In the layer file that i am using, the border outlines are hollow. Every time i export a new map, the grey postcode outlines reappear. Is there anything i can add in my script to make the symbology color outlines hollow/transparent? Is there a way to import each mxd in a folder, remove the borders from the graduated colors symbology and re-export the maps. Many thanks to anyone who can help!! Happy Friday, Shane This is the export section of the code. [PHP] df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyrFile = arcpy.mapping.Layer(r"C:/Maps/MapCalcs/SCS_Oct_2012/DATA/MXDs/vrgsymbology.lyr") arcpy.mapping.UpdateLayer(df,lyr,lyrFile,True) if lyr.symbologyType == "GRADUATED_COLORS": lyr.symbology.valueField = AnalysisName lyr.symbology.classBreakValues = [0.001,0.01*MaxVal,0.05*MaxVal,0.1*MaxVal, 0.2*MaxVal, 0.3*MaxVal, 0.4*MaxVal, 0.5*MaxVal,0.6*MaxVal, 0.7*MaxVal, 0.8*MaxVal,0.9*MaxVal, MaxVal] lyr.symbology.classBreakLabels = ["<1%"+ ", " + str("${:,.0f}".format(0.01*MaxVal)), "1-5%"+ ", " + str("${:,.0f}".format(0.05*MaxVal)), "5-10%"+ ", " + str("${:,.0f}".format(0.1*MaxVal)),"10-20%"+ ", " + str("${:,.0f}".format(0.2*MaxVal)),"20-30%"+ ", " + str("${:,.0f}".format(0.3*MaxVal)),"30-40%"+ ", " + str("${:,.0f}".format(0.4*MaxVal)), "40-50%"+ ", " + str("${:,.0f}".format(0.5*MaxVal)), "50-60%"+ ", " + str("${:,.0f}".format(0.6*MaxVal)), "60-70%"+ ", " + str("${:,.0f}".format(0.7*MaxVal)), "70-80%"+ ", " + str("${:,.0f}".format(0.8*MaxVal)), "80-90%"+ ", " + str("${:,.0f}".format(0.9*MaxVal)), "90-100%"+ ", " + str("${:,.0f}".format(MaxVal))] print('here') arcpy.RefreshActiveView() #mxd.save() arcpy.mapping.ExportToJPEG(mxd, r"C:/Maps/MapCalcs/SCS_Oct_2012/DATA/OUT_VRG/"+AnalysisName+".jpeg", resolution=300)[/PHP]
... View more
03-22-2013
10:47 AM
|
0
|
0
|
550
|
POST
|
Thank you!!!! I am working on the automation now. I'll let you know if it works.
... View more
10-10-2012
03:00 PM
|
0
|
0
|
231
|
POST
|
Does anyone know how to apply the graduated colors symbology using ArcPy? I will use manual classification and apply percentages rather than values. For each map i make, i need to represent 1%, 5%, 50%, 75% ranges of the max value in the data. The problem starts when I import symbology from a layer. I can import the symbology and labels, but the percentage ranges represent the previous data. Can i set the classification to represent these percentages using ArcPy? Thanks!!
... View more
10-09-2012
04:42 PM
|
0
|
3
|
1086
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|