[OpenLayers-Users] Re: OpenLayers.Layer.Vector shifted in IE9 compatibility mode

Ricardo Bayley ricardo.bayley at gmail.com
Wed Apr 25 13:07:49 EDT 2012


I checked if styling has anything to do with it.
If I dont set any styling, leave default style, then features get rendered
properly.

this is the styl I use

* var style = function(){*
* var defaultStyle = new OpenLayers.Style({*
* cursor:"pointer",*
* graphicHeight: "14" ,*
* graphicWidth : "14",         *
*        externalGraphic: "imgs/panoramio-marker.png",*
*        graphicZIndex: 999*
* }),*
* selectStyle = new OpenLayers.Style({*
* graphicZIndex: 1001,*
* graphicHeight: "22",*
* graphicWidth : "22"    *
* }),*
* myStyle = new OpenLayers.StyleMap({*
* 'default': defaultStyle,*
* 'select': selectStyle*
* }); *
*    return myStyle;*
* }; *

* app.panoramio.layer.styleMap = style();*

FYI:* * panoramio-marker.png is a 18px X 18px png file.


Any ideas ?


ricardo



2012/4/25 Ricardo Bayley <ricardo.bayley at gmail.com>

> Hi everyone,
>
> I am trying to load Panoramios pictures. It works great on every browser
> but in IE6, 7, 8 and IE9 compatibility mode features are not place properly.
> Location is shifted. If I select any feature and show the popup, then
> popup is shown in the correct X,Y location.
>
> This is the code I user to load panoramios json to the
> OpenLayers.Layer.Vector class
>
> * var lyr = app.panoramio.layer, photo, feature, GeoJSON =
> {"type":"FeatureCollection","total":data.photos.length,"features":[]}; *
> * for(i=0; i < data.photos.length; i++){*
> * photo = data.photos[i];*
> *
> *
> * if(lyr.getFeaturesByAttribute("photo_id",photo.photo_id).length===0){*
> * feature =
> {"type":"Feature","geometry":{"type":"Point","coordinates":[photo.longitude,
> photo.latitude]},"properties":photo};*
> * GeoJSON.features.push(feature);  *
> * }*
> * };*
> *
> *
> * // Reproject*
> * var format = new OpenLayers.Format.GeoJSON({*
> *        'internalProjection': new OpenLayers.Projection('EPSG:900913'),*
> *        'externalProjection': new OpenLayers.Projection('EPSG:4326')*
> * }),*
> * f = format.read(GeoJSON);*
> * lyr.addFeatures(f);*
> *
> *
> Any ideas why is this happening ? Is there a workaround ?
> What I dont understand is I have other GeoJSON vector layers which load
> correctly in every browser.
> Could this have anything to do with styling ?
>
>
> best regards,
>
>
> Ricardo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120425/d793cec4/attachment.html


More information about the Users mailing list