how to find length array (markers) in OpenLayers.Layer.Vector ?

var data = new OpenLayers.Layer.Vector("Data", {
    styleMap: styleMap,
    strategies: [new OpenLayers.Strategy.Fixed()],
    protocol: new OpenLayers.Protocol.HTTP({
        url: "./data/data.geojson",
        format: new OpenLayers.Format.GeoJSON({
            extractStyles: true, 
            extractAttributes: true,
            maxDepth: 2

1 Answer 1


data.events.register("loadend", data, function() { console.log(data.features.length); });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.