jsaTypeError:GoogleTiledMap不是构造函数

时间:2016-06-14 06:05:27

标签: dojo

我定义了一个类然后用它来创建一个图层。但是它有错误。但是我不知道哪里出错了?

define(["dojo/_base/declare","esri/SpatialReference","esri/layers/TiledMapServiceLayer","esri/geometry/webMercatorUtils","esri/geometry/Extent",
"esri/layers/TileInfo"],function(declare,SpatialReference,TiledMapServiceLayer,webMercatorUtils,Extent,TileInfo){   
 declare("extras.layer.GoogleTiledMap", [TiledMapServiceLayer], {
    online: false,
    mapStyle: "roadmap",
    constructor: function(a) {
        this.spatialReference = new esri.SpatialReference({
            wkid: 102113
        });
        this.online = a.online || false;
        this.mapStyle = a.mapStyle || "roadmap";
        this.layerId = a.layerId;
        this.suffix = a.suffix || ".png";
        this.tile_url = a.tile_url;
        this.fullExtent = new Extent( - 20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, this.spatialReference);
        this.initialExtent = new Extent(12557877.595482401, 2596928.9267310356, 12723134.450635016, 2688653.360673282);
        this.tileInfo = new TileInfo({
            "rows": 256,
            "cols": 256,
            "compressionQuality": 0,
            "origin": {
                "x": -20037508.342787,
                "y": 20037508.342787
            },
            "spatialReference": {
                "wkid": 102113
            },
            "lods": [{
                "level": 3,
                "scale": 73957190.948944,
                "resolution": 19567.8792409999
            },
            { ...

我在html文件中使用它。

require([  
  "esri/map",
  "extras/layer/GoogleTiledMap",
  "dojo/domReady!"
], function(map,GoogleTiledMap) {
     var layer=new GoogleTiledMap({
            "id": "100",
            "layerId":"GXX_XXXXX",
            "online":false,
            "name": "谷歌电子地图",
            "suffix": "png",
            "tileSize": "256",
            "tileType": "googlemap",
            "mapStyle":"roadmap",
            "tile_url": "127.0.0.1:8080"
     });

1 个答案:

答案 0 :(得分:0)

只是声明是不够的,你也需要返回它。如下所示

$tag = 'Tag Here';
$instagram = new Instagram($instagram);
    $media = $instagram->getTagMedia($tag);
    echo '<pre>';
    print_r($media);