views:

159

answers:

1

Does anyone have a code example of how to add an image overlay to an Ordnance Survey OpenSpace map?

The documentation is not exactly comprehensive :)

Thanks!

+1  A: 

Openspace uses openlayers, which is very powerful and well documented

This may be the page you are looking for, there is also a sample here.

The following code is cribbed from the sample

    <script type="text/javascript">
    var map;
    function init(){
        map = new OpenLayers.Map('map');

        var options = {numZoomLevels: 3};

        var graphic = new OpenLayers.Layer.Image(
            'City Lights',
            'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
            new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
            new OpenLayers.Size(580, 288),
            options
        );

        graphic.events.on({
            loadstart: function() {
                OpenLayers.Console.log("loadstart");
            },
            loadend: function() {
                OpenLayers.Console.log("loadend");
            }
        });

        var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
            "http://t1.hypercube.telascience.org/cgi-bin/landsat7", 
            {layers: "landsat7"}, options);

        map.addLayers([graphic, jpl_wms]);
        map.addControl(new OpenLayers.Control.LayerSwitcher());
        map.zoomToMaxExtent();
    }
</script>
Jeremy French

related questions