Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am customizing the opentripplanner webapp according to my needs. it has 5 different base layers. but in code (in map.js and OpenLayersUtils) i can't find where it adds these layers to map.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Try the source directly from the git repo here of opentripplanner. I think it's somewhere in this file where they setup the map.

There you see:

 initialize : function(config)
{
    otp.configure(this, config);

    this.map = otp.util.OpenLayersUtils.makeMap(this.mapDiv, this.options);
    if (this.baseLayer == null)
    {
        this.baseLayer = otp.util.OpenLayersUtils.makeMapBaseLayer(this.map, this.baseLayerOptions);
        this.cartoLayer = this.baseLayer;
        this.orthoLayer = this.baseLayer;
    }
    else
    {
        this.map.addLayers(this.baseLayer);
        this.cartoLayer = this.map.layers[0];
        this.orthoLayer = this.map.layers[1];

        if(this.baseLayer.length > 1 && this.plannerOptions && this.plannerOptions.showLayerSwitcher !== false) {
            this.showLayerSwitcher=true;
        } else {
            this.showLayerSwitcher=false;
        }
    }
    this.map.setBaseLayer(this.baseLayer, true);

In there is a line:

otp.configure(this, config);

That looks like a variable thing, a bit below that you see that this otp config object if exists is being used to set up layers

this.map.addLayers(this.baseLayer);

Looking at the rest of the code, it looks like you have 3 basic layers: WMS + the carto + ortho layer. The other 2 come from something dynamically configured it seems. That would be my first guess. The WMS layer is defined in makeMap, in this file

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.