OpenLayers OpenLayers

Changeset 7927

Show
Ignore:
Timestamp:
09/02/08 11:43:57 (3 months ago)
Author:
pagameba
Message:

Tiled MapGuide layers require different base assumptions for DPI and inches per unit in order to report the correct coordinates. The example is updated with a clear explanation of how to make these changes per-application. r=me (Closes #1511)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/examples/mapguide.html

    r7592 r7927  
    2222     
    2323        var map, layer; 
    24         var url = "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi"; 
     24        var url = "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous&"; 
    2525        //you can use this URL when MapGuide OS is installed locally 
    2626        //var url = "/mapguide/mapagent/mapagent.fcgi"; 
     27         
     28        //Adjust the scale assumptions for MapGuide layers 
     29        //Tiled layers MUST use a DPI value of 96, untiled layers can use a  
     30        //different DPI value which will be passed to the server as a parameter. 
     31        //Tiled and untiled layers must adjust the OL INCHES_PER_UNIT values 
     32        //for any degree-based projections. 
     33        var metersPerUnit = 111319.4908;  //value returned from mapguide 
     34        var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit; 
     35        OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit; 
     36        OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit; 
     37        OpenLayers.DOTS_PER_INCH = 96; 
    2738         
    2839        //tiled version 
    2940        function initTiled(){ 
    3041         
    31             OpenLayers.DOTS_PER_INCH = 96; 
    3242            var extent = new OpenLayers.Bounds(-3631568.75,-1293815.5,4491139.5833333321,4937122); 
    3343            var tempScales = [50000000,23207944.16806,10772173.45016,5000000,2320794.41681,1077217.34502,500000,232079.44168,107721.7345,50000]; 
     
    5666        function initUntiled() { 
    5767         
    58           OpenLayers.DOTS_PER_INCH = 96; 
    5968          var extent = new OpenLayers.Bounds(-87.865114442365922,43.665065564837931,-87.595394059497067,43.823852564430069); 
    6069          var mapOptions = { 
     
    98107              mapName: 'Sheboygan', 
    99108              session: '0b8cb80e-0000-1000-8003-0017a4e6ff5d_en_C0A802AD0AFC0AFB0AFA', 
     109 
     110 
     111 
     112              mapName: 'Sheboygan', 
     113              session: '0b8cb80e-0000-1000-8003-0017a4e6ff5d_en_C0A802AD0AFC0AFB0AFA', 
     114              version: '2.0.0', 
     115              selectioncolor: '0xFF0000', 
     116              behavior: 7 
    100117            }; 
    101118            layer = new OpenLayers.Layer.MapGuide( "MapGuide OS Overlay layer", url, params, options );