Yii Framework Forum: [EXTENSION] EGMapKMLFeed - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] EGMapKMLFeed KML Feed Generator Library Rate Topic: -----

#1 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 03 February 2011 - 04:41 AM

I have created a library that generates KML documents. For further reference on KML please visit http://code.google.c...reference.html.

This extension was developed to work in conjunction with the new release of EGMap (Google Maps Extension) version 2.0. (not compatible with previous releases without proper configuration of afterInit javascript events of the main EGMap class). Nevertheless, you can use it without EGMap library.

The URL of the extension is http://www.yiiframew...n/egmapkmlfeed/

Please use this post for bug reports, suggestions and support.

Thanks
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#2 User is offline   Rangel Reale 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 68
  • Joined: 14-January 10

Posted 03 February 2011 - 10:13 AM

Can't I generate a feed from an existing EGMap instance? I want to give my user the option to "view current map (with markers) on google earth", so I could generate the same code, and just render the map as KML instead as javascript.
0

#3 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 03 February 2011 - 11:41 AM

No you cant, but it is a cool option that I may think to implement for future releases.

Nevertheless, the creation of the KML document is quite easy (example with EGMap Extension)



Yii::import('ext.kml.*');
 
// add one Icon style to the generator
$iconStyle = new EGMapKMLIconStyle('testStyle', 'iconID', 'http://maps.google.com/mapfiles/ms/icons/purple-pushpin.png');
 
$kml->addTag($iconStyle);
 
foreach( $markers as $marker)
{
   $placemark = new EGMapKMLPlacemark('Another Marker');
   $placemark->styleUrl = '#testStyle';

   // if marker has a EGMapInfoWindow you can
  // $placemark->description = $marker->getHtmlInfoWindow->content;
   $placemark->description = 'This marker has <b>HTML</b>';
   // *Note that for KML the lat and lon are the other way around
   // should be lon - lat
   $placemark->addChild(new EGMapKMLPoint($marker->getLng(), $marker->getLat()));
   $kml->addTag($placemark);
}

// generate feed
   $kml->generateFeed();

¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#4 User is offline   Pradhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 209
  • Joined: 01-May 09
  • Location:Charlotte, NC

Posted 13 February 2013 - 02:02 AM

Antonio,

I am trying to use this extention but I am getting following error.

<pre>

Undefined variable: kml

C:\home2\arthahit\public_html\arthabusinessgroup\protected\modules\pp\controllers\KlmController.php(43)

31 * - 2010-10-24: added

32 * @param <type> $lat
33 * @param <type> $lon
34 * @param <type> $miles
35 * @param <type> $limit
36 * @return boolean
37 */
38 public function actionGenerate() {
39 Yii::import('ext.kml.*');
40
41 // add Icon styles to the generator
42 $iconStyle = new EGMapKMLIconStyle('low-prospectY', 'low-prospectY-icon', 'http://maps.google.com/mapfiles/ms/micons/blue.png');
43 $kml->addTag($iconStyle);
44
45 $iconStyle = new EGMapKMLIconStyle('low-prospectS', 'low-prospectS-icon', 'http://maps.google.com/mapfiles/ms/micons/blue-dot.png');
46 $kml->addTag($iconStyle)
</pre>

[/size][/font]
[font="Verdana"][size="2"]
 public function actionGenerate() {
        Yii::import('ext.kml.*');
        
        // add Icon styles to the generator
        $iconStyle = new EGMapKMLIconStyle('low-prospectY', 'low-prospectY-icon', 'http://maps.google.com/mapfiles/ms/micons/blue.png');
        $kml->addTag($iconStyle);

        $iconStyle = new EGMapKMLIconStyle('low-prospectS', 'low-prospectS-icon', 'http://maps.google.com/mapfiles/ms/micons/blue-dot.png');
        $kml->addTag($iconStyle);

        $iconStyle = new EGMapKMLIconStyle('med-prospect', 'med-prospect-icon', 'http://maps.google.com/mapfiles/ms/micons/yellow.png');
        $kml->addTag($iconStyle);

        $iconStyle = new EGMapKMLIconStyle('hig-prospect', 'hig-prospect', 'http://maps.google.com/mapfiles/ms/micons/green.png');
        $kml->addTag($iconStyle);

        $iconStyle = new EGMapKMLIconStyle('rej-prospect', 'rej-prospect-icon', 'http://maps.google.com/mapfiles/ms/micons/red.png');
        $kml->addTag($iconStyle);

        $Place1s = Place1::model()->findAll();
        $Place2s = Place2::model()->findAll();

        foreach ($Place1s as $Place1) {
            $Seller = SellerProspectParty::model()->findByPk($Place1->SellerId);
            
            $description = $Seller->AddressLine1 . '<br>' 
                    . $Seller->City . ', ' . $Seller->StateCode . ' - ' . $Seller->PostalCode . '<br>' 
                    . $Seller->Telephone . '<br><br>';

            // create one marker placemark
            $placemark = new EGMapKMLPlacemark($Seller->CompanyName);
            $placemark->styleUrl = '#low-prospectY';
            $placemark->description = $description;
            $placemark->addChild(new EGMapKMLPoint($Place1->Lat, $Place1->Lon,0));
            $kml->addTag($placemark);
        }
        
        $kml->generateFeed();

    }

}[/size][/font]
[font="Verdana"][size="2"]

0

#5 User is offline   Pradhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 209
  • Joined: 01-May 09
  • Location:Charlotte, NC

Posted 13 February 2013 - 05:09 PM

It is working great! All I needed was a line to initiate the class



$kml = new EGMapKMLFeed;

0

#6 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 19 February 2013 - 11:12 AM

Glad you found the answer... and apologies for my shortage of time
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users