Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

setZoomLevel not working when map loaded inside iframe #92

Description

@GoogleCodeExporter
Hi

The map is fitted inside iframe with jquery:

$("select#id").change(function() {
var id = $("select#id option:selected").attr('value');
$("#map")[0].src = 'maps.php?output=show&id=' + id;        
});


<iframe id="map" name="map" width="100%" height="100%"></iframe>

When I change drop down option, the map is loaded but it isn't centered and the 
zoom level is not as it should be (default is 16).

Linux server (GoogleMapApi v3), PHP 5.3, Apache

The iframe content is generated with:
$map = new GoogleMapAPI(); 
$map->_minify_js = isset($_REQUEST["min"])?FALSE:TRUE;
$map->setWidth('100%');
$map->setHeight('100%');                        

$lines = LineDB::getAllLines();
foreach ($lines as $line) {
    $map->addPolyLineByCoords($line['lngStart'], $line['latStart'], $line['lngStop'], $line['latStop'], false, '#FF0000', 2);
}

echo '<html>';
echo '<head>';
echo $map->getHeaderJS();
echo $map->getMapJS();           
echo '</head>';

echo '<body>';           
echo $map->printOnLoad();
echo $map->printMap();
echo $map->printSidebar();
echo '</body>';
echo '</html>';

Changing map type for example works but zoom level doesn't work. Also, center 
point can't be set too.

Original issue reported on code.google.com by mangi...@gmail.com on 27 Mar 2013 at 3:34

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions