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.

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
3  
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
add comment

2 Answers 2

I would suggest for you to template out your map document with a pseudo image and ust 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

sourceImage

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 elm.name == "Photo":
        elm.sourceImage = r"C:\Project\Data\NewPhoto.bmp"
mxd.save()
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
add comment

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
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.