[OpenLayers-Users] Issue creating Vector layer with data

Jacolin Yves yjacolin at free.fr
Thu Apr 9 08:58:32 EDT 2009


Hello,

I am trying to  create this vector layer after clicking on a buton:

/*--------- code ---------
  var styleMap = new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults(
    {fillColor: "green", fillOpacity: 1, strokeColor: "black"},
    OpenLayers.Feature.Vector.style["default"])
  );
  var gml= new OpenLayers.Layer.Vector(
    _name, 
    {
      strategies: [new OpenLayers.Strategy.Fixed()],
      protocol: new OpenLayers.Protocol.HTTP({
        url: gmlUrl,
        format: new OpenLayers.Format.GML({'externalProjection': new 
OpenLayers.Projection("EPSG:27572"),'internalProjection': 
map.baseLayer.projection})
      }),
      styleMap: styleMap
    }
  );
 map.addLayer(gml);
/*--------------------------

Layer is created but there is no data inside!

If I use GML constructor:

/*--------- code ---------
var gml = new OpenLayers.Layer.GML(_name, gmlUrl,{projection: new 
OpenLayers.Projection("EPSG:27572"),styleMap: styleMap}); 
/*--------------------------

This is working!

Any idea?

Thanks,

Y.
-- 
Yves Jacolin

Ne demandez pas si vous pouvez contribuer, contribuer ! :)
---
http://softlibre.gloobe.org



More information about the Users mailing list