Image Generation


Generating Images

In order to force AspMap to generate images, you can set the ImageFormat property to the desired image format. AspMap is capable of generating JPEG, GIF and PNG images.

 

PNG Images: The PNG algorithm is particularly effective for drawing vector images (such as maps) as images will experience no quality degradation or color dithering.  

 

GIF Images: The GIF algorithm is particularly effective for drawing vector images (such as maps) as images will experience no quality degradation or color dithering.
 

JPEG Images: This format was created to compress and display photo quality images (not vector images such as maps). As a result, displaying maps using this algorithm is not advisable as you will obtain quality degradation and color dithering when creating JPEG images.

Bit Stream Generation

AspMap allows web developers to setup ASPX pages that return maps and legends as bit streams instead of generating map files and letting browsers download files. The ImageHandler class is a way provided by AspMap that allows the browser to receive a bit stream instead of generating an image file. When you add a Map or Legend control to a form, AspMap adds a HTTP image handler to the HttpHandlers section of the web.config file:

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
    <httpHandlers>
        <add verb="GET" path="MapImageHandler.axd" type="AspMap.Web.ImageHandler, AspMapNET" />
   
</httpHandlers>

...
</system.web>

</configuration>

 

When the map image is generated, AspMap saves its contents into the ASP.NET Cache object. The image will be stored in the Cache object as long as specified by the ImageTimeout property. Then, AspMap sends an IMG tag to the browser:

 

<IMG SRC="MapImageHandler.axd?image=temp_d0719e2b-7408-41b3-8cee-b8a3893233c2.jpg">

 

The browser will send a request to the MapImageHandler.axd handler (ImageHandler class) to receive the cached map image. The map image will be immediately removed from the Cache after it is fully sent to the browser.

Image File Generation

This method of generating image files is preferable for high-performance Web mapping applications with 50 or more simultaneous users.

 

If the ImageTempDirectory property of a Map or Legend control is set to a virtual directory, AspMap will generate a temporary image file in this directory every time a user hits a page that contains the Map or Legend control. The image will be stored in the directory as long as specified by the ImageTimeout property.

 

The image must be written to a directory that is visible to Internet clients. The default location for IIS is the C\INETPUB\WWWROOT directory. Therefore creating a temporary directory under C\INETPUB\WWWROOT gives you a location where your application can write image files, for example C\INETPUB\WWWROOT\TEMP:

 

Map1.ImageTempDirectory = "/TEMP"

 

IMPORTANT: The temporary directory must have Read/Write/Modify permissions for IIS user accounts.

 

 

 

© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)