Yii 1.1: coordinatepicker

Widget to pick coordinates using google map in modal window
16 followers

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

  1. Checkout source code to your project, for example to ext.coordinatepicker.
  2. Render inputs.
  3. Register script with widget.

Example:

Coordinate inputs: Inputs

Picker popup: 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.

Resources

Total 10 comments

#19522 report it
ahmed.ismail at 2015/08/19 11:17am
Hello, is there a version for yii2?

My app uses yii2.

#19065 report it
josimarjafa at 2015/03/07 08:35am
yii2

it doesn't work on yii2

#14897 report it
karte at 2013/09/19 07:10am
Amazing extension

Its Working like a charm!!!!!!!!! thanks for the great extension....

#13765 report it
Paul_Kish at 2013/06/24 03:27am
Works!!

Thanks for the great extension. It works tried it out on Yii 1.12 along with Yii Bootstrap no conflicts

#10630 report it
Hwangar at 2012/11/09 04:34am
fixed...

I have fixed it... problem is settings were stored in global space. I can send you the corrections if you want

#10628 report it
Hwangar at 2012/11/09 03:04am
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

#9418 report it
Bogdan Savluk at 2012/08/09 10:57am
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.

#9417 report it
Hwangar at 2012/08/09 09:45am
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!!!

#8947 report it
Bogdan Savluk at 2012/07/09 09:44am
Re: a few suggestions

I have added settings for:

  • default latidute/longitude
  • default zoom levels (separately for picking and editing coordinates)

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.

#8940 report it
andyofb at 2012/07/09 06:43am
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: - 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 to leave your comment.

Create extension