dasudasu / php-google-map-api

Automatically exported from code.google.com/p/php-google-map-api
0 stars 0 forks source link

setZoomLevel not working when map loaded inside iframe #92

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
Sorry, I had a problem with one line which had all zeros as start/stop lon/lat 

I forget to try var_dump before I posted this issue. 

Original comment by mangi...@gmail.com on 28 Mar 2013 at 8:12