WMS in OpenLayers: Objects get Cut

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

WMS in OpenLayers: Objects get Cut

Pfirter Lukas
WMS in OpenLayers: Objects get Cut

Hi list,
I have a UMN mapserver setup that I try to access with OpenLayers.
I can get the objects and it displays the PNG images for them in OL. But these objects don't seem to get repeated over multiple mapserver pictures (meaning I see an objects, for example a train station symbol and the half of its description. The other part of the description should be in the next image receieved from the mapserver, but I don't see it). Google Maps under my WMS layer works fine.

What could be the problem? Does OL get wrong images from the mapserver? Or is the grid from the mapserver images setup wrong?

Are there settings in OpenLayers for this?
Thank you.


_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Tim Schaub-2
Pfirter Lukas wrote:

> Hi list,
> I have a UMN mapserver setup that I try to access with OpenLayers.
> I can get the objects and it displays the PNG images for them in OL. But
> these objects don't seem to get repeated over multiple mapserver
> pictures (meaning I see an objects, for example a train station symbol
> and the half of its description. The other part of the description
> should be in the next image receieved from the mapserver, but I don't
> see it). Google Maps under my WMS layer works fine.
>
> What could be the problem? Does OL get wrong images from the mapserver?
> Or is the grid from the mapserver images setup wrong?

Each request to a WMS for an image tile is independent.  When you you
request a tile from MapServer with bounds that contain your train
station (point), MapServer will render as much of that symbol as it can
on that tile.  When you request the next tile that doesn't contain the
train station (point), MapServer has no reason to render a partial train
station.

You can get around this in two ways:
1) use something that requests larger tiles with a buffer, slices them
up in to smaller tiles and discards the buffer - see http://tilecache.org

or

2) use the "gutter" property on your WMS layer in OpenLayers - see
http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.gutter

# ignore a 10 pixel gutter around each tile
var layer = new OpenLayers.Layer.WMS(name, url, params, {gutter: 10});

Good luck,

Tim


>
> Are there settings in OpenLayers for this?
> Thank you.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://openlayers.org/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Pfirter Lukas
In reply to this post by Pfirter Lukas
Hello Tim, thank you for the answer!
I looked into solution (1) and it seemed to be too complicated and needs cgi-script installation on the server, also configuration for each layer to make it work.
Actually "gutter" is probably what I need - but there is almost nothing on google about gutter/openlayers... :(
This is my test application:
http://map.webser125.lookass.ch/openlayers/ex_rpag_google.php
I used "gutter: 200" on it, but nothing changed / happened. Applying any gutter doesn't change anything. What am I missing?
(btw: looking at this WMS in a Desktiop GIS like UDIG works fine, all descriptions are totally visible...)

Thanks!


-----Ursprüngliche Nachricht-----
Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Tim Schaub
Gesendet: Donnerstag, 12. Juli 2007 22:24
Cc: [hidden email]
Betreff: Re: [OpenLayers-Users] WMS in OpenLayers: Objects get Cut


Each request to a WMS for an image tile is independent. When you you request a tile from MapServer with bounds that contain your train station (point), MapServer will render as much of that symbol as it can on that tile.  When you request the next tile that doesn't contain the train station (point), MapServer has no reason to render a partial train station.

You can get around this in two ways:
1) use something that requests larger tiles with a buffer, slices them up in to smaller tiles and discards the buffer - see http://tilecache.org

or

2) use the "gutter" property on your WMS layer in OpenLayers - see http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.gutter

# ignore a 10 pixel gutter around each tile var layer = new OpenLayers.Layer.WMS(name, url, params, {gutter: 10});

Good luck,

Tim
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Benoit Myard
You may want to use OpenLayers.Layer.WMS.Untiled instead of
OpenLayers.Layer.WMS.

--
Benoit Myard
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Pfirter Lukas
In reply to this post by Pfirter Lukas
Well there are 2 different problems:

Problem 1: With OpenLayers.Layer.WMS: The description of an object in one tile is not continued in the next tile that comes from the mapserver. In the meantime, I know that this is "normal behaviour" of the mapserver, because he doesn't know, that OpenLayers is going to get an other tile right next to it and therefore doesn't display a part of a discription from an object not in this tile.

