Displaying a message on Google Maps - google-maps

I'm using Google maps in my academic project,from few weeks onwards a message in displaying on map whenever I do certain operations on map like zoom-in,zoom-out.What might be the reason?Is I need configure any thing in my code.
You can see that message in above image,message is titled by 'Map Data'.We are using open layers maps in our project and coding language is PHP.

I read here that one cause might be some element covering up the map data copyright, but I found some complaints of the same notice popping up without mentioning this.
The most promising option I found is a page saying the solution is to upgrade to 2.12 or if you cannot, then apply a patch after including the OpenLayers.js
<script src="http://maps.google.com/maps/api/js?v=3.5&sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script>
OpenLayers.Layer.Google.v3.repositionMapElements = function() {
// This is the first time any Google layer in this mapObject has been
// made visible. The mapObject needs to know the container size.
google.maps.event.trigger(this.mapObject, "resize");
var div = this.mapObject.getDiv().firstChild;
if (!div || div.childNodes.length < 3) {
this.repositionTimer = window.setTimeout(
OpenLayers.Function.bind(this.repositionMapElements, this),
250
);
return false;
}
var cache = OpenLayers.Layer.Google.cache[this.map.id];
var container = this.map.viewPortDiv;
// move the ToS and branding stuff up to the container div
// depends on value of zIndex, which is not robust
for (var i=div.children.length-1; i>=0; --i) {
if (div.children[i].style.zIndex == 1000001) {
var termsOfUse = div.children[i];
container.appendChild(termsOfUse);
termsOfUse.style.zIndex = "1100";
termsOfUse.style.bottom = "";
termsOfUse.className = "olLayerGoogleCopyright olLayerGoogleV3";
termsOfUse.style.display = "";
cache.termsOfUse = termsOfUse;
}
if (div.children[i].style.zIndex == 1000000) {
var poweredBy = div.children[i];
container.appendChild(poweredBy);
poweredBy.style.zIndex = "1100";
poweredBy.style.bottom = "";
poweredBy.className = "olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint";
poweredBy.style.display = "";
cache.poweredBy = poweredBy;
}
if (div.children[i].style.zIndex == 10000002) {
container.appendChild(div.children[i]);
}
}
this.setGMapVisibility(this.visibility);
};
</script>
<script src="google-v3.js"></script>

Related

How to use setVolume() on SoundCloud

I want to use setVolume(0.01) on SoundCloud because it's way to loud for me.
As a temporary solution, I made the whole Chrome browser quieter, but then Youtube and other websites are too quiet.
I found that SoundCloud's volume can be controlled via the "SC.Widget method", but I have no idea what that is.
Can somebody explain how I can use that to set SoundCloud's volume to 0.01?
I already tried to put that just in the Chrome console but this gives me the following: VM1394:1 Uncaught ReferenceError: setVolume is not defined(…)
To change the volume on the Soundcloud website with a script there's no real API you can use, and no official way to do so. This should work:
webpackJsonp([], {
0: function(a, b, require) {
var modules = require.c;
modules[54].exports.broadcast("volume:set", 0.1);
}
});
Because the Soundcloude code is minified and not made to be used by other scripts, it is possible that the above solution might break with an error like this:
Uncaught TypeError: modules[54].exports.broadcast is not a function(…)
A hacky solution is to iterate over all modules and execute the volume:set broadcast:
webpackJsonp([], {
0: function(a, b, require) {
var modules = require.c;
for(var x in modules){
if(modules[x].exports.broadcast){
modules[x].exports.broadcast("volume:set", 1.0);
}
}
}
});
To change volume on Soundcloud widgets:
The HTML5 widget API is explained here. What you need to do first is include Soundcloud's API script, you can use this code which I borrowed from here:
var scapi = document.createElement('script');
scapi.src = "https://w.soundcloud.com/player/api.js";
document.getElementsByTagName('head')[0].appendChild(scapi);
The next step is finding the Soundcloud widget and use the API script to get the functionality we need, i.e. setVolume():
var sciframe = document.querySelector("iframe");
var widget = SC.Widget(sciframe);
widget.setVolume(0.1); // goes from 0 to 1
This you can use as a userscript with Greasemonkey or Tampermonkey and run it automatically:
var scapi = document.createElement('script');
scapi.src = "https://w.soundcloud.com/player/api.js";
document.getElementsByTagName('head')[0].appendChild(scapi);
function waitAndRegister() {
window.setTimeout(function(){
if(typeof(SC) == 'undefined') {
waitAndRegister();
} else {
quiet();
}
}, 100);
};
waitAndRegister();
function quiet() {
var scWidgets = document.querySelectorAll('iframe[src^="https://w.soundcloud.com/player"]');
if(scWidgets.length > 0) {
for (var i = 0; i < scWidgets.length; ++i) {
var widget = SC.Widget(scWidgets[i]);
widget.bind(SC.Widget.Events.PLAY, function() {
widget.setVolume(0.1);
});
}
}
}
Chrome > ctrl+shift+i > Application Tab > Storage > Local Storage > V2::local::settings
and set volume you need (eg: volume":0.05,")
Works like a charm for me.

