[OpenLayers-Users] Issue creating Vector layer with data
Christopher Schmidt
crschmidt at metacarta.com
Thu Apr 9 09:21:11 EDT 2009
On Thu, Apr 09, 2009 at 02:58:32PM +0200, Jacolin Yves wrote:
> 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!
Are you using trunk, or 2.7? 2.7 doesn't have reprojection support. How
are you testing that there is 'nothing inside'? checking layer.features,
watching XMLHttpRequest, or just visual inspection?
-- Chris
> Any idea?
>
> Thanks,
>
> Y.
> --
> Yves Jacolin
>
> Ne demandez pas si vous pouvez contribuer, contribuer ! :)
> ---
> http://softlibre.gloobe.org
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list