imageopenlayerszoominggwt-openlayers

openlayers image layer stretch with no blur effect


I use an Image Layer to draw some data at specific locations on my web application using gwt-openlayers. Assume the original image is 400x400 pixels. Whem I zoom in the map, the image is stretched. The problem is that the stretch effect is 'blurry'. How can I avoid this blurry effect and instruct openlayers to apply a normal 'raw' stretch on the image? Is there some options somewhere? When I say blurry, I mean this:

as you can see the center of the image has blended colors while the original image is exactly formed by four sub squares with four different colors

The image above demonstrate the concept. I have a 400x400 pixels image. The image is formed by 4 sub squares 200x200 pixels each. Top left square is blue, top right is red, bottom left is yellow and bottom right is red. When I draw this image as an image layer in openlayers and I zoom the map, the center of the image gets blurry and the four colors are blended. Is there a way to avoid this blur effect and have a 'raw' stretch? Thanks.

Here's the code (in gwt-openlayers) I use to create the image layer:

org.gwtopenmaps.openlayers.client.layer.ImageOptions imgOptions = new org.gwtopenmaps.openlayers.client.layer.ImageOptions();
imgOptions.setIsBaseLayer(false);
imgOptions.setTransitionEffect(TransitionEffect.RESIZE);
imgOptions.setAlwaysInRange(true);
imgOptions.setLayerOpacity(0.7);
imgOptions.setProjection("EPSG:900913");

imgLayer = new org.gwtopenmaps.openlayers.client.layer.Image("my_name",
                    null, bounds, new Size(1, 1), imgOptions);
map.addLayer(imgLayer);

Solution

  • Use a point with an external graphic to solve this. Resize the external graphic on zoom.

    See the showcase: http://demo.gwt-openlayers.org/gwt_ol_showcase/GwtOpenLayersShowcase.html?example=Image%20vector