[mapguide-users] Re: Using mapguide tiled maps with openlayers

A H hizperion at hotmail.com
Mon Mar 8 23:06:27 EST 2010


sorry for replying in this old topic. i have a problem with mapguide tiled
map inconsistency with open layers, but i'm not sure if its related, nor i
find other similar topics.

it seems like it doesn't zoom to the correct location. like it zooms to
upper left a bit when using mouse scroll or the scale bar. it doesn't happen
when i use the same MapDefinition but without the Base Layers (non-tiled
map).

i'm using mapguide opensource 2.1 and openlayers 2.8

i'm using the following setting for openlayers:
------------------------------------------------------------------------------------------------------
        var metersPerUnit = 111319.4908;  //value returned from mapguide
        var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
        OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
        OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
        OpenLayers.DOTS_PER_INCH = 96;
        
        //tiled version
        function initTiled(){
        
			function mapEvent(event)
			{ custMapEvent(event); }
     
            var extent = new
OpenLayers.Bounds(92.000000,-7.000000,129.000000,14.000000);
            var tempScales =
[350,700,1400,2925,5850,11700,23400,46875,93750,187500,375000,750000,1500000,3000000,6000000,15000000];
            var mapOptions = {
                maxExtent: extent, 
                scales: tempScales, 
				eventListeners: {
                        "moveend": mapEvent,
                        "zoomend": mapEvent
                    },
				controls: [
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.PanZoomBar(),
                        new OpenLayers.Control.Permalink(),
                        new OpenLayers.Control.ScaleLine(),
                        new OpenLayers.Control.Permalink('permalink'),
                        new OpenLayers.Control.MousePosition()
                    ]
            };
            map = new OpenLayers.Map( 'mapT', mapOptions );
            
            var params = {
              mapdefinition: 'Library://World/Maps/map_tiled.MapDefinition',
              basemaplayergroupname: "Base Layer Group"
            }
            var options = {
              singleTile: false 
            }
            var layer = new OpenLayers.Layer.MapGuide( "MapGuide OS tiled
layer", url, params, options );
            map.addLayer(layer);
            
            if (!map.getCenter()) map.zoomToMaxExtent();
        }
------------------------------------------------------------------------------------------------------

i found a ticket in openlayers which i think is similar to this problem, but
seems like its already been fixed
http://trac.openlayers.org/ticket/1511
so i'm wondering if this is a problem with mgos2.1 and openlayers2.8



-- 
View this message in context: http://n2.nabble.com/Using-mapguide-tiled-maps-with-openlayers-tp1814912p4700209.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list