Select to view content in your preferred language

isServiceLayer layer property seems to ignore feature services

3679
2
04-13-2015 01:17 PM
TomFlahive
New Contributor III

To do some advanced web map printing, I used the python script in the "Basic web map printing/exporting using arcpy.mapping" tutorial.  In the python script, there is a block of code to remove all layers in the map that are service layers:

for lyr in arcpy.mapping.ListLayers(mxd, data_frame=df):
    if lyr.isServiceLayer:
        arcpy.mapping.RemoveLayer(df, lyr)

This mostly works, but I am finding that it does not seem to remove services that are feature services.  Is there any reason for this?  How can I get it to remove all services from the map, including feature services?

Thanks.

Tags (1)
0 Kudos
2 Replies
JoshuaBixby
MVP Esteemed Contributor

What version of ArcGIS are you using?  I ask because there were some changes, I would argue bugs, with how serviceProperties behave differently in ArcGIS 10.3 than ArcGIS 10.2.2.  Not sure if that could affect isServiceLayer as well or not.

TomFlahive
New Contributor III

We are using ArcGIS 10.3.

As a work-around I am using the isRasterizingLayer property to remove the service layers that are not being removed by the isServiceLayer block above, but it seems a bit of a hack.

0 Kudos