Yii Framework Forum: [EXTENSION] jquery-gmap - Yii Framework Forum

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] jquery-gmap OO PHP interface to Google Maps with added functionality. Rate Topic: ***** 4 Votes

#21 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 10 June 2011 - 03:56 AM

I'm not sure I understand. Do you mean the styled maps option of the js plugin ? http://gmap3.net/api...styled-map.html
0

#22 User is offline   tadas 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 03-June 11
  • Location:Lithuania

Posted 12 June 2011 - 11:50 PM

View Postianaré, on 10 June 2011 - 03:56 AM, said:

I'm not sure I understand. Do you mean the styled maps option of the js plugin ? http://gmap3.net/api...styled-map.html


Yes
0

#23 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 14 June 2011 - 08:29 AM

At the present time, this feature is not implemented in the PHP interface. Work has started but is not finished.

You should be able to set the options through JS though, by accessing the map after creation.
0

#24 User is offline   BigZ 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 28-June 11

Posted 28 June 2011 - 01:08 PM

Very nice and friendly extension.
Works like a charm!

Question: is it possible to define an 'anchor point' for a marker's icon?

According to Google Maps documentation (google.maps.MarkerImage class):
"By default, the anchor is located along the center point of the bottom of the image"

But since I'm using a PNG image with semi-transparent glow / shadow, the icon appears to be 'above' the actual point in the map where it should be...
Also, when I add 'polylines' to link the Markers, the lines seem to come out of the 'air' instead of the Marker's center.


I'd like to position the icon's vertical and horizontal center at the marker's coordinates. Any ideas?
0

#25 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 29 June 2011 - 03:22 AM

Have you seen any Google documentation to that effect ?
0

#26 User is offline   BigZ 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 28-June 11

Posted 29 June 2011 - 08:21 AM

Yes Ianaré, see below:

google.maps.MarkerImage class:
Constructor: MarkerImage(url:string, size?:Size, origin?:Point, anchor?:Point, scaledSize?:Size)

anchor = Point : The position at which to anchor an image in correspondance to the location of the marker on the map. By default, the anchor is located along the center point of the bottom of the image.

(from code.google.com/apis/maps/documentation/javascript/reference.html#MarkerImage)

I don'tt know hoy to use this javascript code with the jquery-gmap extension (if possible), or if the extension already supports this.
0

#27 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 29 June 2011 - 12:23 PM

This was relatively easiy to add, so here you go :

$marker = new EGmap3Marker(array(
    'title'=>'hello',
    'icon'=>array(
         'url'=>'http://google-maps-icons.googlecode.com/files/dolphins.png',
         'anchor'=> array('x'=>1,'y'=>36),
         //'anchor' => new EGmap3Point(5,5),
    )
));


This hasn't been released yet though, get latest version from github ...

https://github.com/d...yii-jquery-gmap
0

#28 User is offline   BigZ 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 28-June 11

Posted 29 June 2011 - 01:36 PM

Thanks SOOO much!! :D

It works perfect.
0

#29 User is offline   siskalandre 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 92
  • Joined: 16-March 11
  • Location:Indonesia

Posted 06 July 2011 - 07:10 PM

View Postianaré, on 04 May 2011 - 04:03 AM, said:

1) Icon url can be passed to the marker options.

2) You can add events to markers, circles, etc simply by passing the event type and JS code to the addEvent or addEventOnce methods.

$marker = new EGmap3Marker(array(
    'title' => 'hello',
    'icon' => 'http://google-maps-icons.googlecode.com/files/dolphins.png',
));
$marker->address = 'Jacksonville, FL';
$marker->data = 'test data !';
$js = "function(marker, event, data){
	var map = $(this).gmap3('get'),
	infowindow = $(this).gmap3({action:'get', name:'infowindow'});
	if (infowindow){
	    infowindow.open(map, marker);
	    infowindow.setContent(data);
	} else {
	    $(this).gmap3({action:'addinfowindow', anchor:marker, options:{content: data}});
        }
}";
$marker->addEvent('click', $js);
$marker->centerOnMap();
$gmap->add($marker);



Thank you for great extensions.
I've problem, I want to refresh automatic only the map and set data marker from database periodically.

Could you help me?
0

#30 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 07 July 2011 - 04:09 AM

If you need to update the map after it is created you should look to adding that functionality with javascript calls, connecting to the DB via ajax. Take a look at the gmap3 API documentation.
0

#31 User is offline   Arnimag 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 07-July 11

Posted 22 August 2011 - 06:37 AM

I have problem with this extension, i dont know how to modify action named 'addMarkers'. I want to make clustering for points like here gmap3.net/examples/clustering.html. Anyone have solution for clustering in this extension? it is possible?
0

#32 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 24 August 2011 - 01:50 PM

View Posttadas, on 10 June 2011 - 12:39 AM, said:

