I'm converting an older GP task made using MB to Python.
In the original, data was saved to disk (.shp) and rendered with a layer file (.lyr). Labels were displayed in the output. I've updated the .lyr file to work with an in_memory layer (longer field names). Here is the code:
For some reason, the labels are not getting displayed when I run in the ArcMap Python Window.
Am I missing something?
Thanks,
Glen
In the original, data was saved to disk (.shp) and rendered with a layer file (.lyr). Labels were displayed in the output. I've updated the .lyr file to work with an in_memory layer (longer field names). Here is the code:
Code:
import arcpy
arcpy.env.workspace = r"C:\gis-ags\src\gp"
# temporary
date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"
# Script arguments
#date_range = arcpy.GetParameterAsText(0)
if date_range == '#' or not date_range:
date_range = "\"OBDATE\" BETWEEN date '2008-01-01' AND date '2008-01-03'"
# Local variables
accum_table = "in_memory\\accumulation_table"
stat_table = "in_memory\\stat_table"
db_table = r"C:\gis-ags\src\gp\gisselect_cdo.sde\GIS.DAILYSNOW_GP_DATA"
# Table Select
arcpy.TableSelect_analysis(db_table, accum_table, date_range)
# Summary Statistics
arcpy.Statistics_analysis(accum_table, stat_table, "NAME FIRST;STATE FIRST;SNOWFALL SUM;LATITUDE FIRST;LONGITUDE FIRST", "COBAN")
# Spatial Reference
sr = arcpy.SpatialReference()
sr.factoryCode = 4269
sr.create()
# Make XY Event Layer
lyr = "accum_xy_layer"
arcpy.MakeXYEventLayer_management(stat_table, "FIRST_LONGITUDE", "FIRST_LATITUDE", lyr, sr)
# Symbology
symbology_layer = "accumulation.lyr"
arcpy.ApplySymbologyFromLayer_management(lyr, symbology_layer)Am I missing something?
Thanks,
Glen