]> dev.renevier.net Git - syp.git/blob - openlayers/examples/projected-map.html
add some margin around image
[syp.git] / openlayers / examples / projected-map.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2   <head>
3     <title>OpenLayers: Non-Geographic Projection</title>
4     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
5     <link rel="stylesheet" href="style.css" type="text/css" />
6     <style type="text/css">
7     #map {
8     width: 100%;
9     height: 100%;
10     border: 0px;
11     padding: 0px;
12     }
13     </style>
14
15     <script src="../lib/OpenLayers.js"></script>
16     <script type="text/javascript">
17         var lat = 900863; 
18         var lon = 235829;
19         var zoom = 6;
20         var map, layer;
21
22         function init(){
23             map = new OpenLayers.Map( 'map' );
24             var basemap = new OpenLayers.Layer.WMS( "Boston", 
25                 "http://boston.freemap.in/cgi-bin/mapserv?",
26                 {
27                  map: '/www/freemap.in/boston/map/gmaps.map', 
28                  layers: 'border,water,roads,rapid_transit,buildings', 
29                  format: 'png', 
30                  transparent: 'off'
31                 },
32                 // These are the important parts for creating a non-epsg:4326
33                 // map: Maxextent is the boundary of the map/tile loading area,
34                 // maxResolution is the units/pixel at the highest zoom, and 
35                 // projection is the projection to be used in WMS/WFS Requests.
36                 {
37                   maxExtent: new OpenLayers.Bounds(33861, 717605, 330846, 1019656), 
38                   maxResolution: 296985/1024, // Another alternative is 'auto', which 
39                                               // will automatically fit the map: you can 
40                                               // then check map.baseLayer.resolutions[0] for
41                                               // a reasonable value.
42                   projection:"EPSG:2805",     // Used in WMS/WFS requests.   
43                   units: "m"                  // Only neccesary for working with scales.
44                   } );
45                 
46             map.addLayer(basemap);
47             
48             map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
49             map.addControl(new OpenLayers.Control.LayerSwitcher());
50             map.addControl(new OpenLayers.Control.ScaleLine());
51         }
52     </script>
53   </head>
54
55 <body onload="init()">
56   <h1 id="title">Layer Projections</h1>
57
58   <div id="tags">
59   </div>
60   <p id="shortdesc">
61       Use different (not default) projections with your map 
62   </p>
63     <div id="map" class="smallmap"></div>
64     <p>When using alternative projections, you still use OpenLayers.LonLat objects, even though
65        the properties are actually X/Y values at that point.</p>
66 </body>
67 </html>