EGMap 2.0 Google Maps Extension Objet-oriented PHP abstraction to the Google Maps API to ease the proc
#221
Posted 20 February 2013 - 08:20 AM
www.ramirezcobos.com
#222
Posted 20 February 2013 - 08:21 AM
Please, accept my apologies
www.ramirezcobos.com
#223
Posted 20 February 2013 - 08:23 AM
eamador, on 11 December 2012 - 05:08 AM, said:
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
www.ramirezcobos.com
#224
Posted 20 February 2013 - 08:25 AM
renathy, on 24 October 2012 - 12:06 PM, said:
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.
www.ramirezcobos.com
#225
Posted 20 February 2013 - 08:27 AM
MPeli, on 04 June 2012 - 01:52 PM, said:
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.
www.ramirezcobos.com
#226
Posted 20 February 2013 - 08:29 AM
gin, on 05 January 2013 - 03:25 AM, said:
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)
www.ramirezcobos.com
#227
Posted 20 February 2013 - 08:30 AM
eamador, on 11 December 2012 - 05:08 AM, said:
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
www.ramirezcobos.com
#228
Posted 20 February 2013 - 08:34 AM
bitmatix, on 28 January 2013 - 10:46 AM, said:
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
www.ramirezcobos.com
#229
Posted 05 March 2013 - 04:47 PM
I asked a questions earlier but i almost did everything
<?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
#230
Posted 07 March 2013 - 06:35 AM
Thanks
#232
Posted 18 May 2013 - 09:43 PM
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
http://www.yiiframew...ping-extension/
#233
Posted Yesterday, 08:57 AM
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

Help











