Combining ArcGIS Server Images - Serverside
Printing aint what it used to be. The days of sending that request off to ArcIMS and getting back a print - ready image are long gone. In fact, I can safely say that one of the few things that ArcIMS does much better than ArcGIS Server is printing.
These days, we have multiple services, markup, etc all on different layers being combined (layered), client side to create the illusion of a nice neat merged image. That illusion doesn't translate very well when it comes to printing. There have been a few hackish (in my opinion) attempts working around this by combining these different layers of images serverside. Personally, I it looked like a mess, and it was difficult to configure. I set out a few months back to try and figure out an easy way to combine these images using my serverside language of choice, Coldfusion. I was extremely surprised to find out that I couldn't not do it. I tried about everything in Coldfusion's image processing function library, and I was just stumped. I asked around and I could get anyone that could get this to work either. Until today.
The other day, I got an email from Ann, and she was looking for some advice on using REST calls to ArcGIS server from serverside. Then more specifically, she asked about combining images from a cached service and a dynamic service (or really any two services):
"Is it possible to use arcGIS to produce static images which consist of one base layer (cached) and an overlay? "
I, having tried this already, quickly replied no way. To my surprise, this morning, she sent over the following code (modified slightly for example purposes) that's using the Coldfusion ImagePaste function:
<!--- Create the envelope --->
<cfset MaxX = '-81.202'>
<cfset MaxY = '29.483'>
<cfset MinX = '-81.239'>
<cfset MinY = '29.461'>
<cfoutput>
<!--- make a call for the base map image --->
<cfimage name="baseimg" source="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export?bbox=#MinX#,#MinY#,#MaxX#,#MaxY#&size=400,400&imageSR=&format=jpg&transparent=false&dpi=&f=image">
<!--- make a call for the overlay map image --->
<cfimage name="flagler" source="http://arcgis.roktech.net/ArcGIS/rest/services/Flagler/FlaglerDefault/MapServer/export?bbox=#MinX#,#MinY#,#MaxX#,#MaxY#&size=400,400&imageSR=&format=png8&transparent=true&dpi=&f=image">
</cfoutput>
<!--- use the elusive Imagepaste function to combine them --->
<cfset ImagePaste(baseimg,flagler,0,0)>
<!-- Send it out to the browser -->
<cfimage source="#baseimg#" action="writeToBrowser">
I cant believe that I missed something that easy. Here is the example: Image Merge Demo
Thanks Ann!
Follow Us On Twitter
