开发者

adding a map overlay on a UK Ordnance Survey OpenSpace map

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!


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