[OpenLayers-Dev] Plot features onto multiple layers from one HTTP request

khanh703 khanh at whitecanvasgroup.com
Wed Jun 4 07:50:02 PDT 2014

I would like to plot features onto multiple layers from one HTTP request ie
(Burgers, Hot Dogs, etc...)

I can achieve what I want by making multiple request but would rather make
one request.

How can I achieve plotting on different layers:
1. Change the protocol attributes to read from local ARRAY and do a while
2. Change my FeatureCollection structure

This below works but all features are plotted on the same layer:
markers = new OpenLayers.Layer.Vector(thisLayer, {
            preFeatureInsert: preFeatureInsert,
            strategies: [
                new OpenLayers.Strategy.Fixed(),
                new OpenLayers.Strategy.Cluster({
                    distance: 20
            protocol: new OpenLayers.Protocol.HTTP({
                url: protocolUrl,
                format: protocolFormat
            projection: MapProj,
            formatOptions: {
                extractStyles: true,
                extractAttributes: true
            styleMap: new OpenLayers.StyleMap({
                "default": style,
                "select": style
            catID: 0

with this collection:
    "type": "FeatureCollection",
    "features": [{
        "type": "feature",
        "properties": {
            "id": "7943",
            "name": "Bobs Burger",
            "category": "57",
            "color": "9875c3",
            "timestamp": "1400149988"
        "geometry": {
            "type": "Point",
            "coordinates": [-76.437099, 39.041711]
    }, {
        "type": "feature",
        "properties": {
            "id": "7944",
            "name": "Hot Diggity",
            "category": "54",
            "color": "b33838",
            "timestamp": "1400150184"
        "geometry": {
            "type": "Point",
            "coordinates": [-76.436586, 39.041696]

View this message in context: http://osgeo-org.1560.x6.nabble.com/Plot-features-onto-multiple-layers-from-one-HTTP-request-tp5144030.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

More information about the Dev mailing list