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

Arnd Wippermann arnd.wippermann at web.de
Mon Jun 21 11:57:26 EDT 2010


Hi,

If you mean by *nothing*, that you get nothing displayed, then I guess you
use IE. There is a comma in your code, where it not should be.

style: {strokeColor: "green", strokeWidth: 5, strokeOpacity: 0.5}, <--

The code you use, should work in FF. 

If the comma is the reason for the failing, then an OpenLayers throw
wouldn't help.

Arnd


-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Manuel Reimer
Gesendet: Montag, 21. Juni 2010 16:34
An: users at openlayers.org
Betreff: [OpenLayers-Users] Why does "OpenLayers.Layer.Vector" not work
atall?

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

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list