[OpenLayers-Users] Why does "OpenLayers.Layer.Vector" not work at all?

Manuel Reimer Manuel.Spam at nurfuerspam.de
Mon Jun 21 10:34:10 EDT 2010


Hello,

the following code does *exactly* what I want:

var layer = new OpenLayers.Layer.GML("Polygon", "relation.osm", {
   format: OpenLayers.Format.OSM,
   style: {strokeColor: "green", strokeWidth: 5, strokeOpacity: 0.5},
   projection: new OpenLayers.Projection("EPSG:4326")
});
map.addLayer(layer);

And the following code does *nothing*:

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: new OpenLayers.Projection("EPSG:4326"),
   style: {strokeColor: "green", strokeWidth: 5, strokeOpacity: 0.5},
});
map.addLayer(layer);

Where is my mistake? I finally give up after *many* tries!
IMHO it would help very much if OpenLayers would give more feedback. Why 
don't you have some calls to "throw" in your code to make it easier to 
debug...

Thanks in advance

Yours

Manuel




More information about the Users mailing list