1

I was playing with Google maps for last two days and started understanding little bit about its functionality.

I was using Large Map i.e. 700 X 300 resolution map size and i was trying to implement controls used in small maps.

eg.

var map = new GMap2(document.getElementById("map_canvas"));
 map.setCenter(new GLatLng(37.4419, -122.1419), 18);
 map.setMapType(G_HYBRID_MAP);
 **map.setUIToDefault();**
 map.enableContinuousZoom();

 var customUI = map.getDefaultUI();     
 customUI.controls.smallzoomcontrol3d=true;   //1. trying to override largezoomcontrol3d 
 customUI.controls.menumaptypecontrol=true;   //2. trying to override largezoomcontrol3d 
 map.setUI(customUI);

 map.enableRotation(); //3. Enabling rotation

Here in 1(a). Small zoom control is not getting visible until i remove the line map.setUIToDefault() and add one more line customUI.controls.largezoomcontrol3d=false. Although I was expecting that by writing above code those control will get overridden.

1(b). I tried to use map.removeControl(Control:GControl) where i was not able to pass the correct parameter. I wanted to remove largezoomcontrol3d from map but i was not able to make out how to refer to this control in the current map.

  1. Same overriding problem is occuring here also. The only difference here is that both the controls are visible here menumaptypecontrol and maptypecontrol, here menumaptypecontrol is overlapping on maptypecontrol

  2. I am trying to enable rotation on map but it is not working for me.

1

1 Answer 1

1

thinking about map.removeControl you were quite closely to solution (if I got what you need). take a look here:

Controls

so, you need just use map.addControl function to add exactly what you need instead of what you did.

sorry, forgot about map rotation. I think the following simple example of Google Map can help you (I just never played with rotation, but example looks very simple to learnt from it):
Google Map rotation example

1
  • FYI, Google maps is now at version 3. This solution is for Google maps 2. Commented Jun 17, 2013 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.