Search code examples
javascriptgoogle-mapsgoogle-maps-api-2

Google maps v2 control position


I'm using Google maps api v2 with default UI, because the controls look much better when set to default

<script type="text/javascript">
var map = null;
    function load() {
        map = new GMap2(document.getElementById('map'),
        {mapTypes:[G_PHYSICAL_MAP]});
        map.setCenter(new GLatLng(32.0000, 19.3000), 2);
        map.setUIToDefault();
    }
</script>

I want to place all controls (zoom and map type) on the right side. I know how to do it in V3 but here I'm lost.


Solution

  • Check out the positioning API

    var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT);
    map.addControl(mapTypeControl, topRight);