Skip to content

OpenStreetMapImageLayer requires an undocumented WMS layer name; new OpenStreetMapImageLayer() throws #907

Description

@qwertymuzaffar

Version

@nasaworldwind/worldwind 0.11.1 (npm), also present on develop.

Problem

OpenStreetMapImageLayer's JSDoc says the constructor argument is the display name and optional:

@param {String} displayName This layer's display name. "Open Street Map" if this parameter is null or undefined.

but the constructor uses it as the WMS layer name and never defaults it:

var OpenStreetMapImageLayer = function (layerName) {
    TiledImageLayer.call(this,
        Sector.FULL_SPHERE, new Location(36, 36), 16, "image/jpeg", "OpenStreetMap-" + layerName, 256, 256);
    this.displayName = "OpenStreetMap";
    this.pickEnabled = false;
    this.urlBuilder = new WmsUrlBuilder("https://worldwind47.arc.nasa.gov/mapcache",
        layerName, "", "1.3.0");
};

So new WorldWind.OpenStreetMapImageLayer() throws:

WmsUrlBuilder.constructor: The WMS layer names are not specified.

and passing a display name such as "Streets" silently requests a non-existent WMS layer. Only new WorldWind.OpenStreetMapImageLayer("osm") works, and nothing documents that.

Suggested fix

Default the layer name and fix the doc, e.g.

var OpenStreetMapImageLayer = function (layerName) {
    layerName = layerName || "osm";
    ...
};

with @param {String} layerName The WMS layer name on the mapcache server. Defaults to "osm". Happy to open a PR if that is welcome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions