| 1 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 2 |
<head> |
|---|
| 3 |
<style type="text/css"> |
|---|
| 4 |
p { |
|---|
| 5 |
width: 512px; |
|---|
| 6 |
} |
|---|
| 7 |
#map { |
|---|
| 8 |
width: 512px; |
|---|
| 9 |
height: 256px; |
|---|
| 10 |
border: 1px solid gray; |
|---|
| 11 |
} |
|---|
| 12 |
</style> |
|---|
| 13 |
<script src="../lib/OpenLayers.js"></script> |
|---|
| 14 |
<script type="text/javascript"> |
|---|
| 15 |
var map; |
|---|
| 16 |
function init(){ |
|---|
| 17 |
map = new OpenLayers.Map('map'); |
|---|
| 18 |
|
|---|
| 19 |
var options = {numZoomLevels: 3}; |
|---|
| 20 |
|
|---|
| 21 |
var graphic = new OpenLayers.Layer.Image( |
|---|
| 22 |
'City Lights', |
|---|
| 23 |
'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif', |
|---|
| 24 |
new OpenLayers.Bounds(-180, -88.759, 180, 88.759), |
|---|
| 25 |
new OpenLayers.Size(580, 288), |
|---|
| 26 |
options); |
|---|
| 27 |
|
|---|
| 28 |
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic", |
|---|
| 29 |
"http://wms.jpl.nasa.gov/wms.cgi", |
|---|
| 30 |
{layers: "modis,global_mosaic"}, options); |
|---|
| 31 |
|
|---|
| 32 |
map.addLayers([graphic, jpl_wms]); |
|---|
| 33 |
map.addControl(new OpenLayers.Control.LayerSwitcher()); |
|---|
| 34 |
map.zoomToMaxExtent(); |
|---|
| 35 |
} |
|---|
| 36 |
</script> |
|---|
| 37 |
</head> |
|---|
| 38 |
<body onload="init()"> |
|---|
| 39 |
<h1>OpenLayers Image Layer Example</h1> |
|---|
| 40 |
<div id="map"></div> |
|---|
| 41 |
<p> |
|---|
| 42 |
The "City Lights" layer above is created from a single web accessible |
|---|
| 43 |
image. If you construct it without any resolution related options, |
|---|
| 44 |
the layer will be given a single resolution based on the extent/size. |
|---|
| 45 |
Otherwise, it behaves much like a regular layer. This is primarily |
|---|
| 46 |
intended to be used in an overview map - where another layer type |
|---|
| 47 |
might not make a good overview. |
|---|
| 48 |
</p> |
|---|
| 49 |
</body> |
|---|
| 50 |
</html> |
|---|