Code setting up map: Additional Info:
Windows Server 2008 R2 Mapguide 2.6 Openlayers 3.10.1 vs 2.13 Safari on ios 9.1 Mapguide server and web application are accessed over vpn. Everything on the Mapguide side, map definition layers, projection, etc., is the same for both versions of openlayers Resources: <link rel="stylesheet" href="../assets/theme/default/ol.css" /> <link href="../assets/theme/default/bootstrap.min.css" rel ="stylesheet" /> <script type="text/javascript" src ="../assets/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="../assets/ol.js"></script> <script type="text/javascript" src ="../assets/proj4js-2.2.2/dist/proj4.js"></script> <script type="text/javascript" src="../assets/bootstrap.min.js"></ script> <script type="text/javascript"> var mapAgentUrl = "../../mapagent/mapagent.fcgi"; function createMap(reqFeatures) { $.getJSON(mapAgentUrl, { "OPERATION": "CREATERUNTIMEMAP", "VERSION": "2.6.0", "MAPDEFINITION": "Library://maps/Cid_Map_mobile.MapDefinition", "USERNAME": "Anonymous", //Or you can use "SESSION": "<my session id>" "REQUESTEDFEATURES": reqFeatures, //Optional parameters you can specify and/or experiment with //"ICONFORMAT": "GIF", //Uncomment to override desired image format (default: PNG) //"ICONWIDTH": 32, //Uncomment to override desired icon width (default: 16) //"ICONHEIGHT": 32, //Uncomment to override desired icon height (default: 16) //"ICONSPERSCALERANGE": 3, //Uncomment to observe theme compression for themes exceeding this number of rules (default: 25) //"TARGETMAPNAME": "MyRuntimeMapForOpenLayers", //Uncomment if you require a specific map name be given (default: inferred from Map Definition) "FORMAT": "application/json" }, function(data, textStatus, jqXHR) { loadMap(data); }).error(function(jqXHR, textStatus, errorThrown) { $("#error").html(jqXHR.responseText); }); } function loadMap(rtMapInfo) { var x1 = parseFloat(rtMapInfo.RuntimeMap.Extents[0].LowerLeftCoordinate[0].X[0]); var y1 = parseFloat(rtMapInfo.RuntimeMap.Extents[0].LowerLeftCoordinate[0].Y[0]); var x2 = parseFloat(rtMapInfo.RuntimeMap.Extents[0].UpperRightCoordinate[0].X[0]); var y2 = parseFloat(rtMapInfo.RuntimeMap.Extents[0].UpperRightCoordinate[0].Y[0]); bounds = [x1, y1, x2, y2]; cen = [(x1 + x2) / 2, (y1 + y2) / 2]; //Get mapguide map projection if (rtMapInfo.RuntimeMap.CoordinateSystem[0].EpsgCode[0].length > 0) { //mapOptions.projection = "EPSG:" + rtMapInfo.RuntimeMap.CoordinateSystem[0].EpsgCode[0]; mapProjection = "EPSG:" + rtMapInfo.RuntimeMap.CoordinateSystem[0].EpsgCode[0]; //alert("EPSG:" + rtMapInfo.RuntimeMap.CoordinateSystem[0].EpsgCode[0]); //alert(mapOptions.projection.toString()); } //Adjust the scale assumptions for MapGuide layers //Tiled layers MUST use a DPI value of 96, untiled layers can use a //different DPI value which will be passed to the server as a parameter. //Tiled and untiled layers must adjust the OL INCHES_PER_UNIT values //for any degree-based projections. //Get meters per unit value from Mapguide metersPerUnit = parseFloat(rtMapInfo.RuntimeMap.CoordinateSystem[0].MetersPerUnit[0]); //metersPerUnit = 111319.4908; //var inPerUnit = ol.INCHES_PER_UNIT.m * metersPerUnit; //ol.INCHES_PER_UNIT["dd"] = inPerUnit; //ol.INCHES_PER_UNIT["degrees"] = inPerUnit; //ol.DOTS_PER_INCH = 96; //Get Mapguide map name and sessionId mapName = rtMapInfo.RuntimeMap.Name[0]; sessionId = rtMapInfo.RuntimeMap.SessionId[0]; //**** layers **** //Bing layers bingRoad = new ol.layer.Tile({ title: "bingRoad", visible: true, source: new ol.source.BingMaps({ key: apiKeyBing, imagerySet: "Road", maxZoom: 19 }) }); bingAerialWithLabels = new ol.layer.Tile({ title: "bingAerialWithLabels", visible: false, source: new ol.source.BingMaps({ key: apiKeyBing, imagerySet: "AerialWithLabels", maxZoom: 19 }) }); //mapguide layer mgLayer = new ol.layer.Image({ extent: bounds, source: new ol.source.ImageMapGuide({ projection: mapProjection, url: mapAgentUrl, displayDpi: 192, //needed for ipad useOverlay: true, ratio: 2, metersPerUnit: metersPerUnit, //default is 1 params: { mapname: mapName, session: sessionId, behavior: 2, FORMAT: 'PNG' } }) }); //mapguide selection layer selLayer = new ol.layer.Image({ visible: true, extent: bounds, source: new ol.source.ImageMapGuide({ projection: mapProjection, url: mapAgentUrl, displayDpi: 192, //needed for ipad useOverlay: true, ratio: 2, metersPerUnit: metersPerUnit, params: { mapname: mapName, session: sessionId, //selectioncolor: '0xFF000000', selectioncolor: '0x000000', behavior: 5, FORMAT: 'PNG' } }) }); //**** view **** view1 = new ol.View({ center: cen, projection: mapProjection, zoom: 12 }) var controls = ol.control.defaults({ zoom: false, rotate: false }); var zoomToExtent = new ol.control.ZoomToExtent({extent: bounds}); var interactions = ol.interaction.defaults({ altShiftDragRotate: false, pinchRotate: false }); //**** map **** map = new ol.Map({ layers: [bingRoad, bingAerialWithLabels, mgLayer, selLayer], controls: controls, interactions: interactions, target: 'map', view: view1 }); map.addControl(zoomToExtent); Thanks, Gregory B. Neff District Engineer Cottonwood Improvement District 8620 Highland Drive Sandy, Utah 84093 (801) 943-7671 ------------------------------ *From:* mapguide-users [mailto:mapguide-users-boun...@lists.osgeo.org] *On Behalf Of *Scott Hameister *Sent:* Wednesday, November 04, 2015 5:26 PM *To:* MapGuide Users Mail List *Subject:* Re: [mapguide-users] Mapguide layer slow with ol3 Can you post your code On Nov 4, 2015 6:25 PM, "Scott Hameister" <sco...@mpowerinnovations.com> wrote: Haven't noticed a slow down either, just the opposite..but haven't combined it with BING, will try tomorrow On Nov 4, 2015 4:32 PM, "GordonL" <gordon.luck...@arrowgeomatics.com> wrote: When you check the OL3 demo for MapGuide it is really quick: http://openlayers.org/en/v3.0.0/examples/mapguide-untiled.html The OL 2 version seems almost as quick: http://dev.openlayers.org/examples/mapguide.html I copied out the code for each and watched the network. They were about on par, with OL 3 a little quicker... I wonder if it's the server... -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Mapguide-layer-slow-with-ol3-tp5233404p5234542.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users