Hi guys I'm trying to create a vector layer using the angular-openlayers-directive. But a keep getting back this error:
TypeError: Cannot set property 'index' of undefined
at addLayerBeforeMarkers
...
And this is the code I'm using to configure my map in my controller:
$scope.layers = [
{
name: 'first',
source: {
type: 'ImageWMS',
url: 'http://mymapserver/blah',
params: {LAYERS: ''}
}
},
{
name: 'features',
source: {
type: 'Vector',
source: null //I've tried without this option also.
}
}
];
And this is the HTML:
<openlayers ol-center="ven" height="100vh">
<ol-layer name="{{layer.name}}" ol-layer-properties="layer" ng-repeat="layer in layers"></ol-layer>
</openlayers>
Why is it so hard to a Vector Layer to my map. All I want is to add and remove features later, so there isn't much sense in using a GeoJSON Layer, which I've seen in the examples quite a lot.
How can I add a vector layer to my map? How can I manually add some features to this vector layer? All of this using Angular.