Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

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 am wondering if it is possible to build a zoom to geoprocessing service without using 'current' for the mxd variable in pyhton. Using 'current' my tool works in arcmap, but not in my gp service. here is my code that work fine locally in arc map

import arcpy


dataframe = arcpy.mapping.ListDataFrames(MXD, "Web Mercator")[0]



whe I publish my service, the zoom feature no longer works. I have read online that you cant use 'current' in a gp service, thats fine. When I enter the path to the mxd, the zoom function no longer works?

share|improve this question
Is there a way to use a variable as 'current' with the mxd path in it? – Emily Apr 18 '12 at 16:12
I don't know much about GP services, but since it is server side, not client side, doesn't that mean it is unable to affect/interact with the current map document/active view? – blah238 Apr 18 '12 at 23:20

Doug, I think you need to set the path to your map - CURRENT only works if you're in ArcMap.


I hope that helps!

share|improve this answer

From the code supplied in the question it is not possible to see how you can tell that the zoom is not working when you specify the mxd (which is the way I do this) rather than CURRENT.

Perhaps include an, MXD.SaveACopy(...), or an arcpy.mapping.ExportToPDF(...) to "trap" the result.

share|improve this answer

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.