Yii Framework Forum: EGMap 2.0 Google Maps Extension - Yii Framework Forum

Jump to content

  • (13 Pages)
  • +
  • « First
  • 10
  • 11
  • 12
  • 13
  • You cannot start a new topic
  • You cannot reply to this topic

EGMap 2.0 Google Maps Extension Objet-oriented PHP abstraction to the Google Maps API to ease the proc Rate Topic: ***** 5 Votes

#221 User is offline   Antonio Ramirez 

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

Posted 20 February 2013 - 08:20 AM

The github location of this extension has now changed to https://github.com/2amigos/egmap
¿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

#222 User is offline   Antonio Ramirez 

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

Posted 20 February 2013 - 08:21 AM

I am very sorry for all you waiting for some support. Not having much time nowadays.

Please, accept my apologies
¿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

#223 User is offline   Antonio Ramirez 

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

Posted 20 February 2013 - 08:23 AM

View Posteamador, on 11 December 2012 - 05:08 AM, said:

Hi all!

I am using EGMap extension, which works fine until i needed to get coordinates from an given address.

I am using the example that is found on the extension page.

The next code is exactly the same code than the one in the documentation (reverse geocode), but the latitude and longitude which are returning is 0,0.
$gMap = new EGMap();
$gMap->setWidth(500);
$gMap->setHeight(400);
$gMap->zoom = 5;
 
$sample_address = 'Czech Republic, Prague, Olivova';
 
// Create geocoded address
$geocoded_address = new EGMapGeocodedAddress($sample_address);
$geocoded_address->geocode($gMap->getGMapClient());
 
// Center the map on geocoded address
 $gMap->setCenter($geocoded_address->getLat(), $geocoded_address->getLng());
 
// Add marker on geocoded address
$gMap->addMarker(
     new EGMapMarker($geocoded_address->getLat(), $geocoded_address->getLng())
);
 
$gMap->renderMap();



I tried changing the address, i am executing it with the Mozilla Firefox Console running and it is telling me NO errors.

So I can not figure out why is happening this....
Has anyone any idea about the reason of this problem?

I will really appreciate any suggestion!

Thank you very much!
Regards!


Do you have CURL installed? can you show a debug message? like what is happening when the CURL call is performed?

Cheers
¿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

#224 User is offline   Antonio Ramirez 

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

Posted 20 February 2013 - 08:25 AM

View Postrenathy, on 24 October 2012 - 12:06 PM, said:

I would like to use iFrame with EGMap, otherwise my css framework has some conflicts with map.
Can you guide me how to do that?

For example, here is a simple code for EGMap without any iframe. Currently I put it into my contacts.php and site/contacts render this page.

<?php
Yii::import('application.extensions.EGMap.*');

$gMap = new EGMap();
$gMap->zoom = 18;
$mapTypeControlOptions = array(
'position'=> EGMapControlPosition::LEFT_BOTTOM,
'style'=>EGMap::MAPTYPECONTROL_STYLE_DROPDOWN_MENU
);

$gMap->mapTypeControlOptions= $mapTypeControlOptions;
$gMap->setCenter(56.959661, 24.102965);
$gMap->renderMap();
?>


Just put an iframe there and put its src attribute to point to a controller that renderPartial the view... it will work.
¿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

#225 User is offline   Antonio Ramirez 

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

Posted 20 February 2013 - 08:27 AM

View PostMPeli, on 04 June 2012 - 01:52 PM, said:

Hello,

thank you for your extension. I have two small problems.

1) I was wondering how I can disable scroll wheel?

I would like prevent visitors of my site from scrolling a google map.

2) How I can get an instance of a map (variable EGMap0).

I have a javascript function called getlocations() which is able to zoom a map to particular city. If I add this code right before </body> it does nothing bacause EGMap0 is null.

getlocations(EGMap0);


However, if I use this code everything works fine. But I assume that it is not a proper solution.

setTimeout("getlocations(EGMap0)", 2000);


The problem could be cause by
google.maps.event.addDomListener(window, "load",
EGMapContainer1_init);


It seems to be slow.

Thank you, Martin.


to ge the javascript instance of a map, you need to make use of the ->getJsName(), that will return its ID. EGMap defaults to EGMap{counter} if you do not set its ID. The easiest solution is to set its ID (ie myEGMap) and then make use of that name to get its javascript instance.
¿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

#226 User is offline   Antonio Ramirez 

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

Posted 20 February 2013 - 08:29 AM

View Postgin, on 05 January 2013 - 03:25 AM, said:

Hi Antonio,


can you tell me how to fix AddressSearchBox?

cheers!


Please check this example: https://github.com/2...GeocodeTool.php (it may have some issues out of the box)
¿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

#227 User is offline   Antonio Ramirez 

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

Posted 20 February 2013 - 08:30 AM

View Posteamador, on 11 December 2012 - 05:08 AM, said:

