OpenMap-java / openmap

OpenMap is an Open Source JavaBeans-based programmer's toolkit. Using OpenMap, you can quickly build applications and applets that access data from legacy databases and applications.
http://openmap-java.org
Other
73 stars 43 forks source link

GeoTIFFs not correctly hidden on zoom out #40

Open ianrenton opened 7 years ago

ianrenton commented 7 years ago

Hi,

I posted about this on the mailing list maybe a year ago, but having encountered the problem again I thought I'd post on the issue tracker.

When viewing GeoTIFF imagery on an ImageTileLayer, the images are only supposed to be displayed once you are zoomed in far enough. Once you zoom out past a certain level, a grey box is displayed instead, showing the geographical extent of the image. I assume at this point the image itself is supposed to be hidden, however, it continues being displayed at the same on-screen pixel size that it was before zooming out. The result is that you get a false impression of the geographical size of the image, where it appears much bigger geographically than it really is. The following image illustrates the problem:

Example

Steps to reproduce:

  1. Using OpenMap 5.1.15, include the JAI JARs and static libraries required for GeoTIFF display on the path/classpath
  2. Add an ImageTileLayer, e.g. in openmap.properties:
    openmap.layers=(...) geotiff
    openmap.startUpLayers=(...) geotiff
    geotiff.class=com.bbn.openmap.layer.imageTile.ImageTileLayer
    geotiff.prettyName=GeoTiffs
  3. Run OpenMap
  4. Edit the ImageTile layer, click Add and locate a GeoTIFF file (see below for example).
  5. Once the file appears in the list, select it and click "Go To" to zoom to the location of the GeoTIFF at its best-fit size
  6. Zoom out at least twice using the on-screen "-" button.

I have also encountered the issue using programmatically created ImageTiles, so I am wondering if the issue is somewhere around ImageTile's updateImageForProjection() / shouldFetchForProjection() methods, but I can't see an obvious path by which it could display both the image and the grey box. Is it maybe keeping the image graphic in the layer's graphic list and not removing it when the projection no longer requires it to be rendered?

(I have uploaded an example GeoTIFF file here for you to try if you don't have a suitable file. The image was converted for OpenMap from the US government open data set available here.)

dfdietrick commented 7 years ago

Thanks for all the information (and for the previous note, I haven't forgotten). I'm working on the next release, I'll check this out within the next week or so.