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

This is the first time I am using Python on my own, and I have searched for this answer for a few hours with no luck. I am wanting to take a .JPG image and put it in a data frame. The image has to be in color, and needs to change with data driven pages. Help would be greatly appreciated. Thanks

share|improve this question
Welcome Megan. I assume you are aware that JPGs do not have a spatial reference (i.e. unless you are referring to .jp2). What purpose will the JPG serve? Will you need to georeference the JPG? – Aaron Jan 9 '13 at 21:50
The jpg is just a picture of a station that is being located on the map. I do not need to do anything with the picture besides add it to the correct page. – Megan Jan 10 '13 at 16:56
Are you sure you want to add it to a data frame as an analysis layer? Or could you just add it to Layout page? – RyanDalton Aug 8 '13 at 14:22
This is actually a nice idea - if you were generating a mapbook for a client and needed to display a picture of each asset as you moved through the DDP's. I can see this being quite useful. Almost like using a dynamic attribute except in this case it would link to a file. – Barrett Jun 9 at 15:57

I would suggest for you to template out your map document with a pseudo image and just replace the source using python instead of adding and removing the layer. I take that your image is an element, not actually apart of a data frame. If so, you may swap out the reference path to that image by using the


property, see code example below:

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for elm in arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT"):
    if == "Photo":
        elm.sourceImage = r"C:\Project\Data\NewPhoto.bmp"
del mxd

Otherwise, you could technically store this image in a seperate data frame and resource it by the layer replaceDataSource method.

share|improve this answer

I don't think you need Python for this, unless there are other complicating factors not mentioned in the question.

Assuming that your JPG files are georeferenced (i.e. have *.jgw world files), and that you have a polygon feature class with one rectangular polygon that corresponds to each JPG file, then you should be able to use that polygon feature class as an index in Data Driven Pages.

Make sure the map you are enabling DDP on has all the JPG files in its Table of Contents and turned on.

share|improve this answer
My layout is 2 maps and image. One map is an overall state map with a star where the approximant location of the station is and the other is zoomed in on the location of the station. Under these two maps will be an image of the station. I am using python to move a star where the approximant location of the station on the state map and also adding the image to the bottom. – Megan Jan 10 '13 at 16:12
I suspect that you may need to move away from DDP and use a map which is unenabled for that - which does need Python. Are the disk locations of your image files available in a field on your stations feature class? – PolyGeo Jan 10 '13 at 22:41

Sounds like you want a 'dynamic image' like 'dynamic attributes' - this might be a starting point:

From ArcGIS Pro's help: Dynamic Image

Insert dynamic pictures with Map Series

If you are using Map Series, you can make your picture element dynamic and have it update for each page. To do this, double-click the picture to open the Element pane. There are two options from which you can choose: Simple path and Dynamic (Map Series).

Dynamic (Map Series) allows you to reference images that you have as attachments on index layer features. You can also reference a raster field as well. In cases where you have more than one attachment for a feature, you should use the Name filter. For example, you can filer on the file type (.png) or on a portion of text in the name.

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.