[OpenLayers-Users] Having a non-visible Google Layer leads to 404's at map load
Jelmer Baas
baas at speerit.nl
Thu Aug 9 01:32:21 PDT 2012
Milo,
Thanks, but this doesn’t change the layer behaviour. It still loads the tiles with the wrong token, realises it does something dumb, and loads the same tiles with the proper token.
The layer itself knows its invisible.
Jelmer
From: Milo van der Linden [mailto:milo at dogodigi.net]
Sent: Thursday, August 09, 2012 9:59 AM
To: Jelmer Baas
Cc: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] Having a non-visible Google Layer leads to 404's at map load
You need an extra optionset in your layer definition that holds visibility:
OpenLayers.Layer.Google("name",{youroptions},{visibility:false})
Verzonden vanaf mijn Samsung Galaxy S II
On Aug 9, 2012 9:21 AM, "Jelmer Baas" <baas at speerit.nl<mailto:baas at speerit.nl>> wrote:
Hello,
I'm using OL 2.12 to add an optional Google Satellite baselayer:
map = new OpenLayers.Map({
div: 'map',
projection: "EPSG:900913",
controls: [...]
, layers: [
new OpenLayers.Layer.OSM("OpenStreetMap",
["http://x/osm_tiles2/${z}/${x}/${y}.png<http://x/osm_tiles2/$%7bz%7d/$%7bx%7d/$%7by%7d.png>"],
{ transitionEffect: "resize", numZoomLevels: 24, opacity: 1 })
, new OpenLayers.Layer.Google("Google Satellite", {visibility: false, type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22, transitionEffect: "resize"})
]});
I had expected this to be enough to make the Google layer invisible, yet, at page load I get about 50 404 errors:
"NetworkError: 404 Not Found - http://khm1.googleapis.com/kh?v=115&hl=en-US&x=1023&y=1024&z=11&token=68404"
Later, the url is changed to:
http://khm1.googleapis.com/kh?v=115&hl=en-US&x=1057&y=671&z=11&token=113046 (i.e., the token changes)
and the map loads succelfully. Yet, at this point my Google layer is still supposed to be invisible. I only want it to load when I turn it on by setting map.setBaseLayer().
Oh, the Google API is loaded by:
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
Any idea what I'm doing wrong?
Thanks in advance,
Jelmer Baas
_______________________________________________
Users mailing list
Users at lists.osgeo.org<mailto:Users at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120809/84db21c9/attachment-0001.html>
More information about the Users
mailing list