Hi all!

I am using EGMap extension, which works fine until i needed to get coordinates from an given address.

I am using the example that is found on the extension page.

The next code is exactly the same code than the one in the documentation (reverse geocode), but the latitude and longitude which are returning is 0,0.
$gMap = new EGMap();
$gMap->setWidth(500);
$gMap->setHeight(400);
$gMap->zoom = 5;
 
$sample_address = 'Czech Republic, Prague, Olivova';
 
// Create geocoded address
$geocoded_address = new EGMapGeocodedAddress($sample_address);
$geocoded_address->geocode($gMap->getGMapClient());
 
// Center the map on geocoded address
 $gMap->setCenter($geocoded_address->getLat(), $geocoded_address->getLng());
 
// Add marker on geocoded address
$gMap->addMarker(
     new EGMapMarker($geocoded_address->getLat(), $geocoded_address->getLng())
);
 
$gMap->renderMap();



I tried changing the address, i am executing it with the Mozilla Firefox Console running and it is telling me NO errors.

So I can not figure out why is happening this....
Has anyone any idea about the reason of this problem?

I will really appreciate any suggestion!

Thank you very much!
Regards!


check this class maybe it provides you with clues https://github.com/2...GeocodeTool.php
¿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

#228 User is offline   Antonio Ramirez 

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

Posted 20 February 2013 - 08:34 AM

View Postbitmatix, on 28 January 2013 - 10:46 AM, said:

How can I make the marker in the following code "global"?


function EGMapContainer0_init(){
  var mapOptions = {center:new google.maps.LatLng(52.444977, 13.2910249), zoom:15,   mapTypeId:google.maps.MapTypeId.ROADMAP};

  map = new google.maps.Map(document.getElementById("EGMapContainer0"), mapOptions);

  var EGMapMarker1 = new google.maps.Marker({map:map, position:new google.maps.LatLng(52.444977, 13.2910249), draggable:true});
} google.maps.event.addDomListener(window, "load", EGMapContainer0_init);


I'm asking that because I only have 1 marker on the map and I need to acces it, i.e. to use the setPosition() of this marker.

Cheers,
Dan


You just need to add a global variable to the map https://github.com/2.../EGMap.php#L933

Then, in order to create the marker add the initialization code on its afterInits parameter https://github.com/2.../EGMap.php#L664 when you render the map:

$myMap->renderMap(array('GMapMarker1 = new google.maps.Marker({map:map, position:new google.maps.LatLng(52.444977, 13.2910249), draggable:true});');

-- not tested

Cheers
¿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

#229 User is offline   tzoll 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 28-February 13

Posted 05 March 2013 - 04:47 PM

Hi Antonio:) Thanks for this great extension :)

I asked a questions earlier but i almost did everything :) It was my question: How can i display multiple markers (from db) which should be displayed on renderPartial (using default Manage view from CRUD - Model::actionAdmin) and quantity of markers should dependent from records displayed by zii.widgets.grid.CGridView (for example: when i click next page on CGridView pagination - markers should be reloaded). I almost did it, but not all:) it's my actual code:)

<?php
Yii::import('ext.gmap.*');
$gMap = new EGMap();
$gMap->zoom = 2;
$mapTypeControlOptions = array(
  'position'=> EGMapControlPosition::LEFT_BOTTOM,
  'style'=>EGMap::MAPTYPECONTROL_STYLE_DROPDOWN_MENU
);
$gMap->mapTypeControlOptions= $mapTypeControlOptions;
$gMap->setCenter(39.721089311812094, 2.91165944519042);

$dataProvider=$model->search();
  $i = 0;
  if ( $dataProvider->getData() ) {
  foreach ($dataProvider->getData() as $row) {
  $i++;
  // Create marker
  $marker = new EGMapMarker($row['lat'], $row['lng']);
  $gMap->addMarker($marker);
  }
  }
$gMap->renderMap();
//end of egmap

//start search and gridview

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#mapa-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");

echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'mapa-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'id',
		'idspecies',
		'lat',
		'lng',
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>



It is almost fine, but I've got one question:) When i search using search form or navigate in gridview using pagination, or delete record using gridview - markers on map are not changed. How can i make it work ?:)

Thanks and Greetings from Poland:)
Tom
0

#230 User is offline   tzoll 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 28-February 13

Posted 07 March 2013 - 06:35 AM

I tried to disable ajax in CGridView, and when i disable ajax, everything works fine. But how make it work, when ajax is enabled ?:)
Thanks :)
0

#231 User is offline   pistonov 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 22-January 13

Posted 28 March 2013 - 03:28 PM

How i can apply custom style to map?
0

#232 User is offline   Islam500 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 26-October 12

Posted 18 May 2013 - 09:43 PM

Nice work,

am working on an openlayers based Mapping extension that will have several widgets.


I have added the slick data grid and linked it with the openlayers map.

