在UK Ordnance Survey OpenSpace地图上添加地图叠加层

时间:2009-11-28 11:12:12

标签: map mapping openlayers

有没有人有关于如何将图像叠加添加到Ordnance Survey OpenSpace地图的代码示例?

The documentation并不完全全面:)

谢谢!

1 个答案:

答案 0 :(得分:1)

Openspace使用openlayers,这是非常强大且记录良好的

This may be the page you are looking for,还有一个示例here

以下代码来自示例

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