I'm running batch processing on several datasets using a standalone EXE written in .NET. There are many output files for each dataset (>25 featureclasses/rasters). For every dataset I would like to grab a few specific outputs and create JPEG images of them for simple quality control. Ideally I would combine a few of the featureclasses together and create an image of the combination as if I were exporting an image of several layers as you can do using the Arc UI. I imagine that there will be a few steps involved in accomplishing this - can someone point me in the right direction?
For the sake of simplicity, you can assume that I have the full path to the files I want, which are stored in a FGDB on a drive. I can also derive the approximate extent of these featureclasses from the largest of them, so I can set a view extent.
For example:
I have just run the extension and created a series of output files which are stored in a FGDB. These featureclasses/rasters all cover the same discrete area and are projected.
Outputs (making these up for simplicity):
1) DEM of the area (represents the full extent).
2) Polyline road network.
3) Polygon building footprints.
4) Point featureclass representing manhole covers.
What to accomplish:
Combine all of the files in the correct order (featureclasses overtop of the DEM) and save a JPEG file.
EDIT:
My extension runs as an EXE (not a toolbar) and doesn't actually open the Arc UI - it merely consumes the licenses and does the processing in the background. So, do I have access to ActiveView if I haven't "launched" the UI? Essentially, I don't have a TOC to populate with layers.
1 Answer 1
If you are using ArcObjects to add and arrange the order of layers in the ArcMap TOC, I would first search for the specific names that you want to export out as a group. Then turn off all the layers except for those that you want to export out e.g.
'Search for MyLayer1 and MyLayer2 in the ArcMap TOC
Dim pFLayer As IFeatureLayer = Nothing
Dim pLayer As ILayer
Dim pEnumLayer As IEnumLayer
m_pMap2 = m_pMxDoc2.ActiveView.FocusMap
pEnumLayer = m_pMap2.Layers
pLayer = pEnumLayer.Next
Do Until pLayer Is Nothing
If pLayer.Name = "MyLayer1" AND pLayer.Name = "MyLayer2" Then
TurnOffLayers()
ExportActiveView()
Else
Exit Sub
End If
pLayer = pEnumLayer.Next
Loop
End Sub
If those layers are present then you can use the ExportActiveView code to export out the jpg images. Here is the link for the ExportActiveView Code.
Edit
You could add those layers into an ArcMap project, save the mxd, and export out the map using python/arcpy script.
OR
if you have access to the extension code you could use 'Call Shell' code to open up ArcMap, and add your layers in the TOC using ArcObjects.
A python script might be a better option.
-
Thanks for the response. Will this method work if I don't have the Arc UI open? I'll edit my question to elaborate, but my extension runs as an EXE and doesn't actually open the Arc UI - it merely consumes the licenses and does the processing in the background. So, do I have access to ActiveView if I haven't "launched" the UI? Essentially, I don't have a TOC to populate with layers.Radar– Radar2011年10月20日 18:43:28 +00:00Commented Oct 20, 2011 at 18:43
-
@Radar, See my Edit.artwork21– artwork212011年10月20日 19:10:27 +00:00Commented Oct 20, 2011 at 19:10
-
@radar Usually "extension" means something that is running in same process as the arcmap.exe (or arccatalog.exe). If this is not the case you probably should re-phrase you question, changing "extension" to "standalone exe".Kirk Kuykendall– Kirk Kuykendall2011年10月20日 19:12:09 +00:00Commented Oct 20, 2011 at 19:12
-
artwork21 - thanks for updating and addressing my comment. Your answer got me to where I need to be - I'll with my resulting methods once I get the finer details sorted out. @Kirk - I suppose the semantics are a little odd given how I've implemented this EXE. I'll update based on your suggestions.Radar– Radar2011年10月20日 19:22:19 +00:00Commented Oct 20, 2011 at 19:22