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

2010-06-22 Thread Manuel Reimer
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


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

2010-06-21 Thread Eric Lemoine
On Monday, June 21, 2010, Manuel Reimer manuel.s...@nurfuerspam.de wrote:
 Arnd Wippermann wrote:
 I would suggest, that you can't use OpenLayers.Protocol.HTTP with local file
 (file://)

 H... Yes, that's it, but why did it work with the GML layer? Thanks
 for this info.

 I've set up a local apache server and served the files using HTTP and
 now everything seems to work...

It is unexpected. What version of OpenLayers are you using? Do you
have a minimal example showing the problem?

Thanks,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.com
___
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users