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.
Sounds like you want a 'dynamic image' like 'dynamic attributes' - this might be a starting point:
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.
Answered by Barrett on September 17, 2020
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:ProjectProject.mxd") for elm in arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT"): if elm.name == "Photo": elm.sourceImage = r"C:ProjectDataNewPhoto.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.
Answered by artwork21 on September 17, 2020
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.
Answered by PolyGeo on September 17, 2020
1 Asked on August 4, 2020 by tvrtko
1 Asked on August 3, 2020
1 Asked on August 3, 2020 by massimiliano-moraca
1 Asked on August 3, 2020 by dannytg
1 Asked on August 2, 2020 by maps_spam
0 Asked on August 2, 2020 by sankarshan-rastogi
0 Asked on August 1, 2020 by shen
1 Asked on July 31, 2020 by jochen-schwarze
0 Asked on July 30, 2020
1 Asked on July 30, 2020 by james-holland
1 Asked on July 30, 2020 by radfael
0 Asked on July 29, 2020 by gmuerovic
1 Asked on July 29, 2020 by zakariah1
0 Asked on July 29, 2020 by nigel-lawton
0 Asked on July 29, 2020 by florian-mahl
1 Asked on July 29, 2020
Get help from others!