Eric Lemoine wrote:
It is unexpected. What version of OpenLayers are you using? Do you
have a minimal example showing the problem?
I use the version accessible via
http://www.openlayers.org/api/OpenLayers.js
A minimal example could be something like example at the end of this
mail, but my code is much more complex and I didn't test if this reduced
code actually works. I placed the OpenLayers.js in the same directory
as my HTML to get sure I don't get problems with same origin policy.
I tried several things to debug, but OpenLayers seems to catch and
drop any errors, which started to suck at some point. It would be much
more helpful if OpenLayers would cause JS exceptions to cancel script
execution and add a log entry to the Error Console in Firefox. Another
problem is the compressed OpenLayers.js. Unreadable and (at least for
me) impossible to debug.
Reduced sample follows:
map = new OpenLayers.Map(map, {
projection: new OpenLayers.Projection(EPSG:900913),
displayProjection: new OpenLayers.Projection(EPSG:4326),
controls: [
new OpenLayers.Control.MouseDefaults(),
new OpenLayers.Control.Attribution()],
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,
20037508.34, 20037508.34),
numZoomLevels: 18,
maxResolution: 156543,
units: meters
});
map.addControl(new OpenLayers.Control.Permalink(permalink));
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.PanZoomBar());
layer_layerMapnik = new OpenLayers.Layer.OSM.Mapnik(Mapnik);
map.addLayer(layer_layerMapnik)
var layer = new OpenLayers.Layer.Vector(Polygon, {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: relation.osm,
format: new OpenLayers.Format.OSM()
}),
projection: map.displayProjection, //new
OpenLayers.Projection(EPSG:4326),
style: {strokeColor: green, strokeWidth: 5, strokeOpacity: 0.5}
});
map.addLayer(layer);
___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users