Skip to main content
added 42 characters in body
Source Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353

The Help on ExportToPNG (arcpy.mapping) says that it:

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.AddLayer(df, addLayer)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above) - I use IDLE to do this
  3. Open Catalog window (I use ArcMap) to create a new toolbox
  4. Right click on the new toolbox to Add Script tool.
  5. Browse to the *.py script created in step 2 to link that to your tool
  6. When you get to the final panel of that wizard create two parameters (Input Layer File of type File to be read as lyrFile and Output PNG File of type string to be read as pngFile)
  7. Test your tool standalone, and when it works drag and drop it into your model.

If this does not "just work" I recommend that you edit your question to show which of these steps you have performed successfully and which may need further explanation.

The Help on ExportToPNG (arcpy.mapping) says that it:

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above) - I use IDLE to do this
  3. Open Catalog window (I use ArcMap) to create a new toolbox
  4. Right click on the new toolbox to Add Script tool.
  5. Browse to the *.py script created in step 2 to link that to your tool
  6. When you get to the final panel of that wizard create two parameters (Input Layer File of type File to be read as lyrFile and Output PNG File of type string to be read as pngFile)
  7. Test your tool standalone, and when it works drag and drop it into your model.

If this does not "just work" I recommend that you edit your question to show which of these steps you have performed successfully and which may need further explanation.

The Help on ExportToPNG (arcpy.mapping) says that it:

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.AddLayer(df, addLayer)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above) - I use IDLE to do this
  3. Open Catalog window (I use ArcMap) to create a new toolbox
  4. Right click on the new toolbox to Add Script tool.
  5. Browse to the *.py script created in step 2 to link that to your tool
  6. When you get to the final panel of that wizard create two parameters (Input Layer File of type File to be read as lyrFile and Output PNG File of type string to be read as pngFile)
  7. Test your tool standalone, and when it works drag and drop it into your model.

If this does not "just work" I recommend that you edit your question to show which of these steps you have performed successfully and which may need further explanation.

added 26 characters in body
Source Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353

ExportToPNG (arcpy.mapping) The Help on ExportToPNG (arcpy.mapping) says that it:

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above) - I use IDLE to do this
  3. Open Catalog window (I use ArcMap) to create a new toolbox
  4. Right click on the new toolbox to Add Script tool.
  5. Browse to the *.py script created in step 2 to link that to your tool
  6. When you get to the final panel of that wizard create two parameters (Input Layer File of type File to be read as lyrFile and Output PNG File of type string to be read as pngFile)
  7. Test your tool standalone, and when it works drag and drop it into your model.

If this does not "just work" I recommend that you edit your question to show which of these steps you have performed successfully and which may need further explanation.

ExportToPNG (arcpy.mapping)

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above) - I use IDLE to do this
  3. Open Catalog window (I use ArcMap) to create a new toolbox
  4. Right click on the new toolbox to Add Script tool.
  5. Browse to the *.py script created in step 2 to link that to your tool
  6. When you get to the final panel of that wizard create two parameters (Input Layer File of type File to be read as lyrFile and Output PNG File of type string to be read as pngFile)
  7. Test your tool standalone, and when it works drag and drop it into your model.

If this does not "just work" I recommend that you edit your question to show which of these steps you have performed successfully and which may need further explanation.

The Help on ExportToPNG (arcpy.mapping) says that it:

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above) - I use IDLE to do this
  3. Open Catalog window (I use ArcMap) to create a new toolbox
  4. Right click on the new toolbox to Add Script tool.
  5. Browse to the *.py script created in step 2 to link that to your tool
  6. When you get to the final panel of that wizard create two parameters (Input Layer File of type File to be read as lyrFile and Output PNG File of type string to be read as pngFile)
  7. Test your tool standalone, and when it works drag and drop it into your model.

If this does not "just work" I recommend that you edit your question to show which of these steps you have performed successfully and which may need further explanation.

Updated to incorporate artwork21 comments
Source Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353

ExportToPNG (arcpy.mapping)

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above) - I use IDLE to do this
  3. Add your Python scriptOpen Catalog window (I use ArcMap) to create a new toolbox and give it two parameters for
  4. Right click on the layer file you wantnew toolbox to export andAdd Script tool.
  5. Browse to the PNG file*.py script created in step 2 to link that to your tool
  6. When you wantget to the final panel of that wizard create two parameters (Input Layer File of type File to be read as lyrFile and Output PNG File of type string to be read as pngFile)
  7. Test your tool standalone, and when it works incorporatedrag and drop it into your model.

If this does not "just work" I recommend that you edit your question to show which of these steps you have performed successfully and which may need further explanation.

ExportToPNG (arcpy.mapping)

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above)
  3. Add your Python script to a toolbox and give it two parameters for the layer file you want to export and the PNG file you want to create
  4. Test your tool standalone, and when it works incorporate into your model.

ExportToPNG (arcpy.mapping)

Exports the page layout or data frame of a map document (.mxd) to the Portable Network Graphics (PNG) format.

To include this in ModelBuilder you will need to write a short Python Script tool.

import arcpy

lyrFile = arcpy.GetParameterAsText(0)
pngFile = arcpy.GetParameterAsText(1)

mxd = arcpy.mapping.MapDocument("<PATH>/empty.mxd")
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
addLayer = arcpy.mapping.Layer(lyrFile)
arcpy.mapping.ExportToPNG(mxd, pngFile, df)
del mxd

The sketched out steps for that are:

  1. Open ArcMap with a Blank Map and save it as something like empty.mxd in a location where you can rely on always finding it.
  2. Write Python script (see above) - I use IDLE to do this
  3. Open Catalog window (I use ArcMap) to create a new toolbox
  4. Right click on the new toolbox to Add Script tool.
  5. Browse to the *.py script created in step 2 to link that to your tool
  6. When you get to the final panel of that wizard create two parameters (Input Layer File of type File to be read as lyrFile and Output PNG File of type string to be read as pngFile)
  7. Test your tool standalone, and when it works drag and drop it into your model.

If this does not "just work" I recommend that you edit your question to show which of these steps you have performed successfully and which may need further explanation.

added 766 characters in body
Source Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353
Loading
Source Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353
Loading