[mapguide-users] Moving to MGOS from AIMS

RenoSun renolionheart at gmail.com
Thu Jan 25 11:37:03 PST 2018


OL3/4

var ghybrid = new ol.layer.Tile({
                    preload: Infinity,
                    source: new ol.source.TileImage({
                        attributions: [
                            new ol.Attribution({
                                html: ' Google Map
<https://www.google.com/intl/en-GB_US/help/terms_maps.html>  '
                            }),
                            ol.source.OSM.ATTRIBUTION
                        ],
                        tileGrid: new ol.tilegrid.TileGrid({
                            //Enter your own extent (tile max extent)
                            extent: [
                                -13867062.1744, 6313000.89531,
                                -13843390.389, 6355831.09224
                            ],
                            //Resolutions for 21 zoom levels
                            resolutions: [156543.03390625, 78271.516953125,
39135.7584765625,
                                19567.87923828125, 9783.939619140625,
4891.9698095703125,
                                2445.9849047851562, 1222.9924523925781,
611.4962261962891,
                                305.74811309814453, 152.87405654907226,
76.43702827453613,
                                38.218514137268066, 19.109257068634033,
9.554628534317017,
                                4.777314267158508, 2.388657133579254,
1.194328566789627,
                                0.5971642833948135, 0.2986, 0.1493],
                            tileSize: [gridSize, gridSize]
                        }),
                        tileUrlFunction: function (tileCoord, pixelRatio,
projection) {
                            var zoom = tileCoord[0];
                            var tileGrid = this.getTileGrid();
                            var center =
ol.proj.transform(ol.extent.getCenter(tileGrid.getTileCoordExtent(tileCoord)),
"EPSG:3857", "EPSG:4326");
                            //console.log(center[0]);
                            //console.log(center[1]);
                            return
'https://maps.googleapis.com/maps/api/staticmap?' +
                                'key=YOURGOOGLEMAPAPIKEY&' +
                                'maptype=satellite&' +
                                'size=' + gridSize + 'x' + gridSize + '&' +
                                'zoom=' + zoom + '&' +
                                'center=' + center[1] + ',' + center[0]
                                ;
                        },
                        maxZoom: 21
                    }),
                    visible: true,
                    name: 'Google Satellite'
                });



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


More information about the mapguide-users mailing list