1 <html xmlns="http://www.w3.org/1999/xhtml">
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">
15 <script src="../lib/OpenLayers.js"></script>
16 <script type="text/javascript">
23 map = new OpenLayers.Map( 'map' );
24 var basemap = new OpenLayers.Layer.WMS( "Boston",
25 "http://boston.freemap.in/cgi-bin/mapserv?",
27 map: '/www/freemap.in/boston/map/gmaps.map',
28 layers: 'border,water,roads,rapid_transit,buildings',
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.
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.
46 map.addLayer(basemap);
48 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
49 map.addControl(new OpenLayers.Control.LayerSwitcher());
50 map.addControl(new OpenLayers.Control.ScaleLine());
55 <body onload="init()">
56 <h1 id="title">Layer Projections</h1>
61 Use different (not default) projections with your map
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>