[mapguide-users] Mapguide layer slow with ol3
Greg Neff
gbneff at cid.utah.gov
Fri Nov 6 08:50:01 PST 2015
The vpn is used in both versions. I am thinking it must be the dpi which I
am only using with ol3. I used it because Mapguide layers weren’t
displaying correctly on ipads without it. Using the default, 96, with ol2
and everything is fine on ipads.
I will test ol3 with dpi of 96 and see what happens.
Thanks,
Gregory B. Neff
District Engineer
Cottonwood Improvement District
8620 Highland Drive
Sandy, Utah 84093
(801) 943-7671
------------------------------
*From:* mapguide-users [mailto:mapguide-users-bounces at lists.osgeo.org] *On
Behalf Of *Scott Hameister
*Sent:* Friday, November 06, 2015 9:43 AM
*To:* MapGuide Users Mail List
*Subject:* Re: [mapguide-users] Mapguide layer slow with ol3
I assume the VPN is involved in both versions of open layers?
If not that would be my first guess.
I noticed a High DPI of 192 instead of the default...were you doing this on
both versions? That will create a longer run at image creation.
Otherwise nothing looks amiss
On Fri, Nov 6, 2015 at 10:36 AM, Greg Neff <gbneff at cid.utah.gov> wrote:
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-bounces at 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" <scotth at 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.luckett at 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 at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
--
*Scott Hameister | www.mpowerinnovations.com
<http://www.mpowerinnovations.com/>
________________________________________ **mPower Innovations*
1051 N Lynndale Drive, Suite 2A, Appleton, WI 54914
Main: (877) 269-6971 x 204 <%28877%29%20269-6971%20x%20207> | Mobile: (920)
419-6250 <%28920%29%20470-0292>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20151106/99bde4e1/attachment.html>
More information about the mapguide-users
mailing list