[mapguide-users] Slow Openstreetmap

RenoSun renolionheart at gmail.com
Wed Jun 20 15:02:02 PDT 2018


Hi Kajar,

I think that I was facing some similar issue before too.

I modified the following codes, but I am using AIMS 2017...not exactly MG
3.1.1.

You may also want to check out the following:

1.Hotfix for Bing Map V8 

https://knowledge.autodesk.com/support/infrastructure-map-server/troubleshooting/caas/downloads/content/autodesk-infrastructure-map-server-2017-bing-maps-hotfix.html 

http://osgeo-org.1560.x6.nabble.com/New-builds-of-Fusion-to-support-new-Bing-Maps-td5326055.html

2.

fusionSF.js
...
    var addElement = function (element) {
        if (!element) {
            return;
        }
        var src = element.textContent;

        // For IE Browser 
        if (!src) {
            src = element.text;
        }

        if (src !=
"http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2") {
            if (location.protocol == 'https:') {
                if (src ==
"http://maps.stamen.com/js/tile.stamen.js?v1.3.0") {
                    src =
"https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js";
                    document.writeln('<script src="' + src +
'"><\/script>');
                }
                else{
                document.writeln('<script src="' + src.replace('http',
'https') + '"><\/script>');
                }
            } 
            else 
            {
                document.writeln('<script src="' + src + '"><\/script>');
            }
        }
    }
...

3.
http://osgeo-org.1560.x6.nabble.com/MapGuide-AIMS-OSM-TransportMap-and-CycleMap-API-Key-Required-td5332053.html

