[OpenLayers-Users] reading geojson results from a result object

Puneet Kishor punk.kish at gmail.com
Thu Mar 15 17:02:37 EDT 2012


This is perhaps a trivial question. I have implemented a vector layer with BBOX strategy as follows

    layer vec = new OpenLayers.Layer.Vector(
        "layer name", {
            strategies: [new OpenLayers.Strategy.BBOX()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: features.json,
                params: {},
                format: new OpenLayers.Format.GeoJSON()
            }),
            
            styleMap: new OpenLayers.StyleMap({
                "default": defaultStyle,
                "select": selectStyle
            })
        }
    );
            
and the above works quite well. The issue is that my query, "features.json" returns not just the geojson object but additional information. So, the result returned by the query looks like so

    result = {
        additional_info: {},
        geojson: {}
    }
    
How do I modify my layer definition to read result.geojson instead of just result? I have been poking around in the API docs and I can't figure out how to pass the result to the actual geojson reader.



--
Puneet Kishor


More information about the Users mailing list