Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have many mxds that previously used ArcGIS Online Bing imagery. I want to replace those with newly purchased imagery. I know I need to use the arcpy.mapping.MapDocument module to do this though not sure how. However when I try to identify the source for the online imagery it is listed as 'source unknown'. Script snippet below shows how I am trying to identify sources in each mxd which I am writing to a .csv

for map in mxd_list:
mxd = arcpy.mapping.MapDocument(map)
layers = arcpy.mapping.ListLayers(mxd, '*')
for i in layers:
        ds = i.dataSource
        ds = 'source unknown'
    writer.writerow([map,,  ds ])
share|improve this question

The Bing Maps basemap does not seem to qualify as a Service Layer but you should be able to recognise it by its longName.

If you have a single Bing Maps Aerial layer in a test.mxd then ...

import arcpy

mxd = arcpy.mapping.MapDocument("C:/temp/test.mxd")
layers = arcpy.mapping.ListLayers(mxd, '*')
for i in layers:
    print i.isServiceLayer
    print i.longName

will return something like ...

>>> ================================ RESTART ================================
share|improve this answer
isServiceLayer is great start....Im running 10.0 thoughso that module is not there.... something like the following is what I am aiming for, however, without a way to reference the object i.e. refLayer, I cant remove it via .RemoveLayer – chris oneal Dec 29 '12 at 1:44

Your Answer


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.