Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a script that calculates kernel density for several sets of points, adds the output to a base map, updates the added layer to use the same color scheme and resampling function of a template layer, then zooms to the extent of the new layer.

This works fine for some of the resulting maps; the density output shows on the map, the color is as it should be, and it is sampled using bilinear interpolation as I wanted. The problem is that most of the resulting maps do not show the kernel output at all; only the basemap is visible.

I have isolated the code I am using and have altered it to compute one simple test case. Here is what I have:

SubjectLyr = arcpy.mapping.Layer(r"F:\\testFiles\\output\\Population23_KDens.lyr")
mxd = arcpy.mapping.MapDocument("F:\\testFiles\\testMap.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0] 
wPath = "F:\\testFiles\\output\\" # same as in line 1

#Add the layer to basemap
arcpy.mapping.AddLayer(df, SubjectLyr,"AUTO_ARRANGE") 

#Update the layer
SubjectLyr = arcpy.mapping.ListLayers(mxd, SubjectLyr.name, df)[0] # change reference to layer in mxd
sourceLayer = arcpy.mapping.Layer(wPath+"templates\\template.lyr") # get template layer
arcpy.mapping.UpdateLayer(df, SubjectLyr, sourceLayer, True)

###Zoom to selection
df.zoomToSelectedFeatures()
lyrExtent = SubjectLyr.getSelectedExtent()
df.extent = lyrExtent
arcpy.mapping.ExportToPDF(mxd, r"F:\\testFiles\\output\\Population23_KDens_Map.pdf")
print('DONE!')

I have read that there is some existing issue with UpdateLayer in ArcMap 10.1, though I am using 10.0. As shown, my code is practically identical to the code that is a "workaround" to this problem described in the above linked forum. This code works for some, but not all of my datasets.

I have also tried using the ApplySymbologyFromLayer_management() function, which does make all the kdens output layers appera; however, this does not change the resampling function used when drawing the output, and I need to to use bilinear interpolation.

Does anyone know what could be going on? Are there any other functions I could use?

share|improve this question
    
You say the kernel output is not showing so I am wondering whether it is in the TOC and not visible on the map or missing from the TOC? –  PolyGeo Oct 31 '12 at 21:42
    
I tried similar code in the Python Window in the ArcMap GUI, and the layer is showing in the TOC. The TOC is showing that it has the proper updated colors, but nothing shows up on the actual map. –  N-C Oct 31 '12 at 22:26
    
It could be worth posting to same thread from ArcGIS Discussion Forum you reference in Question because Jeff Barrette seems to be well on top of UpdateLayer there. –  PolyGeo Oct 31 '12 at 22:32
    
Thanks, I'll go ahead and try that. –  N-C Nov 2 '12 at 18:39
add comment

1 Answer 1

up vote 1 down vote accepted

I finally figured out the problem, and I feel decidedly silly for not thinking of it before.

My template layer, from which the symbology was being taken in UpdateLayer, was using the "classified" symbology method with "no color" for values falling between 0 and 104. The default kernel density output uses the "stretched" symbol, and when being forced into the "classified" scheme, many of the values fell within the "no color" range. As a result, the density output from many of my datasets did not show up at all.

Now after changing the template layer to the "stretched" symbology scheme and using UpdateLayer again, everything works fine!

share|improve this answer
1  
If this answers your question, please mark this answer as accepted. –  Chad Cooper Jan 2 '13 at 2:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.