Hi Hareck, I haven't used the protocol method for vector layers before, so I'm not sure what could be going wrong with your current code. But what if instead of using a protocol in the layer, you used the OpenLayers.Format.GPX class to read the gpx files into a feature collection, then use the OpenLayers.Layer.Vector:addFeatures() method to draw the gpx features in the layer? I've been doing a similar approach with WKT features, and it's been working so far.
Mike On Tuesday, December 07, 2010 04:37:47 Hareck wrote: > Hi, > > Nobody with an idea what could be wrong? > > The gpx layer from the iframe is added to the map and shown in the map > correctly. But if zoom changed or layer is switched on/off in the > layerSwitcher the layer is drawn in correct scale but old layer (from the > view before) is not deleted, with the result that multiple layer are > shown. > > Here is a HTML extract made by Firebug: > > <g id="OpenLayers.Layer.Vector_8_vroot"> > > <polyline id="OpenLayers.Geometry.LineString_962" points="527.92,293.395 > 528.058,293.438 . 528.317,293.346 527.901,293.381" fill="none" > stroke="blue" stroke-opacity="0.5" stroke-width="4" stroke-linecap="round" > stroke-linejoin="round"/> > > <polyline id="OpenLayers.Geometry.LineString_962" points="527.92,293.395 > 528.058,293.438 . 528.317,293.346 527.901,293.381" fill="none" > stroke="blue" stroke-opacity="0.5" stroke-width="4" stroke-linecap="round" > stroke-linejoin="round"/> > > <polyline id="OpenLayers.Geometry.LineString_962" points="519.96,274.697 > 520.029,274.719 . 520.158,274.673 519.95,274.691" fill="none" > stroke="blue" stroke-opacity="0.5" stroke-width="4" stroke-linecap="round" > stroke-linejoin="round"/></g> > > What's happening here : > 1. The gpx layer is set from iframe to map and layerSwitcher. > <g id="OpenLayers.Layer.Vector_8_vroot"> is empty. > > 2. Switch on layer in layerSwitcher > <g id="OpenLayers.Layer.Vector_8_vroot"> first LineString is added. Layer > is shown in map. > > 3. Switch off/on layer in layerSwitcher > <g id="OpenLayers.Layer.Vector_8_vroot"> second LineString with the same > points is added. Layer is shown in map. The line color gets more blue. > > 4. After map zoom > <g id="OpenLayers.Layer.Vector_8_vroot"> third LineString with new > calculated points is added. Layer is shown in map correctly. This is the > third shown layer. > > > > Example is here: > > http://www.hareck.lima-city.de/OL/testol-wms-if-vector.html > > Thank you for any advice. > > Hareck > > ----- Original Message ----- > From: Hareck > To: OpenLayers, users list > Sent: Wednesday, December 01, 2010 5:08 PM > Subject: [OpenLayers-Users] zoom problem with gpx vector layers > > > Hi all, > > I have a zoom problem with gpx vector layers which are set from an > iframe. > > I use two windows, a main window with a wms-map and 2 gpx vector layers > (route 1, 2) and an iframe where I can set an additional gpx vector layer > (route 3, 4 or 5) in the wms-map. All layers will be shown correctly. But > if I change the scale (zoom) the layer from the iframe is shown multiple, > in the current scale and in the last scale(s). > > I have no explanation for this behavior. > > > > Best Regards > > Hareck > > > > --------------------------------------------------------------------------- > --- > > > _______________________________________________ > 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
