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 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:
    try:
        ds = i.dataSource
    except:
        ds = 'source unknown'
    writer.writerow([map, i.name,  ds ])
share|improve this question
add comment

1 Answer

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.name
    print i.isServiceLayer
    print i.longName

will return something like ...

>>> ================================ RESTART ================================
>>> 
Basemap
False
Basemap
BingMapsAerial
False
Basemap\BingMapsAerial
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
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.