开发者

sfEasyGMapPlugin won't show the Google Map

开发者 https://www.devze.com 2022-12-11 21:48 出处:网络
I\'ve just started to use the sfEasyGMapPlugin, in my Symfony website. So I\'ve f开发者_如何学运维ollowed the samples and created a basic map, to check if it works.

I've just started to use the sfEasyGMapPlugin, in my Symfony website. So I've f开发者_如何学运维ollowed the samples and created a basic map, to check if it works.

In the action :

$this->gMap = new GMap();
$this->gMap->setCenter(50.637551,3.062725);

And in the template :

<?php use_helper('Javascript','GMap') ?>

<?php include_map($gMap,array('width'=>'700px','height'=>'400px')); ?>

<!-- Javascript included at the bottom of the page -->
<?php include_map_javascript($gMap); ?>

I've signed up some api keys for my domains like http://localhost or http://127.0.0.1 and defined them in my app.yml.

Now, when I go to the page, the canvas shows up with it's control buttons, but the map do not shows up (there is only a grey background).

There is no error, everything seems to be configured fine. I can center the map on a point, like in the action above, but it do nothing.

I've tried to use the html code given by Google with my api keys and it works fine. So I really don't understand.

Am I doing it wrong ?

Regards, Timothée Martin.


I got my answer...

You must define the center AND the zoom level with :

$this->gMap->setCenter(latitude, longitude);
$this->gMap->setZoom(level);

After that, the map shows up normally.

Hope it helps...

0

精彩评论

暂无评论...
验证码 换一张
取 消