[OpenLayers-Users] OpenLayers.Layer.Vector not displaying

Mark Ayad Mark.Ayad at erudine.com
Mon Oct 6 10:13:46 EDT 2008


Hi all,

In the follwing example we add two layers, one a vector layer, and a marker layer.

The both layers appear in the layer switcher, but only the marker layer shows the marker.

The vector layer displays nothing. Any ideas ?

    public static native void addVectorLayer( JSObject map ) /*-{
          var point = new $wnd.OpenLayers.Geometry.Point(-20256.01492, 7063863.68047);
          var pointFeature = new $wnd.OpenLayers.Feature.Vector(point);
          var vectorLayer = new $wnd.OpenLayers.Layer.Vector("Simple Geometry");
          map.addLayer(vectorLayer);
          vectorLayer.addFeatures([pointFeature]);
          
          $wnd.alert("got here 1");
          
          var size = new $wnd.OpenLayers.Size(10,17);
          var offset = new $wnd.OpenLayers.Pixel(-(size.w/2), -size.h);
          var icon = new $wnd.OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',size,offset);
          var markers = new $wnd.OpenLayers.Layer.Markers( "Markers" );
          markers.addMarker(new $wnd.OpenLayers.Marker(new $wnd.OpenLayers.LonLat(-20256.01492, 7063863.68047),icon));
          map.addLayer(markers);
          
          $wnd.alert("got here 2");
          
    }-*/;

I have tried this with both openlayers 2.6 and 2.7
 
ps the map options for this map are:
 
    private static MapOptions getMapOptions() {
        Bounds MAP_BOUNDS = new Bounds( -829329, 6179586, 272732, 8275651 );
        MapOptions mapOptions = new MapOptions();
        mapOptions.setControls( new JObjectArray( new JSObject[] {} ) );
        mapOptions.setNumZoomLevels( 19 );
        mapOptions.setProjection( "EPSG:900913" );
        mapOptions.setAttribute( "units", "m" );
        mapOptions.setAttribute( "maxExtent", MAP_BOUNDS.getJSObject() );
        mapOptions.setAttribute( "maxResolution", 8187.752976562511D );
        return mapOptions;
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081006/62a6bc61/attachment.html


More information about the Users mailing list