Get non-wrapping map bounds in Google Maps API V3

If you zoom a google map out the world will start to repeat horizontally. Using .getBounds() seems to return the longitude at the edges of the displayed map image. But I would like to get minimum and maximum longitudes for the current view of the real world.
For example in this image .getBounds() says that the longitude ranges between 116 and 37 degrees (giving a width of -79 degrees!). The range I'm looking for is -244 to +37.
(or even -180 to +37 as this is the extremes of the world that is viewable around the map centre.)
And another example. Here I'm looking for -180 to +180 ...
You can try it for yourself here...
http://jsfiddle.net/spiderplant0/EBNYT/
(Apologies if this has been answered before - I did find some old similar questions but none seemed to have satisfactory answers).
I ran into the same issues today, but I think I finally figured it out.
In the first scenario above, you can use map.getBounds().toSpan() to get the width in longitude.....as long as the map did not wrap around.
For the second scenario where the map wraps around, I extended the google.maps.OverlayView() to get the google.maps.MapCanvasProjection object. From there you can call the function getWorldWidth().
It will give you the world width in pixel, then you can compare it with your map container's width. If your container is bigger, your map has wrapped around.
Don't know if the function is meant for this but it works.
The answer proposed by user1292293 worked for me (Google map api V3)
Extension of google.maps.OverlayView()
function MyMapOverlay() {}
MyMapOverlay.prototype = new google.maps.OverlayView();
MyMapOverlay.prototype.onAdd = function() {};
MyMapOverlay.prototype.draw = function() {};
MyMapOverlay.prototype.onRemove = function() {};
Add overlay to the map
var map = new google.maps.Map(domContainer, {...});
var overlay = new MyMapOverlay();
overlay.setMap(map);
check if map wraps around:
var proj = overlay.getProjection();
var wwidth = 0;
if (proj) wwidth = proj.getWorldWidth();
var mapsWrapsAround=false;
if (__wwidth > 0 && __wwidth < domContainer.width()) mapsWrapsAround = true;
I used the answer from rebpp to prevent the map from wrapping by setting the getWorldWidth. Here's the MapWrappingPrevent I created.
To use this just call
var wrapPreventer = new MapWrappingPrevent(_map);
/* This class prevents wrapping of a map by adjusting the max-width */
function MapWrappingPrevent(map) {
var self = this;
this.setMap(map);
map.addListener('zoom_changed', function () {
self.onZoomChanged();
});
}
MapWrappingPrevent.prototype = new google.maps.OverlayView();
MapWrappingPrevent.prototype.onAdd = function () { this.onZoomChanged(); };
MapWrappingPrevent.prototype.draw = function () { };
MapWrappingPrevent.prototype.onRemove = function () { };
MapWrappingPrevent.prototype.onZoomChanged = function () {
var proj = this.getProjection();
if (proj) {
var wrappingWidth = proj.getWorldWidth();
$(this.getMap().getDiv()).css({'max-width': wrappingWidth + 'px'})
}
};

Mootools reuse same function on multiple instances with something like the each function