I want to apply custom styles for gmap.
For control options I add 2 styles to the mapTypeIds option like this:
$options->mapTypeId = EGmap3MapTypeId::SATELLITE;    
    $mapTypeControlOptions = new EGmap3MapTypeControlOptions;
    $mapTypeIds = array(EGmap3MapTypeId::ROADMAP, EGmap3MapTypeId::SATELLITE, EGmap3MapTypeId::TERRAIN, 'mystyle1', 'mystyle2');
    $mapTypeControlOptions->mapTypeIds = $mapTypeIds;
    $mapTypeControlOptions->style = EGmap3MapTypeControlStyle::DROPDOWN_MENU;
    $options->mapTypeControlOptions = $mapTypeControlOptions;

But cant figure out how to define and apply styles.
How I understand there is no way to do this in jquery-gmap, but maybe I can pas JavaScript something like with events:
$js = "function(marker, event, data){
        $('#House_gps_long').val(parseFloat(event.latLng.lng()).toFixed(8)); 
        $('#House_gps_lat').val(parseFloat(event.latLng.lat()).toFixed(8));
}";
     $marker->addEvent('dragend', $js);




A new version has been pushed to github which provides preliminary support for this. Here is an example :

Yii::import('ext.jquery-gmap.*');

$gmap = new EGmap3Widget();
$gmap->setSize(600, 400);

// base options
$options = array(
	'zoom' => 12,
	'center' => array('41.850033', '-87.650052'),
	'mapTypeId' => EGmap3MapTypeId::ROADMAP,
	'mapTypeControlOptions' => array(
		'mapTypeIds' => array(EGmap3MapTypeId::ROADMAP, 'style1'),
	),
);
$gmap->setOptions($options);

$styledMap = new EGmap3StyledMap('style1', array('name' => 'style 1'));
$styledMap->addStyle(array(
	'featureType' => 'road.highway',
	'elementType' => 'geometry',
	'stylers' => array(array(
			'hue' => '#ff0022',
			'saturation' => 60,
			'lightness' => -20
		)
	)
));
$gmap->add($styledMap);

$gmap->renderMap();

0

#33 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 25 August 2011 - 04:58 AM

New version released today which includes improvements previously requested here. Also some example view files.
0

#34 User is offline   ianaré 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 05-November 10
  • Location:Terra (III in Sol system)

Posted 25 August 2011 - 01:50 PM

View PostArnimag, on 22 August 2011 - 06:37 AM, said:

I have problem with this extension, i dont know how to modify action named 'addMarkers'. I want to make clustering for points like here gmap3.net/examples/clustering.html. Anyone have solution for clustering in this extension? it is possible?


Work on this has started but is not complete yet, will be done for the next release. For now you can still access this functionality through JS.
0

#35 User is offline   Snake 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 03-August 11
  • Location:United States of America

Posted 06 September 2011 - 01:42 AM

Hey! Anyone have an idea as to how I can get the text directions showing with this?

You need a call to setDirectionsPanel... but I am not really sure how to call that properly with this extension. I have a simple map and address form. They type their address in and a route is made from there to the destination. The form does submit to the page... so there is nothing fancy. And the route is working correctly... I just need the text directions.

Please help me. =\

Thanks.
0

#36 User is offline   enfield 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 288
  • Joined: 12-January 11

Posted 07 September 2011 - 01:28 AM

Is is possible to pass many addresses into the marker and have them all displayed on the map?

I created a function in my model with a foreach loop to grab all the addresses and then set that function as the marker but this only prints out all the addresses above the map and the map only shows a world view at this point.
0

#37 User is offline   yeti999 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 19-August 11

Posted 16 October 2011 - 03:14 AM

How to render a street view/ panorama map using this extension?
0

#38 User is offline   Yiimaps 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 24-January 12

Posted 24 January 2012 - 01:05 PM

Please help !!

How do I add more then one marker with info window

please please help me
0

#39 User is offline   Lukatone 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 05-February 12

Posted 09 February 2012 - 10:43 AM

Hello Yii people! I would like to know if someone could solve the comment #5803 written by sirin_ibin (Update Marker Position from Yii Model is not working when we are using Capture position or capture zoom level with it).

This extension is great!! Thanks
0

#40 User is offline   alex-ks 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 29-August 11
  • Location:Minsk, Belarus

Posted 04 April 2012 - 06:35 PM

Hi. How i can get current lat lon by right clicking on the map and populate it in a form fiedls?
Here is the code in js:

google.maps.event.addListener(map, "rightclick", function(event) {
    var lat = event.latLng.lat();
    var lng = event.latLng.lng();
    // populate yor box/field with lat, lng
    alert("Lat=" + lat + "; Lng=" + lng);
});


How i can do this using this extension?
Thanks
0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • 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