Widget that allows to pick coordinates using google map in modal window
Requirements ¶
Tested on Yii 1.1.10, but shoul work on previous versions too.
Usage ¶
- Checkout source code to your project, for example to ext.coordinatepicker.
- Render inputs.
- Register script with widget.
Example:
Coordinate inputs:
Picker popup:
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,
));
Changelog ¶
- September 27 - Replaced "text-indent: -99999999px;" hacks in css, to fix apearance in updated
- August 9 - Replaced "0+text" expression in script by parseFloat(), added check for NaN value.
Great extension... a few suggestions
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:
Good work!
Re: a few suggestions
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.
Bug??
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!!!
Re: Bug??
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.
other bug...
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
fixed...
I have fixed it... problem is settings were stored in global space. I can send you the corrections if you want
Works!!
Thanks for the great extension. It works tried it out on Yii 1.12 along with Yii Bootstrap no conflicts
Amazing extension
Its Working like a charm!!!!!!!!! thanks for the great extension....
yii2
it doesn't work on yii2
Hello, is there a version for yii2?
My app uses yii2.
i am getting Maps API error: MissingKeyMapError
I am using Yii1
i have added this extension on my site before 2 yrs. It was working fine.
but now it is giving me following error
I am getting Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error
please help me
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.