打开第 3 层 - 命名空间 "ol" 已在启动时声明错误

open layers 3 - Namespace "ol" already declared error on startup

我正在使用 here 中关于如何开始使用开放层的说明,但我收到错误:Namespace "ol" already declared - source ol-debug.js 和错误
this.Va is not a function - source ol.js

我很确定我已将 ol.js、ol-debug.js 和 ol.css 文件正确地包含在我的 index.html.

Link 打开图层 js 和 css 文件。

这是 ol-debug.js 文件中的相关部分 -

/**
 * Defines a namespace in Closure.
 *
 * A namespace may only be defined once in a codebase. It may be defined using
 * goog.provide() or goog.module().
 *
 * The presence of one or more goog.provide() calls in a file indicates
 * that the file defines the given objects/namespaces.
 * Provided symbols must not be null or undefined.
 *
 * In addition, goog.provide() creates the object stubs for a namespace
 * (for example, goog.provide("goog.foo.bar") will create the object
 * goog.foo.bar if it does not already exist).
 *
 * Build tools also scan for provide/require/module statements
 * to discern dependencies, build dependency files (see deps.js), etc.
 *
 * @see goog.require
 * @see goog.module
 * @param {string} name Namespace provided by this file in the form
 *     "goog.package.part".
 */
goog.provide = function(name) {
  if (goog.isInModuleLoader_()) {
    throw Error('goog.provide can not be used within a goog.module.');
  }
  if (!COMPILED) {
    // Ensure that the same namespace isn't provided twice.
    // A goog.module/goog.provide maps a goog.require to a specific file
    if (goog.isProvided_(name)) {
      throw Error('Namespace "' + name + '" already declared.');
    }
  }

  goog.constructNamespace_(name);
}; 

您需要声明 ol.jsol-debug.js,而不是同时声明两者。错误来自于您同时声明了它们并且它正在创建名称空间冲突。