[OpenLayers-Users] Re: I NEED FOR HELP
Ricardo Bayley
ricardo.bayley at gmail.com
Tue Jun 7 10:57:41 EDT 2011
Hi folks,
After a thorough revision of my code, I noticed that when testes OL 2.11 I
added this line of code.
OpenLayers.Layer.Vector.prototype.renderers = ["SVG2", "VML", "Canvas"];
For some reason this screws up my OL 2.10. After deleting this, OL works
fine.
Can anyone explain what that line of code does ?
What I cant get to work is the property cursor:"pointer" in the style.
I will keep you posted.
Pointers are always welcome
Ricardo
2011/6/7 Ricardo Bayley <ricardo.bayley at gmail.com>
> Hi Folks,
>
> I have this code
>
> * var q = arguments[0];*
> * var format = new OpenLayers.Format.GeoJSON({*
> * 'internalProjection': map.baseLayer.projection, //
> 900913*
> * 'externalProjection': new
> OpenLayers.Projection('EPSG:4326')*
> * });*
> * var features = format.read(js);*
> * q.layer.addFeatures(features);*
> *
> *
> * var z = map.getZoomForExtent(q.layer.getDataExtent())-1;*
> * map.setCenter(q.layer.getDataExtent().getCenterLonLat(), z);*
>
>
> so far, everything works fine. Layer gets loaded with the features, and the
> are displayed.
> the last two lines of code are giving me serious trouble. Don't know why,
> but features get duplicated and are slightly moved as if rendered at
> different scale or resolution.
>
> As soon as I pan the map, or switch base layers, or do anything that gets
> the map to "refresh", duplicated features are gone.
> If I don't zoom to the max extent of the layer, I dont get the duplicates.
> I do a console.debug(q.layer) and I don't see any duplicated features.
> Layer only has 50 features as it should.
>
> It got me thinking, and since this might also be a styling issue, this is
> the style I use.
>
> * var myStyle = new OpenLayers.StyleMap({*
> * "default": new OpenLayers.Style({*
> * cursor:"pointer",*
> * graphicZIndex: "${getZIndex}"*
> *
> *
> * },{context:funciones,*
> * rules: [*
> * new OpenLayers.Rule({*
> * // a rule contains an optional filter*
> * filter: new OpenLayers.Filter.Comparison({*
> * type: OpenLayers.Filter.Comparison.LESS_THAN,
> *
> * property: "fid", // the "" feature attribute*
> * value: 15 // first 15*
> * }),*
> * // if a feature matches the above filter, use
> this symbolizer*
> * symbolizer: {*
> * graphicHeight: 27,*
> * graphicWidth : 27,*
> * externalGraphic: "${getIcon}",*
> * graphicYOffset : "${getYOffset}"*
> * }*
> * }), *
> * new OpenLayers.Rule({*
> * // apply this rule if no others apply*
> * elseFilter: true,*
> * symbolizer: {*
> * cursor:"pointer",*
> * pointRadius: 4, // based on
> feature.attributes.type*
> * fillColor: "#5781FC",*
> * strokeColor: "#000000",*
> * strokeWidth: "1"*
> * }*
> * })*
> * ] *
> * }),*
> * "select":new OpenLayers.Style({*
> * graphicZIndex: 101*
> * })*
> * });*
>
> Anyhow, I attach a screenshot so you can see what I am talking about.
>
> Any pointers greatly appreciated
>
> Ricardo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110607/15b080f2/attachment-0001.html
More information about the Users
mailing list