Problem 2: With OpenLayers.Layer.WMS.Untiled: When entering the map, everything seems fine. But as soon as I zoom in, only a little part from the MapServer is visible above the Google Layer. When moving the map around a few times, it gets visible. When zooming in again, same thing: I have to move the map around to make everything visible that should be there. I think this is a OL problem. See this: http://map.webser125.lookass.ch/openlayers/ex_rpag_google2.php
You can see a fwe objects (white arrows, ...). When you zoom in, only one arrow is visible at the top left (there should be more things in the center area). Moving the map around and back to where you were makes the other things visible... This problem exists in Firefox 2 AND IE 7...

Lucas

-----Ursprüngliche Nachricht-----
Von: Benoit Myard [mailto:[hidden email]]
Gesendet: Dienstag, 17. Juli 2007 16:37
An: Pfirter Lukas
Betreff: Re: [OpenLayers-Users] WMS in OpenLayers: Objects get Cut

On 13/07/07, Pfirter Lukas <[hidden email]> wrote:
> I've already tried "OpenLayers.Layer.WMS.Untiled"...
> It actually works fine as long as you don't zoom or move the map around (as long as you stay in the entry view).
> As soon as zooming in one level, it gets cut again...

What do you mean "cut" ? I think I've missed something because I use WMS.Untiled with no problem!

--
Benoit Myard
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Benoit Myard
Now I understand.

Well, it looks like some Google tiles appear upon -- and hide -- your
WMS Layer. As far as I can tell, you add your WMS layer before your
Google layer to the map. As often in IT, it may be a good starting
point to fix that, "just to make sure".

So please, use this piece of code in your page :

var satellite = new OpenLayers.Layer.Google( "Google Satellit" ,
{type: G_SATELLITE_MAP, 'maxZoomLevel':19} );
var karte = new OpenLayers.Layer.Google( "Google Karte" , {type:
G_NORMAL_MAP, 'maxZoomLevel':19} );
var hybrid = new OpenLayers.Layer.Google( "Google Hybrid" , {type:
G_HYBRID_MAP, 'maxZoomLevel':19} );
map.addLayers([satellite, karte, hybrid]);

var layer = new OpenLayers.Layer.WMS.Untiled( "RPAG",
"http://map.webser125.lookass.ch/cgi-bin/mapserv?map=/home/web/web4/data_rpaglocation/rpag_lp_test.map",
{layers:'anfahrtsweg,oeffentlicher_verkehr', transparent:true,
format:'image/png'} );
map.addLayer(layer);

Now please, let us know if the problem is still there.

