EGMap 2.0 Google Maps Extension

EGMap 2.0 has been uploaded. Please, be informed that this new version has not BC for the sake of better code. Its code has been very much reduced. Still lot of work to do but the base has been created.

Hope you enjoy it

[center][/center]

Bug reports, suggestions, examples in this forum post.

Thanks for your feedback: http://www.yiiframework.com/extension/egmap/

ChangeLog

[b]Please update the libraries to EGMap 2.0

[/b]

20-03-2011

  • Included support for Polygons [Committer Mat Kay]

11-02-2011

  • Included support for language and region maps

11-02-2011

  • Included support for addDOMEventListenerOnce and addEventListenerOnce (thanks Johnatan)

03-02-2011

  • Fixed small bug on the registerPlugins Functions (thanks Rangel Reale)

03-02-2011 version 1.0.0

  • Code completely re-written

  • KML Support

  • KML Libraries included

  • Most of the libraries now extend from EGMapBase

  • Magic getters and setters for methods preceded by set or get (Yii style) and for its options array

  • Better Clusterer Support

  • Inclusion of new plugins


Previous Versions not compatible with this one


24-01-2011 version 1.8

  • Added MapType Controls Styles and Positioning

  • Fixed minor bugs throughout all the library classes

  • Included EGMapPoint and EGMapSize classes to the library

  • Code cleaning, improved code algorithms

  • Included EGMapKeyDragZoom class to allow ‘shift-click-and-drag’ option

  • Included EGMapControlPosition Class, now we can easily set controls on different positions on the map - Included EGMapMarkerWithLabel class to allow markers with labels

  • Included EGMapMarkerClusterer class to support marker clusterer feature

  • Fixed common sharing info window option. Now users can choose whether to share a common info window variable or not

  • Improved options encode. Included modified version of CJavaScript::encode to properly render Google Maps options.

11-01-2011 version 1.7

  • Bug Fix EGMarkerImage class

  • Added Support for Global Info Window Reference. Now, only one info window is open at all times. (Thanks bitmatix)

10-01-2011 version 1.6

  • Removed EGMapIcon class (deprecated for Google Maps v3)

  • Modified - Added setIcon, getIcon, setShadow, getShadow functions to EGMapMarker class

  • Removed deprecated functions and references on EGMap class

06-01-2011 version 1.5

  • Removed global_variables dependency

  • Fixed minor javascript bug for global variables

  • Fixed minor naming rendering bugs (jsName)

  • Included possibility to change jsName

24-12-2010 version 1.4

  • Fixed marker reference when rendering multiple maps

  • Fixed directions reference when rendering multiple maps

  • Fixed global variables registration bug - Fixed minor rendered javascript bugs

  • Fixed rendering container bug THANKS MDOMBA (Yii support really rocks!)

  • Added appendTo function to add maps to a container ID in the page

  • If no appendTo JQuery ID is set, Maps will be appended to document

  • Removed initialization function name dependency. Now the function is related to Map Ids.

23-12-2010

-Fixed bug on getMarkersFittingZoom function

-Fixed bug on getMarkersCenterCoord function

Uploaded new version 1.1

Looks great

Thanks for sharing

Thanks Gustavo! Test it and let us know… I will like to keep upgrading and be more Yii-oriented future releases.

Works nice and easy, :)

Examples works like a charm, Thanks.

I came across the problem though

I inserted the given example code to the view ( I think that was to be done) and found that till the google maps do not respond the page shows nothing, then suddenly the whole page shows up and maps starts to load. I encounter this while testing the pages on the slow network. As a solution to this I put up the egmap example code in a different view and called it via AJAX,

with renderPartial(‘map’) in controller I have :

<div id="egmap_0" style="width:512px;height:512px;" /> as response, as per FireBUG.

With renderPartial(‘map’,NULL,FALSE,TRUE) in controller I have :

A blank Page(even the calling page content blanks out)with FireBUG showing

google is not defined

<!-- blueprint CSS framework -->

although browser keep showing transferring data from maps.googleapis.com

I am sure postrender is not required and was not supposed to be done.(but just tried it in case)

Thanks and Regards

Amit Singh

EDIT: Checked version 1.1, on Yii 1.1.4

That might be a problem with HTML iframe, not with the plugin’s architeture

Iframes blocks page onload untill its finished loaded

I am not using iframe, maybe some other problem, I will test it again tomorrow with Yii 1.1.5, although I don’t expect any improvement.

Thanks

Google maps does use iframe

Please, re-downloaded files, I had a couple of bugs within two functions.

As Gustavo said, Google works that way. nevertheless, try a different approach as I am trying to find out the best way to use a lazy programmers function that actually renders two or three or four maps (:()

write the HTML layer on the partial view file: <div id="my_custom_map" style="width:100%;height:300px"></div> (for example)

Then when you start the code, set the containers id: $myEGMap->setContainerId(‘my_custom_map’)

and render the script: $myEGMap->renderScriptMap();

See if it goes so slow as you said.

With renderPartial I came accross that it doesnt register the Javascript Scripts. Please check that. Thanks!

I just downloaded the latest update… and like the previous one it has one more thing that needs fixing…

With your example #3 If you click on the marker on the first map… the info "I was living here as a kid" opens in the second map instead on the first one…

If you click the marker on the second map… it does nothing…

End the example 1 and 2 does not work anymore… I have the webLogRute enabled… and the map appears at the very bottom of the page after the webLogRoute application log…

// we can now render to any containers in the document, we control where

// we want it to be rendered now without coding the HTML elements for the

// Google map

// If we do not specify the container, the map will be appended to the BODY

// tag of the document

I have successfully inserted 5 maps on the page by using the examples provided, with and without appendTo tags. If you do not specify containers will be appended to the BODY. (Check internal code my friend, you are more than qualified to tell me what you see there :) )

One way to control position too is by getting the container:

$div = $gMap->getContainer();

Registering the scripts

$gMap->registerMapScript();

Echo container, wherever you want it

echo $div;

If you wish to add another one, you need to create or recreate a new EGMap Class.

Cheers Mdomba

That’s why I wrote that I have enabled the webLogRoute… append to body does append to the end of the body…

IMO it’s not a good option… what if in your design you have a footer… than the map will be rendered after the footer…

You can change that optional behaviour by setting

$gMap->appendTo(’#containerId’);

Other than that, what would you suggest? Default rendering or both options? Thanks mdomba…

I understand the appendTo… just wanted to tell you that the call like example 1 and 2 is not usefull as it adds the map to the very end of the page…

I liked more the first idea… to render a div at the place where the extension gets called… isn’t it more intuitive?

Edit: and maybe instead of appendTo… you can add a variable for the container ID to the constructor of EGMap… so that you can have both options… just a thought to simplify this…

LOL!! I cannot believe it man, I have just done that!




	if(null === $this->_appendTo)

			echo $this->getContainer();




Great work man, this is a top extension. I’ll be using it all the time.

I will add more features soon.

Stay tunned as rendering maps and simple icons isnt all it does.

Thanks for your positive feedback!

Hello! I’m new to yii and installed your really great extension. Now I want to modify this extension - I want to add the ability to draw lines, rectangles, circles on a google map.

I was wondering which google maps api version is supported by this extension?

Latest one, dr simple. It uses gmaps V3.

If you are able to do so, and include some classes to the library, please let me know. I would love to include them into the extension!

I wanted to actually do it my self but I had to continue with my personal projects :(