I'm using the mootools wall plugin, Its working well in my application, however if I add multiple (image) walls it only works for one wall ::: My understanding of scripting is not good enough to add a each function or similar :::
I need to "bind" the code below to say 2 divs like this :::
My First wall:
<div id="viewport">
<div id="wall">
Second wall:
<div id="viewport">
<div id="wall_02">
Any assistance would be appreciated.
var wallIMAGES = new Wall( "wall", {
"width": scArray[1],
"height": scArray[1],
callOnUpdate: function(items){
items.each(function(e, i){
var el = wall[counterFluid];
if (el) {
var a = new Element("img[width="+scArray[1]+"][height="+scArray[1]+"][src={thumb}]".substitute(el));
a.inject(e.node).set("opacity", 0).fade("in");
e.node.store("tubeObject", el);
}
counterFluid++;
// Reset counter
if( counterFluid >= scArray[10].length) counterFluid = 0;
})
}
});
wallIMAGES.initWall();
Maybe something like this:
var my_wall_ids = ['wall', 'wall_02'];
var myWalls = [];
var baseWallOptions = {
"width": scArray[1],
"height": scArray[1],
callOnUpdate: function(items){
items.each(function(e, i){
var el = wall[counterFluid];
if (el) {
var a = new Element("img[width="+scArray[1]+"][height="+scArray[1]+"][src={thumb}]".substitute(el));
a.inject(e.node).set("opacity", 0).fade("in");
e.node.store("tubeObject", el);
}
counterFluid++;
// Reset counter
if( counterFluid >= scArray[10].length) {counterFluid = 0;}
}); // end items.each
}
}
for (var i=0;i<my_wall_ids.length;i++){
var id = my_wall_ids[i];
var wallOptions = baseWallOptions;
// if your customization was something like changing
// the height , but only on the 'wall' element
if (id === 'wall') {
wallOptions.height = 400;
}
myWalls[i] = new Wall(id, wallOptions);
myWalls[i].initWall();
}
If you read Wall's documentation, you'll notice that, just like most other classes, the first argument it takes is an element id.
So, if your initialization code states
new Wall("wall", { …
…then it will be applied to the element that has the id "wall".
You could simply duplicate your code and use one with "wall", the other one with "wall_02". However, that would be bad practice. Indeed, if you later wanted to change some options, you'd have to do it in two distinct blocks, and they would probably get out of sync.
If your only difference lies in the target id, and the options are to be shared, simply store the options object (second parameter to the Wall class) in a variable and use it twice! That is:
var wallOptions = { width: … };
var wallImages = new Wall("wall", wallOptions),
wallImages2 = new Wall("wall_02", wallOptions);
wallImages.initWall();
wallImages2.initWall();
It could be even better to embed initalization in a function, but this solution is probably the easiest if you simply want to have two Wall instances without learning much more about JS.

javascript new function call with MooTools

I have found a MooTools version of Nivoo Slider that (in theory) will work with our MooTools dropdown menu. However, the menu is using MooTools 1.2.x, and Nivoo is using 1.3.2 or 1.4.0. Every time I try and use both the menu and the slider, the menu stops working.
Are the versions of the MooTools framework not backward compatible?
Also, are these plugins compatible or is one overriding the other?
I don't know enough about JS to correct my errors or rewrite the function call. Is there a good beginner's tutorial for this?
window.addEvent('domready', function () {
var menu = new UvumiDropdown('dropdown-demo');
// initialize Nivoo-Slider
new NivooSlider($('slider'), {
directionNavHide: true,
effect: 'wipeDown',
interval: 1000
});
});
In trying to convert without compatibility, here are instructions that I was not sure how to implement.
Instruction
:: Line of 1.2 code
$clear => use the native clearTimeout when using fn.delay, use clearInterval when using fn.periodical.
:: $clear(a.retrieve('closeDelay'))
myFn.create => Use the according functions like .pass, .bind, .delay, .periodical
:: this.createSubmenu(this.menu)
myFn.bind(this, [arg1, arg2, arg3]) => myFn.bind(this, arg1, arg2, arg3) OR myFn.pass([arg1, arg2, arg3], this)
:: this.domReady.bind(this)
$$ now only accepts a single selector, an array or arguments of elements
:: $$(b,b.getChildren('li')
These instructions are with compatibility. I'm trying both.
myElement.get('tween', options); // WRONG
myElement.set('tween', options).get('tween'); // YES, INDEED.
:: this.menu.get('tag')!='ul'
:: this.menu.getElement('ul')
OK I tested the UvumiDropdown latest build with mootools 1.4.x and it worked fine as long as I included a Mootools more build that includes Fx.Elements
Hope this helps
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"> </script>
// MooTools: the javascript framework.
// Load this file's selection again by visiting: http://mootools.net/more/c8813373963b6a3e9a4d4bcfe9290081
// Or build this file again with packager using: packager build More/Fx.Elements
/*
---
script: More.js
name: More
description: MooTools More
license: MIT-style license
authors:
- Guillermo Rauch
- Thomas Aylott
- Scott Kyle
- Arian Stolwijk
- Tim Wienk
- Christoph Pojer
- Aaron Newton
- Jacob Thornton
requires:
- Core/MooTools
provides: [MooTools.More]
...
*/
MooTools.More = {
'version': '1.4.0.1',
'build': 'a4244edf2aa97ac8a196fc96082dd35af1abab87'
};
/*
---
script: Fx.Elements.js
name: Fx.Elements
description: Effect to change any number of CSS properties of any number of Elements.
license: MIT-style license
authors:
- Valerio Proietti
requires:
- Core/Fx.CSS
- /MooTools.More
provides: [Fx.Elements]
...
*/
Fx.Elements = new Class({
Extends: Fx.CSS,
initialize: function(elements, options){
this.elements = this.subject = $$(elements);
this.parent(options);
},
compute: function(from, to, delta){
var now = {};
for (var i in from){
var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
}
return now;
},
set: function(now){
for (var i in now){
if (!this.elements[i]) continue;
var iNow = now[i];
for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
}
return this;
},
start: function(obj){
if (!this.check(obj)) return this;
var from = {}, to = {};
for (var i in obj){
if (!this.elements[i]) continue;
var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};
for (var p in iProps){
var parsed = this.prepare(this.elements[i], p, iProps[p]);
iFrom[p] = parsed.from;
iTo[p] = parsed.to;
}
}
return this.parent(from, to);
}
});
/*
UvumiTools Dropdown Menu v1.1.2 http://uvumi.com/tools/dropdown.html
Copyright (c) 2009 Uvumi LLC
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
var UvumiDropdown = new Class({
Implements:Options,
options:{
clickToOpen:false, //if set to true, must click to open submenues
openDelay:150, //if hover mode, duration the mouse must stay on target before submenu is opened. if exits before delay expires, timer is cleared
closeDelay:500, //delay before the submenu close when mouse exits. If mouse enter the submenu again before timer expires, it's cleared
duration:250, //duration in millisecond of opening/closing effect
link:'cancel',
transition:Fx.Transitions.linear, //effect's transitions. See http://docs.mootools.net/Fx/Fx.Transitions for more details
mode:'horizontal' //if set to horizontal, the top level menu will be displayed horizontally. If set to vertical, it will be displayed vertically. If it does not match any of those two words, 'horizontal' will be used.
},
initialize: function(menu,options){
this.menu = menu;
this.setOptions(options);
if(this.options.mode != 'horizontal' && this.options.mode != 'vertical'){
this.options.mode = 'horizontal';
}
//some versions of Safari and Chrome run domready before DOM is actually ready, causing wrong positioning. If you still have some display issues in those browser try to increase the delay value a bit. I tried to keep it as low as possible, but sometimes it can take a bit longer than expected
if(Browser.Engine.webkit){
window.addEvent('domready',this.domReady.delay(200,this));
}else{
window.addEvent('domready',this.domReady.bind(this));
}
},
domReady:function(){
this.menu = $(this.menu);
if(!$defined(this.menu)){
return false;
}
//if passed element is not a UL, tries to find one in the children elements
if(this.menu.get('tag')!='ul'){
this.menu = this.menu.getElement('ul');
if(!$defined(this.menu)){
return false;
}
}
//handles pages written form right to left.
if(this.menu.getStyle('direction') == 'rtl' || $(document.body).getStyle('direction') == 'rtl'){
this.rtl = true;
if(Browser.Engine.trident && $(document.body).getStyle('direction') == 'rtl'){
this.menu.getParent().setStyle('direction','ltr');
this.menu.setStyle('direction','rtl');
}
}
//start setup
this.menu.setStyles({
visibility:'hidden',
display:'block',
overflow:'hidden',
height:0,
marginLeft:(Browser.Engine.trident?1:-1)
});
//we call the createSubmenu function on the main UL, which is a recursive function
this.createSubmenu(this.menu);
//the LIs must be floated to be displayed horisotally
if(this.options.mode=='horizontal'){
this.menu.getChildren('li').setStyles({
'float':(this.rtl?'right':'left'),
display:'block',
top:0
});
//We create an extar LI which role will be to clear the floats of the others
var clear = new Element('li',{
html:" ",
styles:{
clear:(this.rtl?'right':'left'),
display:(Browser.Engine.trident?'inline':'block'), //took me forever to find that fix
position:'relative',
top:0,
height:0,
width:0,
fontSize:0,
lineHeight:0,
margin:0,
padding:0
}
}).inject(this.menu);
}else{
this.menu.getChildren('li').setStyles({
display:'block',
top:0
});
}
this.menu.setStyles({
height:'auto',
overflow:'visible',
visibility:'visible'
});
//hack for IE, again
this.menu.getElements('a').setStyle('display',(Browser.Engine.trident?'inline-block':'block'));
},
createSubmenu:function(ul){
//we collect all the LI of the ul
var LIs = ul.getChildren('li');
var offset = 0;
//loop through the LIs
LIs.each(function(li){
li.setStyles({
position:'relative',
display:'block',
top:-offset,
zIndex:1
});
offset += li.getSize().y;
var innerUl = li.getFirst('ul');
//if the current LI contains a UL
if($defined(innerUl)){
ul.getElements('ul').setStyle('display','none');
//if the current UL is the main one, that means we are still in the top row, and the submenu must drop down
if(ul == this.menu && this.options.mode == 'horizontal'){
li.addClass('submenu-down');
var x = 0;
var y = li.getSize().y;
this.options.link='cancel';
li.store('animation',new Fx.Elements($$(innerUl,innerUl.getChildren('li')).setStyle('opacity',0),this.options));
//if the current UL is not the main one, the sub menu must pop from the side
}else{
li.addClass('submenu-left');
var x = li.getSize().x-(this.rtl&&!Browser.Engine.trident?2:1)*li.getStyle('border-left-width').toInt();
var y = -li.getStyle('border-bottom-width').toInt();
this.options.link='chain';
li.store('animation',new Fx.Elements($$(innerUl,innerUl.getChildren('li')).setStyle('opacity',0),this.options));
offset=li.getSize().y+li.getPosition(this.menu).y;
}
innerUl.setStyles({
position:'absolute',
top:y,
opacity:0
});
ul.getElements('ul').setStyle('display','block');
if(this.rtl){
innerUl.setStyles({
right:x,
marginRight:-x
});
}else{
innerUl.setStyles({
left:x,
marginLeft:-x
});
}
//we call the createsubmenu function again, on the new UL
this.createSubmenu(innerUl);
//apply events to make the submenu appears when hovering the LI
if(this.options.clickToOpen){
li.addEvent('mouseenter',function(){
$clear(li.retrieve('closeDelay'));
}.bind(this)
);
li.getFirst('a').addEvent('click',function(e){
e.stop();
$clear(li.retrieve('closeDelay'));
this.showChildList(li);
}.bind(this));
}else{
li.addEvent('mouseenter',function(){
$clear(li.retrieve('closeDelay'));
li.store('openDelay',this.showChildList.delay(this.options.openDelay,this,li));
}.bind(this));
}
li.addEvent('mouseleave', function(){
$clear(li.retrieve('openDelay'));
li.store('closeDelay',this.hideChildList.delay(this.options.closeDelay,this,li));
}.bind(this));
}
},this);
},
//display submenu
showChildList:function(li){
var ul = li.getFirst('ul');
var LIs = $$(ul.getChildren('li'));
var animation = li.retrieve('animation');
//if the parent menu is not the main menu, the submenu must pop from the side
if(li.getParent('ul')!=this.menu || this.options.mode == 'vertical'){
animation.cancel();
var anim ={
0:{
opacity:1
},
1:{
opacity:1
}
};
if(this.rtl){
anim[0]['marginRight'] = 0;
}else{
anim[0]['marginLeft'] = 0;
}
animation.start(anim);
var animobject={};
//if the parent menu us the main menu, the submenu must drop down
}else{
var animobject = {0:{opacity:1}};
}
LIs.each(function(innerli,i){
animobject[i+1]={
top:0,
opacity:1
};
});
li.setStyle('z-index',99);
animation.start(animobject);
},
//hide the menu
hideChildList:function(li){
var animation = li.retrieve('animation');
var ul = li.getFirst('ul');
var LIs = $$(ul.getChildren('li'));
var offset = 0;
var animobject={};
LIs.each(function(innerli,i){
animobject[i+1]={
top:-offset,
opacity:0
};
offset += innerli.getSize().y;
});
li.setStyle('z-index',1);
//if the parent menu is not the main menu, the submenu must fold up, and go to the left
if(li.getParent('ul')!=this.menu || this.options.mode == 'vertical'){
animobject[1]=null;
animation.cancel();
animation.start(animobject);
var anim = {
0:{
opacity:0
},
1:{
opacity:0
}
};
if(this.rtl){
anim[0]['marginRight'] = -ul.getSize().x;
}else{
anim[0]['marginLeft'] = -ul.getSize().x;
}
animation.start(anim);
//if the parent menu is the main menu, the submenu must just fold up
}else{
animobject[0]={opacity:0};
animation.start(animobject);
}
}
});
MooTools follows SemVer (Semantic Versioning), meaning that a minor version number (x.Y.z) bump is not guaranteed to be backward-compatible (and is usually not).
However, new versions come with a compatibility layer. Just tick the box on the MooTools Core builder if you really can't upgrade your code. You should though avoid to do such a thing, it is bad for performance and potentially forward-compatibility.
As for a tutorial, the best way to learn how to upgrade code from one version to the other is to read the changelog of the 1.3 to learn about the differences with 1.2, and from the 1.3 to the 1.4 if you want to upgrade to the latest version. From this knowledge, rewrite all calls that make use of outdated APIs.
It looks like a daunting task at first, but it usually goes very quickly (actually, in this precise case, it is most often about rewriting Hash references and .each calls). It might be hard if you're learning JS, but it will definitely be a very rewarding experience in JS, and especially in MooTools, as you'll learn about what makes a code ”Mooish” :)

Google maps: Set different zoom levels for two different maps

I have two maps on a page, one is a map of the world, and the other is a closeup of the current place they picked on the map of the world. I would like to set different zoom min/max levels for each map but:
G_NORMAL_MAP.getMinimumResolution = function(){return 11};
Seems to set the same min/max for both maps, I can't set them to different levels.
I think the problem is probably elsewhere in your code - I'm not sure exactly how you're using that function.
Here is a method that will work. You can re-write it to have less duplication.
map1 = new GMap2(document.getElementById("map1"));
map1.addControl(new GLargeMapControl3D());
map1.addControl(new GMenuMapTypeControl());
var mt = map1.getMapTypes();
// Overwrite the getMinimumResolution() and getMaximumResolution() methods
for (var i=0; i<mt.length; i++) {
mt[i].getMinimumResolution = function() {return 7;}
mt[i].getMaximumResolution = function() {return 11;}
}
map1.setCenter(new GLatLng(40,-100), 8);
map2 = new GMap2(document.getElementById("map2"));
map2.addControl(new GLargeMapControl3D());
map2.addControl(new GMenuMapTypeControl());
var mt = map2.getMapTypes();
// Overwrite the getMinimumResolution() and getMaximumResolution() methods
for (var i=0; i<mt.length; i++) {
mt[i].getMinimumResolution = function() {return 2;}
mt[i].getMaximumResolution = function() {return 6;}
}
map2.setCenter(new GLatLng(40,-100), 4);
Do you need 2 different maps? You can use the Map2.showMapBlowup() function to show a subarea which will be a zoomed in section on the current map.
I'm sorry I don't know if you can actually do it with 2 different maps.
http://code.google.com/apis/maps/documentation/reference.html#GMap2.showMapBlowup
You could use a custom map type and copy the G_NORMAL_MAP members of using a library like Prototype.
var G_MY_MAP = Class.create(G_NORMAL_MAP, {
getMinimumResolution: function()
{
return 11;
}
});
Then on your second map:
secondMap.addMapType(G_MY_MAP);
secondMap.setMapType(G_MY_MAP);
No idea if this will work, just a brain storm.....