0

I am learning openlayers3 with ol v3.20.1
I've got to the point in the book, where I can read/write GeoJSON with StaticVector, but the following code:

var statVec = new ol.layer.Vector({
 source: new ol.source.StaticVector({
  format: new ol.format.GeoJSON(),
  projection: 'EPSG:3857'
 })
});

errors out with:

TypeError: undefined is not a constructor (evaluating 'new ol.source.StaticVector({
            format: new ol.format.GeoJSON(),
            projection: 'EPSG:3857'
        })')
    global code

I realize, there was an API change, since the book came out, but I can't find what StaticVector was replaced with.

igoryonya
  • 167
  • 3
  • 12

1 Answers1

2

ol.source.StaticVector along with other similar experimental Vector sources were removed in v3.5.0. Regarding your question ol.source.StaticVector is replaced with ol.source.Vector.

See this release details

https://github.com/openlayers/openlayers/releases/tag/v3.5.0

Sumanth Shastry
  • 1,139
  • 1
  • 19
  • 28
  • Yes, thank You. It helped, but 'StaticVector' is not mentioned anywhere in the resource, you've shared with the link. – igoryonya Feb 10 '17 at 05:26
  • Yes its not mentioned but i dont know why? `ol.source.ServerVector` similar to it is mentioned and removed in this version – Sumanth Shastry Feb 10 '17 at 05:30