am now working on a search widget so that search results are over-layed on the map via AJAX.

have also managed to put them all in the Jquery UI Layout. which makes it look like extJS.

am trying to make a set of widgets that can be placed in different parts of a view to make different mapping applications:
proposed widgets:

-map
-layer switcher
-feature selector [data table grid]
-query executor [an input field for query and sending results to openlayers]
-legend
-editor
-controllers [zoomer,panner,.....]
-layout



do check the following post if you are interested in contributing to this new mapping extension :D :
http://www.yiiframew...ping-extension/
0

#233 User is offline   mauro_ 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 31-July 12
  • Location:Buenos Aires

Posted 21 May 2013 - 08:57 AM

Hi Antonio! Can I use multiple markers with EGmap? I have an array:

Array
(
[0] => Array
(
[Latitud] => -34.53627
[Longitud] => -58.57105
[Fecha_Hora] => 2013-02-10 00:01:50
)

[1] => Array
(
[Latitud] => -34.53627
[Longitud] => -58.57105
[Fecha_Hora] => 2013-02-10 00:06:50
)

[2] => Array
(
[Latitud] => -34.53627
[Longitud] => -58.57105
[Fecha_Hora] => 2013-02-10 00:11:50
)

[3] => Array
(
[Latitud] => -34.53627
[Longitud] => -58.57105
[Fecha_Hora] => 2013-02-10 00:16:50
)

[4] => Array
(
[Latitud] => -34.53627
[Longitud] => -58.57105
[Fecha_Hora] => 2013-02-10 00:21:50
)

[5] => Array
(
[Latitud] => -34.53627
[Longitud] => -58.57105
[Fecha_Hora] => 2013-02-10 00:26:50
)


)


I need to use this array with custom markers.

Thank you.
Mauro
0

#234 User is offline   Chelo007 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 23-May 13

Posted 23 May 2013 - 07:13 PM

ESPAÑOL
ENGLISH



Hola, estuvimos trabajando con tu extensión para desarrollar nuestra aplicación, y nos fue de gran ayuda. Muchas gracias por compartirla.

Utilizamos, entre otras cosas, KML service y queremos proponer la siguiente modificación al código en la Acción "toJS" de EGMapKMLService.php:

Hello, we were working with your extension to develop our application, and we were a great help. Thank you very much for sharing.

Used, among other things, KML service and we propose the following modification to the code in the Action "tojs" of EGMapKMLService.php:


/**
* @return string Create new control to display latlng and coordinates under mouse.
 */
	public function toJs( $map_js_name = 'map' )
	{
		/*new line--->>*/$return='var myKmlOptions = {preserveViewport: true, suppressInfoWindows: true};';//<<<<--------
		$return .= ' var '.$this->getJsName().'= new google.maps.KmlLayer(\''.$this->url.'\',myKmlOptions);'.PHP_EOL;
		$return .= $this->getJsName().'.setMap('.$map_js_name.');'.PHP_EOL;
		return  $return;
  	}





Agregando esa linea, el KML insertado se mostrará sin modificar el ZOOM ni la posición del mapa anterior.
Esperamos que sea útil.

Adding that line, inserted KML is displayed without modifying the ZOOM or previous map position.
We hope it is useful.


Pablo Kogan,
Miguel Silva,
Marcelo Chacon
0

#235 User is offline   Deltawar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 20-November 12

Posted 13 June 2013 - 03:06 PM

Really nice extension. I have been trying to achieve something and been unable to so thought i'd ask the pros.

I have a destination, but want to set the origin using geolocation so it gives directions / places from the users location.

Is this possible with EGMap?

I have done it straight in html/js, but I dont know how to do is using the extension as the js code is generated by the php class isnt it?
0

#236 User is offline   periko_0 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 20-May 13

Posted 28 June 2013 - 01:37 AM

Hello,

How can i enabled and disabled kml layer with checkbox and this extension? Thanks!!
0

#237 User is offline   periko_0 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 20-May 13

Posted 28 June 2013 - 07:29 AM

How can I open a map marker when you click link?
0

#238 User is offline   Tiny Byte 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-March 13

Posted 08 July 2013 - 05:33 AM

Hi guys
great widget, please don't mind my silly question.
I just want to know how can I change where a marker label is displayed.I want to put it right below my marker, in center.
and also I want to cluster my markers, based on their value (I want to assign some value to them), not their count.
thanks in advance
0

#239 User is offline   BodYiik 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 11-August 12

Posted 24 August 2013 - 07:32 PM

How can i do, that infowindow autoopen, when page is load?
0

#240 User is offline   apinx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 16-March 12

Posted 30 August 2013 - 08:41 PM

Can I reload EGMap with ajax without reload a page?
I had searching all articel but no one talk about it.

thanx...
apinx
0

Share this topic:


  • (13 Pages)
  • +
  • « First
  • 10
  • 11
  • 12
  • 13
  • 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