Well one thing I notice (may or may not be the reason), the option
isBaseLayer defaults to false according to the OpenLayers docs (
http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.isBaseLayer),
so that would mean that since you never explicitly state your google layer
to be your base layer by setting isBaseLayer to true, your map has no base
layer....perhaps the reason it works when there is only one layer is because
when there is only 1 layer, openlayers assumes that to be the base, but when
you have 2 layers, neither one set to base layer, it breaks.  Just a
thought, give it a try, I'm no pro though so it's really just an educated
guess.

-Adam

On Fri, Jul 16, 2010 at 2:27 PM, Jeff Heard <jefferson.r.he...@gmail.com>wrote:

> I have the following code, which shows my overlay layer (news) when I take
> out the google layer, but doesn't show it when I leave the google layer in.
>  Have I done something wrong that should be obvious to me?  I assume it's
> either only loading the base layer or is layering them in the wrong order...
>
> -- Jeff (code follows)
>
> var map;
> OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
>
> function init() {
>
>    map = new OpenLayers.Map('map');
>
>    var gphy = new OpenLayers.Layer.Google("Google Physical",{type:
> google.maps.MapTypeId.TERRAIN}),
>    var news = new OpenLayers.Layer.WMS("Renci News Stories", "
> http://descartes.renci.org:8080/geoserver/wms?SERVICE=WMS";,
>        {layers: "Renci_Internal:renci_communications",
>         transparent: false,
>         format: "image/png",
>         srs: "EPSG:900913" },
>        {isBaseLayer: false}
>    );
>
>
>    var hover = new OpenLayers.Control.WMSGetFeatureInfo({
>                url: '
> http://descartes.renci.org:8080/geoserver/gwc/service/wms?SERVICE=WMS',
>                title: 'Identify features by clicking',
>                layers: [news],
>                hover: true,
>                queryVisible: true
>    });
>
>    var showInfo = function(evt) {
>            if (evt.features && evt.features.length) {
>                for(var i in evt.features) {
>                    alert("Story");
>                }
>            } else {
>                $('responseText').innerHTML = evt.text;
>            }
>    }
>
>    hover.events.register("getfeatureinfo", this, showInfo);
>    map.addLayers([news,gphy]);
>    alert(news.getFullRequestString());
>    news.events.register("loadstarts",this,function() { alert("load started:
> "+ news.getFullRequestString()) });
>    news.events.register("loadends", this, function() { alert("load ended")
> });
>    map.setCenter(new OpenLayers.LonLat(-79.27, 35.36).transform(
>            new OpenLayers.Projection("EPSG:4326"),
>            map.getProjectionObject()
>    ), 5);
> }
>
> _______________________________________________
> Users mailing list
> Users@openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to