--
Benoit Myard
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Pfirter Lukas
In reply to this post by Pfirter Lukas
Hi Benoit, thanks for your quick answer!
Unfortunately, putting the WMS layer above the Google-Layers in the code (http://map.webser125.lookass.ch/openlayers/ex_rpag_google_test.php) doesn't change anything, WMS still hides partially.
I've seen that I just have to move the map a slightly little bit after changing the zoom to make everything visible like should be... Isn't there like a function that will move the map 1 px everytime you change zoom? Or another workaround for this? Is it a bug actually?



-----Ursprüngliche Nachricht-----
Von: Benoit Myard [mailto:[hidden email]]
Gesendet: Mittwoch, 18. Juli 2007 10:05
An: Pfirter Lukas
Cc: [hidden email]
Betreff: Re: [OpenLayers-Users] WMS in OpenLayers: Objects get Cut

Now I understand.

Well, it looks like some Google tiles appear upon -- and hide -- your WMS Layer. As far as I can tell, you add your WMS layer before your Google layer to the map. As often in IT, it may be a good starting point to fix that, "just to make sure".

So please, use this piece of code in your page :

var satellite = new OpenLayers.Layer.Google( "Google Satellit" ,
{type: G_SATELLITE_MAP, 'maxZoomLevel':19} ); var karte = new OpenLayers.Layer.Google( "Google Karte" , {type:
G_NORMAL_MAP, 'maxZoomLevel':19} );
var hybrid = new OpenLayers.Layer.Google( "Google Hybrid" , {type:
G_HYBRID_MAP, 'maxZoomLevel':19} );
map.addLayers([satellite, karte, hybrid]);

var layer = new OpenLayers.Layer.WMS.Untiled( "RPAG", "http://map.webser125.lookass.ch/cgi-bin/mapserv?map=/home/web/web4/data_rpaglocation/rpag_lp_test.map",
{layers:'anfahrtsweg,oeffentlicher_verkehr', transparent:true, format:'image/png'} ); map.addLayer(layer);

Now please, let us know if the problem is still there.

--
Benoit Myard
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Benoit Myard
> Is it a bug actually?

I think so. You should fill a ticket for this [1] and try keep the
example online for a while.

> I've seen that I just have to move the map a slightly little bit after changing
> the zoom to make everything visible like should be... Isn't there like a function
> that will move the map 1 px everytime you change zoom? Or
> another workaround for this?

You may use 'map::pan(dx, dy)' but this is ugly.

[1] http://trac.openlayers.org/ (Opening tickets requires to be logged in)

--
Benoit Myard
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Christopher Schmidt-2
In reply to this post by Pfirter Lukas
On Wed, Jul 18, 2007 at 11:05:35AM +0200, Pfirter Lukas wrote:
> Hi Benoit, thanks for your quick answer!
> Unfortunately, putting the WMS layer above the Google-Layers in the code (http://map.webser125.lookass.ch/openlayers/ex_rpag_google_test.php) doesn't change anything, WMS still hides partially.
> I've seen that I just have to move the map a slightly little bit after changing the zoom to make everything visible like should be... Isn't there like a function that will move the map 1 px everytime you change zoom? Or another workaround for this? Is it a bug actually?

There is definitely a bug here. The problem is that the bounding box
requested for the tile is not actually in the right place -- it's off by
about .02 degrees, it looks like, which is a fair distance.

Could you try upgrading to the latest svn code --

  svn co http://svn.openlayers.org/trunk/openlayers/

will get the code for you -- and see if it still happens? It looks like
you're currently running against 2.4-RC2, and although I'm not really
hopeful that this change will fix the problem, I'm hopeful that it will
at least elmiinate that as part of it.

Another question -- did you see this with tiled layers as well? I think
the answer is yes, but I can't remember.

Thanks in advance for trying to help us dig into it.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Christopher Schmidt-2
In reply to this post by Pfirter Lukas
On Wed, Jul 18, 2007 at 11:05:35AM +0200, Pfirter Lukas wrote:
> Hi Benoit, thanks for your quick answer!
> Unfortunately, putting the WMS layer above the Google-Layers in the code (http://map.webser125.lookass.ch/openlayers/ex_rpag_google_test.php) doesn't change anything, WMS still hides partially.
> I've seen that I just have to move the map a slightly little bit after changing the zoom to make everything visible like should be... Isn't there like a function that will move the map 1 px everytime you change zoom? Or another workaround for this? Is it a bug actually?

(Looks like I mistakenly sent to user instead of to list  -- )

The problem here appears to be that the bounding box for the tile is off
in both directions by a significant amount, which results in the tile
not having the correct data.

Could you try updating the code to run against SVN head -- you can point
to http://openlayers.org/dev/lib/OpenLayers.js temporarily to do so --
and see if the behavior changes at all? Also, just to confirm -- this
problem happens with WMS Tiled layers too, correct?

I just want to make sure that this isn't a problem with OL-2.4 RC2. I
doubt it, but you never know.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Pfirter Lukas
In reply to this post by Pfirter Lukas
Hi Chris, and thanks for the help.

I downloaded the latest svn version (I think it worked, I don't have SVN, did it with "wget -r").
http://map.webser125.lookass.ch/openlayers_svn/ex_rpag_google_untiled.php
Copied the file that includes OL in there and still the same thing happens.

As you see, this does only happens with OpenLayers.Layer.WMS.Untiled. Without "Untiled", it works:
http://map.webser125.lookass.ch/openlayers_svn/ex_rpag_google.php
But I have other problems with that one: My mapserver doesn't continue object descriptions in tiles that end in other tiles. I know this can be fixed with "tilecache" or tools like that, but this one seems to be a bit too complex for that I just want a simple WMS displayed in OL the right way.

Do you want me to add these new links to the Bug report too? I will for sure keep them online until it is fixed (I saw milestone is 2.5, gonna take a while though?).

Thanks,
Lucas




-----Ursprüngliche Nachricht-----
Von: Christopher Schmidt [mailto:[hidden email]]
Gesendet: Donnerstag, 19. Juli 2007 15:07
An: Pfirter Lukas
Cc: [hidden email]
Betreff: Re: [OpenLayers-Users] WMS in OpenLayers: Objects get Cut

On Wed, Jul 18, 2007 at 11:05:35AM +0200, Pfirter Lukas wrote:
> Hi Benoit, thanks for your quick answer!
> Unfortunately, putting the WMS layer above the Google-Layers in the code (http://map.webser125.lookass.ch/openlayers/ex_rpag_google_test.php) doesn't change anything, WMS still hides partially.
> I've seen that I just have to move the map a slightly little bit after changing the zoom to make everything visible like should be... Isn't there like a function that will move the map 1 px everytime you change zoom? Or another workaround for this? Is it a bug actually?

There is definitely a bug here. The problem is that the bounding box requested for the tile is not actually in the right place -- it's off by about .02 degrees, it looks like, which is a fair distance.

Could you try upgrading to the latest svn code --

  svn co http://svn.openlayers.org/trunk/openlayers/

will get the code for you -- and see if it still happens? It looks like you're currently running against 2.4-RC2, and although I'm not really hopeful that this change will fix the problem, I'm hopeful that it will at least elmiinate that as part of it.

Another question -- did you see this with tiled layers as well? I think the answer is yes, but I can't remember.

Thanks in advance for trying to help us dig into it.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: WMS in OpenLayers: Objects get Cut

Christopher Schmidt-2
On Fri, Jul 20, 2007 at 01:37:51PM +0200, Pfirter Lukas wrote:
> Hi Chris, and thanks for the help.
>
> I downloaded the latest svn version (I think it worked, I don't have SVN, did it with "wget -r").
> http://map.webser125.lookass.ch/openlayers_svn/ex_rpag_google_untiled.php
> Copied the file that includes OL in there and still the same thing happens.
>
> As you see, this does only happens with OpenLayers.Layer.WMS.Untiled. Without "Untiled", it works:
> http://map.webser125.lookass.ch/openlayers_svn/ex_rpag_google.php

Thanks. That's definitely informative. If you could add that to the bug
description, I'd appreciate it.

-- Chris

> But I have other problems with that one: My mapserver doesn't continue object descriptions in tiles that end in other tiles. I know this can be fixed with "tilecache" or tools like that, but this one seems to be a bit too complex for that I just want a simple WMS displayed in OL the right way.
>
> Do you want me to add these new links to the Bug report too? I will for sure keep them online until it is fixed (I saw milestone is 2.5, gonna take a while though?).
>
> Thanks,
> Lucas
>
>
>
>
> -----Urspr?ngliche Nachricht-----
> Von: Christopher Schmidt [mailto:[hidden email]]
> Gesendet: Donnerstag, 19. Juli 2007 15:07
> An: Pfirter Lukas
> Cc: [hidden email]
> Betreff: Re: [OpenLayers-Users] WMS in OpenLayers: Objects get Cut
>
> On Wed, Jul 18, 2007 at 11:05:35AM +0200, Pfirter Lukas wrote:
> > Hi Benoit, thanks for your quick answer!
> > Unfortunately, putting the WMS layer above the Google-Layers in the code (http://map.webser125.lookass.ch/openlayers/ex_rpag_google_test.php) doesn't change anything, WMS still hides partially.
> > I've seen that I just have to move the map a slightly little bit after changing the zoom to make everything visible like should be... Isn't there like a function that will move the map 1 px everytime you change zoom? Or another workaround for this? Is it a bug actually?
>
> There is definitely a bug here. The problem is that the bounding box requested for the tile is not actually in the right place -- it's off by about .02 degrees, it looks like, which is a fair distance.
>
> Could you try upgrading to the latest svn code --
>
>   svn co http://svn.openlayers.org/trunk/openlayers/
>
> will get the code for you -- and see if it still happens? It looks like you're currently running against 2.4-RC2, and although I'm not really hopeful that this change will fix the problem, I'm hopeful that it will at least elmiinate that as part of it.
>
> Another question -- did you see this with tiled layers as well? I think the answer is yes, but I can't remember.
>
> Thanks in advance for trying to help us dig into it.
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
>

--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users