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

khanh703 khanh at whitecanvasgroup.com
Wed Jun 4 08:54:42 PDT 2014


I can make a single Ajax requesting the two layers "Burgers" and "Hot Dogs"
into a single JSON return like below. 
{
    "type": "FeatureCollection",
    "collections": [
        {
            "name": "Burgers",
            "features": [
                {
                    "type": "feature",
                    "properties": {
                        "id": "7943",
                        "name": "Bobs Burger",
                        .....
                },
               {
                    "type": "feature",
                    "properties": {
                        "id": "7947",
                        "name": "Jons Burger",
                        .....
                }
            ]
        },
        {
            "name": "Hot Dogs",
            "features": [
                {
                    "type": "feature",
                    "properties": {
                        "id": "7913",
                        "name": "Doggies",
                        ...
                }
            ]
        }
    ]
}

My addMarkers function uses Protocol.HTTP to get the data like so:
protocol: new OpenLayers.Protocol.HTTP({
                url: protocolUrl
                format: protocolFormat
            })

Instead  "url: protocolUrl", is there an equivalent of "data: myData[i]

Does OpenLayers have the ability to read features from a local array? What I
mean is, after I make the Ajax request, I store that collections array
locally and do a while loop?



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


More information about the Dev mailing list