OK, found the problem and resolved it. The issue is that VML coords start at 0 at the bottom, whereas SVG coords start at 0 at the top.
The results I was getting from the map.getPixelFromLatLon were giving me pixels based on SVG coords. It is necessary to flip them if I am doing VML rendering so I do the following : y = (HEIGHT_OF_WINDOW - y) and I get the correct behavior. So I would suggest that the bug is that map.getPixelFromLatLong should return the coords for whatever system you are using, instead of in SVG coords. At least it seems to be a bug. Thanks On Wed, Dec 1, 2010 at 7:53 AM, cmeyer001 <[email protected]> wrote: > After doing more work with this after my post, I need to clarify what the > issue is. > > The demo you refer to is the type of behavior I am after. > > I have written some custom code to render the polygon segments ( the line > between each vertice of the polygon ) as great circle segments vs straight > line segments. > > The way that I do this is intercept the path in the drawPolygon methods of > the SVG and VML renderer classes and then compute and insert points into > that path to define the great circle geometry. > > This code works perfect in Mozilla, I can zoom, reposition the map, etc. > and the great circle segments render correctly. > > Under IE, if I do not reposition the map, the great circle paths show > correctly. If I move the map, the great circle points appear to be offset > exactly opposite in the same amount that the map layer was moved. > > My thought is that this is due to the way VML shows points vs SVG ( > differing coord systems ?) As I am changing core functionality of the way > things work I realize this is an error in my code, I just am not really sure > in which part of the code I should look for the answer. Any pointers on the > differences between how VML calculates shows points and SVG would be > appreciated. > > The high level design is to intercept the path in draw polygon, get the > LonLat object for each pixel by using map.getLonLatFromPixel method, pass > that to my code which computes the great circle path between the LonLats, > return an array of LonLat objects , then convert those back to pixels using > map.getPixelFromLonLat() method. I then rebuild the path string and return > it back to the drawPolygon method. > > It seems that I am getting incorrect results in the case of IE from the > getPixelFromLonLat() method. Would a different method be the correct > solution ? Or am I suffering from a core misunderstanding of what OpenLayers > is doing? > > Thanks again for any guidance. > > > > On Wed, Dec 1, 2010 at 1:10 AM, Andreas Hocevar-2 [via OSGeo.org] <[hidden > email] <http://user/SendEmail.jtp?type=node&node=5792125&i=0>> wrote: > >> Hi, >> >> I am not sure what you mean by "reposition the WMS base layer", but >> looking at http://openlayers.org/dev/examples/draw-feature.html, which >> seems to be similar to your application, I don't encounter any problems in >> IE. >> >> Andreas. >> >> On Nov 30, 2010, at 23:53 , cmeyer001 wrote: >> >> > >> > Hello, >> > >> > I am relatively new to OpenLayers and am encountering some strange >> behavior. >> > >> > I have 2 Layers, a WMS base layer and a vector layer overlayed so that I >> can >> > draw polygons on the map. >> > >> > In Mozilla when I reposition the WMS base layer the vector layer seems >> to >> > reposition in that I cant draw outside the extent of the WMS base layer >> ( >> > this is the behavior I desire ). >> > >> > In IE, on the initial load, things work great, the vector layer draws >> the >> > polygons exactly where they should be drawn, however if I move the WMS >> base >> > layer it appears that the Vector layer moves the same distance but in >> the >> > exact opposite direction. When I then attempt to draw the polygon shapes >> >> > they appear outside the extent of the WMS map. >> > >> > Based on the fact that it works as one would anticipate in Mozilla, >> however >> > it behaves differently in IE, I am inclined to call this a bug. >> > >> > Has anyone experienced similar behavior and has anyone figured a >> > work-around? >> > >> > I searched through the issue tracker and was not able to find an issue >> like >> > this. >> > >> > Thanks for any assistance. >> > >> > Regards >> > >> > Colby >> > -- >> > View this message in context: >> http://osgeo-org.1803224.n2.nabble.com/Strange-behavior-in-IE-vs-Mozilla-with-Vector-Layer-and-WMS-layer-tp5789952p5789952.html<http://osgeo-org.1803224.n2.nabble.com/Strange-behavior-in-IE-vs-Mozilla-with-Vector-Layer-and-WMS-layer-tp5789952p5789952.html?by-user=t&by-user=t> >> > Sent from the OpenLayers Users mailing list archive at Nabble.com. >> > _______________________________________________ >> > Users mailing list >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5790953&i=0> >> > http://lists.osgeo.org/mailman/listinfo/openlayers-users >> >> >> >> -- >> Andreas Hocevar >> OpenGeo - http://opengeo.org/ >> Expert service straight from the developers. >> >> _______________________________________________ >> Users mailing list >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5790953&i=1> >> http://lists.osgeo.org/mailman/listinfo/openlayers-users >> >> >> ------------------------------ >> View message @ >> http://osgeo-org.1803224.n2.nabble.com/Strange-behavior-in-IE-vs-Mozilla-with-Vector-Layer-and-WMS-layer-tp5789952p5790953.html<http://osgeo-org.1803224.n2.nabble.com/Strange-behavior-in-IE-vs-Mozilla-with-Vector-Layer-and-WMS-layer-tp5789952p5790953.html?by-user=t> >> To unsubscribe from Strange behavior in IE vs Mozilla with Vector Layer >> and WMS layer, click >> here<http://osgeo-org.1803224.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5789952&code=Y29sYnkuYy5tZXllckBnbWFpbC5jb218NTc4OTk1MnwyMDgxNzU5NjE1&by-user=t>. >> >> > > > ------------------------------ > View this message in context: Re: Strange behavior in IE vs Mozilla with > Vector Layer and WMS > layer<http://osgeo-org.1803224.n2.nabble.com/Strange-behavior-in-IE-vs-Mozilla-with-Vector-Layer-and-WMS-layer-tp5789952p5792125.html> > > Sent from the OpenLayers Users mailing list > archive<http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Users-f1822463.html>at > Nabble.com. > > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users > >
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
