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

Andreas Hocevar ahocevar at opengeo.org
Thu Apr 26 12:35:47 EDT 2012


Is the shift about 1 pixel or more?

Andreas.

On Thu, Apr 26, 2012 at 10:35 AM, Ricardo Bayley
<ricardo.bayley at gmail.com> wrote:
> Ok, but it also happens with IE6. Yet to try IE7 and 8.
>
>
> 2012/4/25 Andreas Hocevar <ahocevar at opengeo.org>
>>
>> Probably not the answer you want to hear, but don't use compatibility
>> mode. In standards mode, everything will work fine using the SVG renderer.
>>
>> Andreas.
>>
>> On Apr 25, 2012 1:07 PM, "Ricardo Bayley" <ricardo.bayley at gmail.com>
>> wrote:
>>>
>>> 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
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list