How To: Increase image rendering performance in MapObjects-Java
MapObjects—Java provides support for basic image rendering. However, since Java technology is closely tied to performance and memory management, there is no absolute solution for supporting large image files with the appropriate speed and memory utilization.
Below are some tips to help maximize performance in applications.
- Use images less than 2500 x 2500 in pixel size. The file size for the entire project should be less than 10 MB for all layers, if possible. These parameters are recommended for regular applications on 1 GHz computers with 256 MB RAM.
- If the computer has a faster processor and is loaded with more memory, try to run your application with heap option settings ( -Xms64m -Xmx512m ). This will allow the larger images to be loaded. However, it is still not recommended to load files greater than 10000 x 20000 pixels. MapObjects—Java will be capable of loading such images, but it will take a significant amount of time (10 minutes or more, depending on hardware).
- Make special preparations to accommodate larger images. Break the image into smaller parts with image size less than 1500 pixels. Then load the image in small parts to only cover the field of view.
- To show the OverviewMap, a special image should be used. Create a scale-dependent renderer to display the correct image when the zoom factor is appropriate.
- Projections will also have an effect on the performance of the application. Dynamic, or on-the-fly, image transformations are very 'expensive' operations for Java and should be avoided if possible. Try to make any necessary image transformations before adding the data to MapObjects.
- Avoid using highly compressed image formats. This will lead to a performance hit when decompressing such images.