I have shapefiles containing areas (states, counties, bodies of water, etc.) and need to generate an image (png / jpg) of each area. How can I do this?

In my mind, the manual workflow would be:

  1. Zoom to extents of each polygon,
  2. Zoom out a tad more to create a border around the polygon,
  3. Create the image file,
  4. Move to the next polygon and repeat above steps.
  5. Repeat for each shapefile.

I have access to ArcMap 10.3, QGIS for my GIS tools and python and .NET for development tools.

This automated process would not need to run frequently, maybe a few times each year, so performance is not really a concern.

A repeatable outcome / consistency is important. The image does not need to be an even scale (1:24000, e.g.) as this will be displayed on-screen only and no scale bar will be applied. The height to width must be scaled equally; not x = 1.00 and y = 1.23.

I do not want to manually create the images (screenshots, print to raster, etc.). This really needs to be automated. There are dozens of shapefiles and hundreds of polygons so automation is definitely worth the time.

closed as too broad by Vince, Mapperz Aug 24 '15 at 19:16

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Though the answer for both of these products would be different, the scripting would likely be basic, and very similar. Please choose one GIS product and development environment for implementation, try something with that product, and focus your question on any problems that may arise. – Vince Aug 24 '15 at 16:43

This can be easily achieved with QGIS (I'm doing this in 2.10) and the Atlas generator.

Open up your shapefile in QGIS. Symbolise it as desired.

Project>New Print Composer

Add a map to the layout that covers the whole page.

After the map is added, we need to set it as controlled by atlas (select the map and go into Item properties):

enter image description here

Next we set up the Atlas generation options:

enter image description here

You can preview the output, or print all the maps as either image (Jpeg/PNG/Tiff/etc...), SVG, or as PDF:

enter image description here

Now we can see that this is not the individual shapefiles. It simply zooms the map to the extent. We can also not show the other features if we want.

Simply set up a rule based symbology, with the following filter: $id = $atlasfeatureid

Thus resulting in:

enter image description here

The tool is really flexible and requires just a few clicks to set up. Scale bars and tiles can also be added with ease.


For your purpose, don't use an A4 page, just use a 200mmx200mm (for example) in the Composition tab, then it will be 1x1 output.

You will have to run this separately for each layer. So once for counties, once for lakes etc...

  • This seems to be exactly what I had in mind! I like QGIS but have only been using it for 6 months. I had no idea this was in QGIS. – DenaliHardtail Aug 24 '15 at 17:07

I recommend becoming familiar with ArcGIS's Data Driven Pages toolbar. Set up a map file to appear as you desire, and then add the DDP toolbar. Click Set Up Data Driven Pages.

enter image description here

Update the layer drop-down menu with the layer you wish to iterate through. On the extent tab, you can set a margin (that 'zoom out a tad more' part of what you're after).

Once you have your data driven pages set up, you can click File -> Export Map...

Select Save as type: PDF (*.pdf). Under the Pages tab, select All.

The only drawback to this is that it must be in PDF format. If you can work with this, it's the easy way to go without the need for any scripting.

Edit: As pointed out by @Chris W in a comment, data driven pages can be exported in other formats.

In the python window in ArcMap, once you have your data driven pages set up:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
  mxd.dataDrivenPages.currentPageID = pageNum
  arcpy.mapping.ExportToPNG(mxd, r"C:\Temp\ParcelAtlas_Page" + str(pageNum) + ".png")
del mxd

From the help: Modify the file path text C:\Temp\ParcelAtlas_Page so it matches the folder location and file name you want.

  • Unfortunately, the end product needs to be a png or jpg. I'll look into this for another project I'm working on but for the task at hand, I don't think it will work. – DenaliHardtail Aug 24 '15 at 16:52
  • Could you not convert or export to png or jpg? – GISKid Aug 24 '15 at 17:04
  • 1
    @DenaliHardtail (and Emil) DDP output does not have to be a pdf, but it does require writing a script using DDP controls rather than the GUI. See comments and discussion at gis.stackexchange.com/questions/144846 or the bottom of the relevant help file at resources.arcgis.com/en/help/main/10.1/index.html#//… – Chris W Aug 24 '15 at 17:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.