Re: Image Server, Shape Layers and Image bounds problem

From: Paul Chisholm <paulch@bigpond.com>
Date: Tue Apr 09 2002 - 21:34:03 EDT

Hi Don,

thanks for the reply, it has helped me further investigate the problem.
The -Ddebug.imageserver did not throw any light on the subject
but -Ddebug.shape did.

My chunk of code that generates the image is

        System.out.println(centre.toString() + "\nScale=" + scale +
"\nWidth=" + width + "\nHeight="+ height);
        Mercator proj = new Mercator(centre, scale, width, height);
        server.setLayers(layers);
        byte[] bytes = server.getMapImage(proj);

I added a trace statement to print the projection parameters. Here is a
segment of the trace file.
*******************************************************
Request 1
---------
LatLonPoint[lat=-30.0,lon=145.0]
Scale=1.2E8
Width=240
Height=160

OpenMap|ShapeLayer.ShapeWorker.construct(): getting graphics...
ShapeLayer.computeGraphics(): Dateline is on screen
OpenMap|ShapeLayer.ShapeWorker.construct(): fetched 70 graphics in 0.07
seconds
ShapeLayer.paint(): 70 omg shadow=0,0
ShapeLayer.paint(): done

Request 2
---------
LatLonPoint[lat=-28.0,lon=135.0]
Scale=1.2E7
Width=480
Height=400

Land|ShapeLayer.ShapeWorker.construct(): getting graphics...
Land|ShapeLayer.ShapeWorker.construct(): fetched 35 graphics in 0.05 seconds
ShapeLayer.paint(): 35 omg shadow=0,0
ShapeLayer.paint(): done

Request 3
---------
LatLonPoint[lat=-30.0,lon=145.0]
Scale=1.2E8
Width=240
Height=160

ShapeLayer: projection not different, returning...
OpenMap|ShapeLayer.ShapeWorker.construct(): getting graphics...
ShapeLayer.computeGraphics(): Dateline is on screen
OpenMap|ShapeLayer.ShapeWorker.construct(): fetched 70 graphics in 0.03
seconds

Request 4
---------
LatLonPoint[lat=-30.0,lon=145.0]
Scale=1.2E8
Width=240
Height=160

OpenMap|ShapeLayer.ShapeWorker.construct(): getting graphics...
ShapeLayer.computeGraphics(): Dateline is on screen
OpenMap|ShapeLayer.ShapeWorker.construct(): fetched 70 graphics in 0.03
seconds
ShapeLayer.paint(): 70 omg shadow=0,0
ShapeLayer.paint(): done
*******************************************

The interesting one is request 3. In particular the line

    ShapeLayer: projection not different, returning...

It looks like the system thinks the projection is unchanged and doesnt
regenerate the shape layer. However from the trace the projection must have
changed since the parameters are different. This is the request in which the
shape layer is missing from the image. I had a quick look at the code but I
need to spend more time on it to make sense of it. As a test I created
MyShapeLayer which over-rides projectionChanged in ShapeLayer with

    public void projectionChanged(ProjectionEvent ev) {

    Projection newProj = ev.getProjection();
    String newPID = newProj.getProjectionID();
    projection = newProj;
    projID = newPID;

    doPrepare();
    }

I have just removed the test for the projection change. Using MyShapeLayer
the problem disappears.

Paul

----- Original Message -----
From: "Don Dietrick" <dietrick@bbn.com>
To: "Paul Chisholm" <paulch@bigpond.com>
Cc: <openmap-users@bbn.com>
Sent: Wednesday, April 10, 2002 12:54 AM
Subject: Re: Image Server, Shape Layers and Image bounds problem

Paul,

When the shape layer is missing, is it even being asked for any
graphics? You could set a -Ddebug.shape command line to see if it is
getting pinged. Actually, you could use -Ddebug.imageserver for better
messages about what the image server is doing with what layers.

I haven't seen this behavior. The ImageServer should be calling the
layer's ProjectionPainter method (renderDataForProjection()), so the
layer shouldn't be reacting differently to any one projection over
another - i.e. what you are expecting to happen should be happening.

- Don

On Tuesday, April 9, 2002, at 01:37 AM, Paul Chisholm wrote:

> Hi,
>
> I have a server that uses OpenMap to generate JPEG files and it is
> exhibiting some strange behaviour. The images are created via the
> ImageServer class. Two different types of image are generated, one
> essentially a large scale version of the other. Both consist of a shape
> layer and a few other (non Shape) layers. What happens is:
>
> - request first image, ok
> - request second image, shape layer missing
> - request first image, shape layer missing
> - request second image, shape layer missing
> - request second image, ok
> - request second image, ok
> - request first image, shape layer missing
> etc
>
> The pattern is that each time I change between maps the shape layer is
> missing from the image. However, a subsequent request for the same map
> includes the shape layer.
>
> I experimented with various parameters and eventually found that the
> cause of the missing shape layer is due to the change in dimensions of
> the image. That is, when there is a change to either <width> or
> <height> in the following (wrt the previous request) the shape layer is
> missing from the image (95% of the time).
>
> server.setLayers(<layers>);
> Mercator proj = new Mercator(<centre>, <scale>, <width>,
> <height>);
> byte[] bytes = server.getMapImage(proj);
>
> Changing <centre>, <scale> or <layers> causes no problem.
>
> I am using OpenMap 4.4.2 on Windows NT 4 (SP6). Anyone know of any
> reason why this behaviour occurs, or how I might be configuring
> something incorrectly to induce the behaviour.
>
> Thanks,
> Paul Chisholm
>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Apr 10 07:38:10 2002

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:32 EDT