Add google map in your application and change the color scheme to match your theme. This is the easiest way to implement google map. The extension is just a wrapper for google's latest javascript map API to make it more easier.
Requirements ¶
Yii 1.1 or above
PHP 5 above
Google Map API key. If you dont have API key, you can obtain it from here.
Usage ¶
Extract the folder into protected/extension/easymap.
Insert following widget in view for simple map integration:
$this->widget('ext.easymap.EasyMap', array(
'key' => '', /*Insert your developer API key for google map*/
'id' => 'newmap', /*This is the id of the map wrapper div*/
'latitude' => '22.572646000000000000', /*Place Latitude*/
'longitude' => '88.363894999999950000', /*Place Longitude*/
'maptype' => 'ROADMAP', /*ROADMAP, SATELITE, HYBRID, TERRAIN*/
'zoom' => '10', /*Zoom level. Default is 7*/
'width' => '400', /*Map height*/
'height' => '200', /*Map width*/
'markertitle' => '', /*Title of the place marker*/
));
Following is the example of styled map:
$this->widget('ext.easymap.EasyMap', array(
'key' => '',
'id' => 'newmap',
'latitude' => '22.572646000000000000',
'longitude' => '88.363894999999950000',
'maptype' => 'ROADMAP', /*ROADMAP, SATELITE, HYBRID, TERRAIN*/
'zoom' => '10',
'width' => '400',
'height' => '200',
'markertitle' => '',
'style' => array(
array(
'stylers'=> array(array(
'hue'=>'#00ffe6', /*an RGB hex string*/
'saturation'=>'20', /*a floating point value between -100 and 100*/
),),
),
array(
'featureType'=>'road', /*road, road.local, landscape, landscape.natural*/
'elementType'=>'geometry', /*all, geometry, geometry.fill, geometry.stroke, labels, labels.icon, labels.text, labels.text.fill, labels.text.stroke*/
'stylers'=> array(array(
'lightness'=>'100', /*a floating point value between -100 and 100*/
'visibility'=>'simplified', /*on, off, or simplified*/
),),
),
array(
'featureType'=>'road',
'elementType'=>'labels',
'stylers'=> array(array(
'visibility'=>'off',
),),
),
),
));
Here is the full list of option available for stylers array:
'stylers'=> array(array(
'hue'=>'', /*an RGB hex string*/
'saturation'=>'', /*a floating point value between -100 and 100*/
'lightness'=>'', /*a floating point value between -100 and 100*/
'visibility'=>'', /*on, off, or simplified*/
'gamma'=>'', /*a floating point value between 0.01 and 10.0, where 1.0 applies no correction*/
'inverse-lightness'=>'', /*(if true) simply inverts the existing lightness*/
'color'=>'', /*(an RGB hex string) sets the color of the feature*/
'weight'=>'', /*an integer value, greater than or equal to zero*/
),
),
For more style option visit this google map API site.
Please fix filename spelling
The distributed file is called easymap.php (all lower case) but the usage instruction says EasyMap.php (camelcase). As is, it will cause a "file not found" error. Otherwise it works great. Thanks!
file name issue resolved
hi JFReyes, thanks for your comment, i have fixed the filename issue.
Zoom Slider Problem
Any idea on why my zoom slider shows up all messed up on the map?
Zoom Slider issue
hey compugator, can you post your code so i can look into the issue, thanks.
Zoom Slider issue
I just dropped your first widget above into my page.
I need to check this link out when I get home.
It may be the root of my problem.
Small sugestion
Nice extension. Simple and get its job done. One small suggestion I have is moving units from line 22 to relevant variables in lines 10 and 11. That way, users can easily choose units they want to use.
lines 10 and 11
~~~
public $width = '300px';
public $height = '250px';
~~~
line 22
echo "<div id='".$this->id."' style='width:".$this->width."; height:".$this->height.";'></div>";
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.