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

<<attachment: ba.JPG>>

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to