Widget that allows to pick coordinates using google map in modal window
Tested on Yii 1.1.10, but shoul work on previous versions too.
Example:
echo $form->textField($model, 'lat'); echo $form->textField($model,'long'); $this->widget('ext.coordinatepicker.CoordinatePicker', array( 'model' => $model, 'latitudeAttribute' => 'lat', 'longitudeAttribute' => 'long', //optional settings 'editZoom' => 12, 'pickZoom' => 7, 'defaultLatitude' => 50.443513052458044, 'defaultLongitude' => 30.498046875, ));
Total 6 comments
I have fixed it... problem is settings were stored in global space. I can send you the corrections if you want
Hey Bogdan, this time I discovered that putting several widgets on same page... all coordinate pickers update the LAST lat,lon textboxes
i'll try to review if I can detect where the mistake is and will tell you
anyway good job man! Juan Arias
Interesting - it was working for me(in latest Chrome web browser).
Anyway I have replaced "0+text" expression by parseFloat() also added check for NaN value, after parsing value. I hope this will help.
In php 5.3, I had to change in map.js the parsing of lat an long from: coord_long = 0 + $(settings.lat_selector, window.parent.document).attr('value'); to... coord_long = parseFloat($(settings.long_selector, window.parent.document).attr('value'));
I was giving me NaN's on interface
Thx anyway!!!
I have added settings for:
About settings for pin updating when changing zoom or dragging map: I see no reason to do so, because plugin interface was designed to always keep pin in center of map.
There were a couple of things I wanted to change right off the bat and I think other people would so would be great if you could have some config data set (as with components). These would include: - setting the default lat,lng - setting the default zoom level - turn on/off update pin on change (moving the map) - turn on/off update pin on zoom
Good work!
Leave a comment
Please login to leave your comment.