Google maps default position on ocean atlantic

This topic contains 9 reply and 3 voices, and was last updated by TomTom 10 years, 8 months ago
Viewing 9 Posts - 1 through 9 (of 9 total)
Author Posts
May 17, 2013 at 3:18 pm 3760
TomTom Hi Tareq, first thank for your great plugin. I'm using the google maps field but I find that default location is not working, don't care what lat and lnt in the correct format I give in the creation tool I always get the same location down "Ghana, Africa" on Ocean Atlantic. Any suggestion? Thanks.
May 17, 2013 at 5:50 pm 3770
Tareq Hasan Tareq Hasan

The sequence is latitude and longitude, separated by a comma and no space.

May 17, 2013 at 6:06 pm 3772
HispanicSearching HispanicSearching

This is exactly the format I use. Ej: “40.4167754,-3.7037901999999576”

In html source I see that lng and lat isn’t assigned:

var def_longval = 0;
var def_latval = 0;

but the values are correctrly saved in “Default Co-ordinate”…

May 17, 2013 at 6:26 pm 3776
HispanicSearching HispanicSearching

Well, I think I have find the problem. I use the field in a registration form and when a user access to it the post_id for the map function is the user id. When it’s the first time the user access it don’t have the meta assigned BUT don’t use the default value. I have solved changing this:

       if ( $post_id ) {
            list( $def_lat, $def_long ) = explode( ',', $value );
        } else {
            list( $def_lat, $def_long ) = explode( ',', $attr['default_pos'] );
        }

to this

       if ( $post_id ) {
            list( $def_lat, $def_long ) = explode( ',', $value );
        }
        if (!$def_lat&&!$def_long) {
            list( $def_lat, $def_long ) = explode( ',', $attr['default_pos'] );
        }

the problem will append the same in a post form.

May 17, 2013 at 6:27 pm 3777
HispanicSearching HispanicSearching

the file is “class/render-form.php”

May 17, 2013 at 6:33 pm 3778
Tareq Hasan Tareq Hasan

Right, that must be the problem.

July 30, 2013 at 5:00 pm 6458
HispanicSearching HispanicSearching

Hi Tareq, can you include this fix in your future releases ? or another one you think its better. Without it, default position don’t work correctly for user profile forms.

Thanks.

August 18, 2013 at 10:36 pm 7121
TomTom TomTom

Hi,

how can i read the position from the browser? That’s imho the solutioin…

Best Thomas

August 18, 2013 at 11:00 pm 7127
Tareq Hasan Tareq Hasan

Reading position from browser isn’t possible right now from the plugin.

August 19, 2013 at 12:04 am 7134
TomTom TomTom

Ok, i changed default to Berlin.

That’s easy – go to maps – set cursor where you want – right click what is here — you got the coordinates.
go to render-form.php in class and change code like this around line 1471

  if ( $post_id ) {
            list( $def_lat, $def_long ) = explode( ',', $value );
        } else {

// add this line
$koordinaten = "52.536273,13.405852";  
// Comment out this line           
 //list( $def_lat, $def_long ) = explode( ',', $attr['default_pos'] );
// Add this line         
   list( $def_lat, $def_long ) = explode( ',', $koordinaten );
        }

Best Thomas

Viewing 9 Posts - 1 through 9 (of 9 total)