Finally on Nov 19 2013, Google shut down Google Maps v2 API, which was depreciated in May 19 2010 but was working continuously Nov 19. I was aware of version depreciation, but I procrastinate to upgrade till last minute because of working on too many other things. While checking my Web map (built on Openlayers, Geoserver and Google Maps as base layers (Google Maps API v2) on Nov 20, I saw two map controls one from Openlayers and other from Google Maps API also noticed that map application was unresponsive.
Looking around I found easy steps to fix it without major change in the code-
Step1) Update the Google API script link
Replace v2:
<script src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=YOUR_KEY " type="text/javascript"></script>
With v3 as:
<script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script>
Step2) Update the Google Map base layer types for Openalayers
Default:
v2
var gmap = new OpenLayers.Layer.Google( "Google Streets", {'sphericalMercator':true,minZoomLevel:3, maxZoomLevel:8});
v3 (No change)
var gmap = new OpenLayers.Layer.Google("Google Streets", {'sphericalMercator':true,minZoomLevel:3, maxZoomLevel:8});
Physical:
v2
var gphy = new OpenLayers.Layer.Google( "Google Physical",
{type: G_PHYSICAL_MAP,'sphericalMercator':true,minZoomLevel:3, maxZoomLevel:8});
v3(Change type:G_PHYSICAL_MAP to type:google.maps.MapTypeId.TERRAIN )
var gphy = new OpenLayers.Layer.Google("Google Physical",
{type:google.maps.MapTypeId.TERRAIN,'sphericalMercator':true,minZoomLevel:3, maxZoomLevel:8});
Satellite:
v2
var gsat = new OpenLayers.Layer.Google("Google Satellite",
{type: G_SATELLITE_MAP,'sphericalMercator':true,minZoomLevel:3, maxZoomLevel:8});
v3(Change type: G_SATELLITE_MAP to type: google.maps.MapTypeId.SATELLITE )
var gsat = new OpenLayers.Layer.Google( "Google Satellite",
{type: google.maps.MapTypeId.SATELLITE,'sphericalMercator':true,minZoomLevel:3, maxZoomLevel:8});
Hybrid:
v2
var ghyb = new OpenLayers.Layer.Google("Google Hybrid",
{type: G_HYBRID_MAP, 'sphericalMercator':true,minZoomLevel:3, maxZoomLevel:8});
v3(Change type:G_HYBRID_MAP to type: google.maps.MapTypeId.HYBRID)
var ghyb = new OpenLayers.Layer.Google( "Google Hybrid",
{type: google.maps.MapTypeId.HYBRID, 'sphericalMercator':true,minZoomLevel:3, maxZoomLevel:8});
0 comments :
Post a Comment