Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7746765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:21:47+00:00 2026-06-01T10:21:47+00:00

I found a lot of examples how to add/remove Overlays to your Openlayers Map

  • 0

I found a lot of examples how to add/remove Overlays to your Openlayers Map using the LayerSwitcher. My purpose is to provide a LayerSwitcher which allows only one map service provider (e.g. GoogleMaps and Openstreetmaps) at a time. Is this possible with the LayerSwitcher class?

I tried the following which shows the switch I want to have, but only the first layer can be visualized!

var osmLayer = new OpenLayers.Layer.OSM("Open Street Maps",
                                        ["http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
                                         "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
                                         "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
                                        ],
                                        {visibility: true, isBaseLayer: true});
var wmsLayer = new OpenLayers.Layer.WMS("OpenLayers WMS",
                                        "http://vmap0.tiles.osgeo.org/wms/vmap0",
                                        {layers: 'basic'},
                                        {visibility: true, isBaseLayer: true});

this.map = new OpenLayers.Map({
                         div: divname,
                         allOverlays: false,
                         theme: null,
                         controls: [
                            new OpenLayers.Control.LayerSwitcher(),
                         ]
});
this.map.addLayers([osmLayer, wmsLayer]);
this.map.setCenter(
    new OpenLayers.LonLat(8.56, 50).transform(
          new OpenLayers.Projection("EPSG:4326"), 
          this.map.getProjectionObject()
    ), 10
);

If I choose the second entry nothing is shown on the map and selecting the first one does show the OSM map again.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:21:48+00:00Added an answer on June 1, 2026 at 10:21 am

    I think the problem is that you are trying to use Metacartas WMS i EPSG:900913 projection(the one that OpenStreetMaps and Google uses)

    Though it says in GetCapabilities that it should support 900913, it look like it doesn’t. If you try to use WMS layer alone(in EPSG4326) you’ll see that it works just fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK - I have looked and looked and found a lot of examples but
I have found a lot of information on using UIImagePickerController to let the user
A lot of Sencha Touch examples I found online, don't really focus on proper
Hi i have found a lot of examples about loading data from a db
I found a lot of helpful information on stackoverflow, but a tiny bit is
I found a lot of questions about how to initialize jQuery plugins with dynamic
I found a lot of links to validate string if it is a date.
i found a lot of questions about resizing images in .NET and whatnot, but
I found a lot of links on metaclasses, and most of them mention that
I found a lot of answers how to transform rows into columns in SQL.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.