...
switch (this.layerType) {
            case 'Google':
                switch (this.mapTag.layerOptions.type) {   //Google layer
types are actual objects
                    case 'G_PHYSICAL_MAP':              //defined by gmap,
not a string
                    case 'TERRAIN':
                        this.mapTag.layerOptions.type =
google.maps.MapTypeId.TERRAIN;
                        break;
                    case 'G_HYBRID_MAP':
                    case 'HYBRID':
                        this.mapTag.layerOptions.type =
google.maps.MapTypeId.HYBRID;
                        break;
                    case 'G_SATELLITE_MAP':
                    case 'SATELLITE':
                        this.mapTag.layerOptions.type =
google.maps.MapTypeId.SATELLITE;
                        break;
                    case 'G_NORMAL_MAP':
                    case 'ROADMAP':
                        this.mapTag.layerOptions.type =
google.maps.MapTypeId.ROADMAP;
                    default:
                        // For the re-loaded Google layers
                        if (this.mapTag.layerOptions.type ==
google.maps.MapTypeId.TERRAIN)
                            this.mapTag.layerOptions.type =
google.maps.MapTypeId.TERRAIN;
                        else if (this.mapTag.layerOptions.type ==
google.maps.MapTypeId.HYBRID)
                            this.mapTag.layerOptions.type =
google.maps.MapTypeId.HYBRID;
                        else if (this.mapTag.layerOptions.type ==
google.maps.MapTypeId.SATELLITE)
                            this.mapTag.layerOptions.type =
google.maps.MapTypeId.SATELLITE;
                        else
                            this.mapTag.layerOptions.type =
google.maps.MapTypeId.ROADMAP;
                        break;
                }
                break;
            case 'VirtualEarth':
                this.mapTag.layerOptions.animationEnabled = false;
                switch (this.mapTag.layerOptions.type) {   //VE layer types
are enumerated values
                    case 'Aerial':              //defined in VEMapStyle from
the VE api
                    case 'a':
                        this.mapTag.layerOptions.type = 'Aerial';
                        break;
                    case 'AerialWithLabels':
                        this.mapTag.layerOptions.type = 'AerialWithLabels';
                        break;
                    default:
                        this.mapTag.layerOptions.type = 'Road';
                        break;
                }
                this.oLayerOL = new OpenLayers.Layer.Bing({
                    key: Fusion.bingMapKey,
                    type: this.mapTag.layerOptions.type
                });
                break;
            case 'Yahoo':
                switch (this.mapTag.layerOptions.type) {   //Yahoo is
similar to google
                    case 'YAHOO_MAP_SAT':              //defined by YMap,
not a string
                    case 'YAHOO_SAT':
                        this.mapTag.layerOptions.type = YAHOO_MAP_SAT;
                        break;
                    case 'YAHOO_MAP_HYB':
                    case 'YAHOO_HYB':
                        this.mapTag.layerOptions.type = YAHOO_MAP_HYB;
                        break;
                    case 'YAHOO_MAP_REG':
                    case "YAHOO_REG":
                    default:
                        this.mapTag.layerOptions.type = YAHOO_MAP_REG;
                        break;
                }
                break;
            case 'OpenStreetMap':
            case 'OSM':
                if (this.mapTag.layerOptions.type) {
                    this.mapTag.layerOptions.type =
this.mapTag.layerOptions.type;
                }
                else {
                    this.mapTag.layerOptions.type = 'Mapnik';
                }
                break;
            case 'Stamen':
                this.oLayerOL = new
OpenLayers.Layer[this.layerType](this.mapTag.layerOptions.type);
                break;
            case 'XYZ':
                this.oLayerOL = new OpenLayers.Layer[this.layerType](
                    this.getMapName(),
                    this.sMapResourceId,
                    this.mapTag.layerOptions);
                break;
            default:
                this.oLayerOL = new OpenLayers.Layer[this.layerType](
                    this.getMapName(),
                    this.sMapResourceId,
                    this.mapTag.layerParams,
                    this.mapTag.layerOptions);

                break;
        }

        if (!this.oLayerOL) {
            if (this.layerType == 'OpenStreetMap' || this.layerType ==
'OSM') {
                //Test OSM sub-type before falling back to
OpenLayers.Layer.OSM
                //if (typeof
(OpenLayers.Layer.OSM[this.mapTag.layerOptions.type]) != 'undefined') {
                //this.oLayerOL = new
OpenLayers.Layer.OSM[this.mapTag.layerOptions.type](this.getMapName(), null,
this.mapTag.layerOptions);
                //console.log('test1: ' +
this.mapTag.extension.Options[0].type[0]);
                //} else {
                //console.log("mapTagExtensionOptionType " +
this.mapTag.extension.Options[0].type[0]);
                if (this.mapTag.extension.Options[0].type[0] == "Mapnik") {
                    this.oLayerOL = new
OpenLayers.Layer.OSM[this.mapTag.layerOptions.type](this.getMapName(), null,
this.mapTag.layerOptions);
                }
                else if (this.mapTag.extension.Options[0].type[0] ==
"CycleMap") {
                    //this.oLayerOL = new
OpenLayers.Layer.OSM(this.getMapName(), null, this.mapTag.layerOptions);
                    this.oLayerOL = new OpenLayers.Layer.OSM("t at h",
["https://a.tile.thunderforest.com/cycle/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY",
"https://b.tile.thunderforest.com/cycle/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY",
"https://c.tile.thunderforest.com/cycle/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY"]);
                }
                else if (this.mapTag.extension.Options[0].type[0] ==
"TransportMap") {
                    this.oLayerOL = new OpenLayers.Layer.OSM("t at h",
["https://a.tile.thunderforest.com/transport/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY",
"https://b.tile.thunderforest.com/transport/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY",
"https://c.tile.thunderforest.com/transport/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY"]);
                }
                else if (this.mapTag.extension.Options[0].type[0] ==
"Outdoors") {
                    this.oLayerOL = new OpenLayers.Layer.OSM("t at h",
["https://a.tile.thunderforest.com/outdoors/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY",
"https://b.tile.thunderforest.com/outdoors/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY",
"https://c.tile.thunderforest.com/outdoors/${z}/${x}/${y}.png?apikey=YOUR_THUNDERFOREST_KEY"]);
                }
            }
            else {
                this.oLayerOL = new
OpenLayers.Layer[this.layerType](this.getMapName(),
this.mapTag.layerOptions);
                //fractionalZoom not permitted with tiled base layers
regardless
                this.mapWidget.fractionalZoom = false;
                this.mapWidget.oMapOL.setOptions({ fractionalZoom: false });
            }
        }

        this.oLayerOL.events.register("loadstart", this, this.loadStart);
        this.oLayerOL.events.register("loadend", this, this.loadEnd);
        this.oLayerOL.events.register("loadcancel", this, this.loadEnd);
...

I hope any of these may help you.

Reno



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html


More information about the mapguide-users mailing list