|
POST
|
Thank you so much for your help with this Cheryl. I was able to get the attributes to export correctly using the methodology you have included here (i.e. naming attributes in the main rule file and reporting them within a rule, in my case, the pre-existing starting rule). I have two additional questions: 1) is there a way to change the pop-up window label in the Scene Viewer (it seems to default to a Shape number label) 2) I have been struggling with poor rendering quality in the Scene Viewer on our Portal. Colored faces appear patchy or as if there is face conflict. The white patchiness is dynamic and shifts as models are rotated in the scene viewer. The models render as solid color surfaces in CityEngine prior to exporting as a scene layer packages. Any tips on ways to have these colors stay solid when rendering in the SceneViewer? Attached are screenshots of this issue where colored faces are not rendering consistently. I posted this question here: https://community.esri.com/message/728604-face-rendering-in-scene-viewer Thanks again!
... View more
11-13-2017
08:54 AM
|
0
|
2
|
2950
|
|
POST
|
I actually used that post example to write the report rule file. The rule attributes are connected to the object attributes. These attributes are showing up in the inspector in the Shapes tab under 'Report' after I apply the rule to generate the shapes. However, after I export the generated models to the scene layer package, the attributes don't show up in the web scene from the uploaded scene layer package in Portal. If I import the scene layer package into Arc Pro, it loads correctly, but I also cannot view any attributes associated with it.
... View more
10-25-2017
07:56 PM
|
0
|
0
|
2950
|
|
POST
|
I am trying to export object attributes along with models in a scene package layer. After using the following rules (here, attributes are simplified), I am still receiving a 'name' attribute associated with shape number (see attached snip) when the models are ingested and interacted with in a web scene (uploaded manually to our Portal for ArcGIS). Any recommendations on how to get these attributes to export properly in the scene layer package? I am using CityEngine Basic 2017. Thanks in advance! /**
* File: reportAttr.cga
* Created: 18 Oct 2017 21:50:40 GMT
* Author: GARDTESS
*/
version "2017.0"
attr BL_ID = ""
attr TYPE = ""
@StartRule
Report -->
report("BL_ID", BL_ID)
report("TYPE", TYPE) This is the code I appended to the end of the rule I am using to generate the models: import Report : "rules/reportAttr.cga"
attr BL_ID = ""
attr TYPE = ""
@StartRule
Generate -->
Report.Report
... View more
10-24-2017
10:57 AM
|
0
|
6
|
3514
|
|
POST
|
After upgrading to CE 2017, it seems that I no longer have the FileGDB model export option. Is this no longer a supported feature, or am I missing something?
... View more
10-20-2017
01:38 PM
|
0
|
2
|
949
|
|
POST
|
From * Rule attributes and object attributes (as seen in the Inspector) are not exported to the spk. Only values that are reported in the code are exported: Is there a straightforward way to export all model attributes (one feature per shape) to a slpk?
... View more
10-20-2017
12:32 PM
|
0
|
1
|
3763
|
|
POST
|
I like this idea. Thanks. I was working with 10m elevation data that ended up having some odd values, seemingly an artifact of raster resolution and steep embankments along a roadway in mountainous terrain. I ended up setting likely extraneous values to nulls and was hoping to interpolate the values of these cells to smooth the DEM along the roadway. Tess
... View more
09-08-2017
09:58 AM
|
1
|
0
|
4762
|
|
POST
|
My raster is called "m1sm_degnull". This is the code I tried in raster calculator: Con(IsNull("m1sm_degnull"),
FocalStatistics("m1sm_degnull", NbrCircle(15,15, "CELL"), "MEAN"),
"m1sm_degnull") This is the error I recieved: ERROR 000539: Error running expression: rcexec() Traceback (most recent call last): File "<expression>", line 1, in <module> File "<string>", line 5, in rcexec TypeError: __init__() takes at most 3 arguments (4 given) Failed to execute (RasterCalculator). Hmm, I'll look into Nibble. That may be just what I'm looking for (as I do have a large gap). Thanks a bunch!
... View more
08-23-2017
01:50 PM
|
0
|
4
|
4762
|
|
POST
|
I am attempting to use this method to interpolate currently null values in a raster: How To: Remove and replace no data values within a raster using statistical information from the surrounding data values… This code is not working in raster calculator for Desktop 10.5. Is there a syntax update that I am missing? Con(IsNull("raster"), FocalStatistics("raster", NbrRectangle(5,5, "CELL"), "MEAN"), "raster")
... View more
08-23-2017
01:13 PM
|
0
|
6
|
6700
|
|
POST
|
I ended up making sure all data the map document was using was located in a file geodatabase (in a subfolder for organizational purposes) in a registered folder on the hosting server. I did end up manually grabbing the file geodatabase out of the original map package folder and placing it in the registered folder. There may be a more straightforward way to handle this issue, but it seemed to work fine for me. Best of luck! Tess
... View more
08-22-2017
08:51 AM
|
0
|
1
|
2884
|
|
POST
|
While trying to publish a tile cache REST service from a map package, I am receiving this error. Does anyone have any tips on troubleshooting this? Thanks in advance!
... View more
07-20-2017
09:01 AM
|
1
|
5
|
3892
|
|
POST
|
Copying a SubLayer_pp_trans_GUJoin_UniqueSubs layer to memory then creating a feature layer from that (for each section) appeared to work flawlessly. Thanks again!
... View more
07-13-2017
02:33 PM
|
1
|
0
|
570
|
|
POST
|
Sounds good. I'll give it a go. Thanks again for all of your help!
... View more
07-13-2017
10:26 AM
|
0
|
0
|
570
|
|
POST
|
Oh, the where clause makes sense (oops, been staring at the script too long ). The clauses are defined in a previous section of the code. Copy Features might just be the trick. I'll give it a go. Thanks a ton! What would be the best way to create a temporary featureclass? Would using a table view or in-memory workspace be a good option for minimizing the time this may take?
... View more
07-13-2017
09:28 AM
|
0
|
3
|
3848
|
|
POST
|
I was under the impression that creating a feature layer created a new independent temporary layer. I was hoping that using the feature layer route would enable specific selection from each feature layer to be passed to the update cursor leaving the original feature class, SubLayer_pp_trans_GUJoin_UniqueSubs, intact. Any suggestions on how to work around this issue? I would like SubLayer_pp_trans_GUJoin_UniqueSubs to retain the record count of 16763 for the proper count updates from the update cursor. Here is an updated printout showing the record count of the feature layer and SubLayer_pp_trans_GUJoin_UniqueSubs after each throughout processing: The 'feature layer count:' print statement is always reflective of the SubLayer_pp_trans_GUJoin_UniqueSubs feature layer. I am really confused as to why it varies so much. Some count values are higher than the previous feature layer (maybe I'm missing something). I realize that the 'selected out' count is dependent on the specific selection applied to each specific feature layer, so it will vary among the print statements. Here is the code beginning from where the SubLayer_pp_trans_GUJoin_UniqueSubs deviate from 16763 (...If it helps, sorry it is so long; the added print statements ballooned it even more). ################################ UNIQUE SUBS BY VOLTAGE - 13.8 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_13_8", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_13_8_freq = defaultGdbPath + '\Join_13_8_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_13_8", where_13_8)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_13_8")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_13_8", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_13_8", Join_13_8_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_13_8")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_13_8 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_13_8_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_13_8"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_13_8.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_13_8 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
################################### UNIQUE SUBS BY VOLTAGE - 46 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_46", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_46_freq = defaultGdbPath + '\Join_46_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_46", where_46)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_46")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_46", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_46", Join_46_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_46")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_46 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_46_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_46"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_46.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_46 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
######################################### UNIQUE SUBS BY VOLTAGE - 69 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_69", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_69_freq =defaultGdbPath + '\Join_69_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_69", where_69)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_69")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_69", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_69", Join_69_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_69")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_69 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_69_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_69"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_69.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_69 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
#################################################### UNIQUE SUBS BY VOLTAGE - 115 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_115", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_115_freq =defaultGdbPath + '\Join_115_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_115", where_115)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_115")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_115", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_115", Join_115_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_115")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_115 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_115_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_115"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_115.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_115 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
#################################################### UNIQUE SUBS BY VOLTAGE - 138 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_138", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_138_freq =defaultGdbPath + '\Join_138_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_138", where_138)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_138")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_138", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_138", Join_138_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_138")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_138 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_138_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_138"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_138.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_138 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
#################################################### UNIQUE SUBS BY VOLTAGE - 161 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_161", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_161_freq =defaultGdbPath + '\Join_161_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_161", where_161)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_161")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_161", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_161", Join_161_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_161")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_161 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_161_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_161"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_161.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_161 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
#################################################### UNIQUE SUBS BY VOLTAGE - 230 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_230", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_230_freq =defaultGdbPath + '\Join_230_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_230", where_230)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_230")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_230", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_230", Join_230_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_230")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_230 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_230_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_230"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_230.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_230 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
########################################## UNIQUE SUBS BY VOLTAGE - 345 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_345", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_345_freq =defaultGdbPath + '\Join_345_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_345", where_345)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_345")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_345", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_345", Join_345_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_345")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_345 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_345_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_345"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_345.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_345 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
######################################## UNIQUE SUBS BY VOLTAGE - 500 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_500", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_500_freq =defaultGdbPath + '\Join_500_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_500", where_500)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_500")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_500", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_500", Join_500_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_500")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_500 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_500_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_500"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_500.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_500 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
######################################### UNIQUE SUBS BY VOLTAGE - 1000 ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUB_COUNT_1000", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_1000_freq =defaultGdbPath + '\Join_1000_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_1000", where_1000)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_1000")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_1000", ['SUBID', 'SUB1SUB2', 'VOLTAGE'])
arcpy.Frequency_analysis("JoinUniqueSubs_1000", Join_1000_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_1000")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_1000 = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_1000_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUB_COUNT_1000"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_1000.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUB_COUNT_1000 Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
######################################## UNIQUE_SUBS_COUNT ########################
arcpy.AddField_management(subLayer, "UNIQUE_SUBS_COUNT", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_all_freq =defaultGdbPath + '\Join_all_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueSubs_all",)
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_all")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueSubs_all", ['LATITUDE', 'LONGITUDE', 'SUB1SUB2'])
arcpy.Frequency_analysis("JoinUniqueSubs_all", Join_all_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueSubs_all")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Subs_all = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_all_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_SUBS_COUNT"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Subs_all.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_SUBS_COUNT Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
################################################# UNIQUE VOLTAGE COUNT ###################################
arcpy.AddField_management(subLayer, "UNIQUE_VOLTAGE_COUNT", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
Join_voltage_freq = defaultGdbPath + '\Join_voltage_freq'
# Make feature layer
arcpy.MakeFeatureLayer_management(SubLayer_pp_trans_GUJoin_UniqueSubs, "JoinUniqueVoltage",)
RecordCount = arcpy.GetCount_management("JoinUniqueVoltage")
count = int(RecordCount.getOutput(0))
print("feature layer count:", count)
arcpy.DeleteIdentical_management("JoinUniqueVoltage", ['VOLTAGE','SUBID'])
arcpy.Frequency_analysis("JoinUniqueVoltage", Join_voltage_freq, ["SUBID"])
RecordCount = arcpy.GetCount_management("JoinUniqueVoltage")
count = int(RecordCount.getOutput(0))
print("feature layer selected out count:", count)
search_feats_Unique_Voltage = {f[0]:f[1] for f in arcpy.da.SearchCursor(Join_voltage_freq,["SUBID","Frequency"])}
with arcpy.da.UpdateCursor(subLayer,["SUBID","UNIQUE_VOLTAGE_COUNT"]) as upd_cur:
for upd_row in upd_cur:
upd_row[1] = search_feats_Unique_Voltage.get(upd_row[0], 0)
upd_cur.updateRow(upd_row)
print("UNIQUE_VOLTAGE_COUNT Updated")
del upd_cur
RecordCount = arcpy.GetCount_management(SubLayer_pp_trans_GUJoin_UniqueSubs)
count = int(RecordCount.getOutput(0))
print("SubLayer_pp_trans_GUJoin_UniqueSubs count:", count)
end = time.time()
print((end - start)/60)
#if __name__ == '__main__':
# entry()
... View more
07-13-2017
08:09 AM
|
0
|
5
|
3848
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-19-2018 11:46 AM | |
| 1 | 04-10-2018 03:47 PM | |
| 1 | 10-01-2018 08:50 AM | |
| 1 | 02-15-2017 07:50 AM | |
| 1 | 10-19-2018 04:08 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-22-2025
08:12 AM
|