Re: [cesium-dev] Static Maps API Imagery Provider Functionality

71 views
Skip to first unread message
Message has been deleted

Scott Hunter

unread,
Jun 9, 2017, 9:15:48 PM6/9/17
to cesiu...@googlegroups.com
It appears that this use is prohibited by the Google Maps API Terms of Service.


Specifically, 10.5.b states:

"For example, the following are prohibited: ... (ii) stitching multiple static map images together to display a map that is larger than permitted in the Maps APIs Documentation; "





On Fri, Jun 9, 2017 at 7:26 PM, Reno Sun <reno.s...@gmail.com> wrote:
Hi all,

I would think it will be an great feature to have a new imagery provider called new Cesium.GoogleStaticImageryProvider under Cesium.js.

The user will have to provide their own API key for using Google Static Maps API Imagery.


                                'key=API KEY' +
                                'maptype=street&' +
                                'size=' + gridSize + 'x' + gridSize + '&' +
                                'zoom=' + zoom + '&' +
                                'center=' + center[1] + ',' + center[0];

I am able to use OpenLayers3 API to display Google Static Maps API Imagery as one of our base map on our OL3 application.

My codes looks like following, and I believe we can do the same with Cesium.js:

var gridSize = 640;

var gstreet = new ol.layer.Tile({
                    preload: Infinity,
                    source: new ol.source.TileImage({
                        attributions: [
                            new ol.Attribution({
                                html: '<a href="https://www.google.com/intl/en-GB_US/help/terms_maps.html">Google Map</a>'
                            }),
                            ol.source.OSM.ATTRIBUTION
                        ],
                        tileGrid: new ol.tilegrid.TileGrid({
                            extent: [
                                -13860793.173271,
                                6329131.950797,
                                -13845619.906785,
                                6337107.916410
                            ],
                            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 'http://maps.googleapis.com/maps/api/staticmap?' +
                                'key=API KEY&' +
                                'maptype=street&' +
                                'size=' + gridSize + 'x' + gridSize + '&' +
                                'zoom=' + zoom + '&' +
                                'center=' + center[1] + ',' + center[0]
                                ;
                        },
                        maxZoom: 21
                    }),
                    visible: false,
                    name: 'Google Street'
                });

If you would like to see the live example, please visit Town of Qualicum Beach Public Mapping & GIS.

--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages