[OpenLayers-Users] can't supply id to vector layer
Ruff, Thomas
Thomas.Ruff at solers.com
Thu May 22 14:39:13 PDT 2014
In OL 2.13.1 I'm getting this error:
"TypeError: this.container is null" in OpenLayers.debug.js (line 57513)
whenever I supply an id property to my Vector layer during construction. If I don't set an id on the layer everything works fine, but I want to use the id to find the layer later. The layer is being added dynamically as shown below.
var icaoLayer = new OpenLayers.Layer.Vector('myFeature', {
strategies: [new OpenLayers.Strategy.Fixed()],
id: 'myFeatureId',
protocol: new OpenLayers.Protocol.WFS({
url: '/server/wfs',
version: '1.1.0',
featureType: 'myFeatureType',
featureNS: 'namespace',
srsName: 'EPSG:4326',
outputFormat: 'json',
maxFeatures: 1
}),
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: 'stationid',
value: stationId
}),
visibility: true
});
icaoLayer.events.register('loadend', icaoLayer, function (evnt) {
var zoomLevel = 11;
openLayersMap.moveTo(new OpenLayers.LonLat(evnt.response.features[0].geometry.x, evnt.response.features[0].geometry.y), zoomLevel);
});
openLayersMap.addLayer(icaoLayer);
Is there something wrong with my code? This seems like a bug but I wanted to ask here before entering it.
Thanks,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140522/7d2d4054/attachment.html>
More information about the Users
mailing list