#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    2

    Google Latitude (to much decimals)


    Hi

    I'm using Google Geocoder to get lat/lng from location. Now the problem is the result sometimes has many more characters then normal..

    -73.67942649999998 , I got this value from the variable.
    The problem is I want to prepare my database but Float( 10,6 ) is not enough to hold this variable.

    Any ideas?
    thanks!
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    I don't really understand the problem, if you want to store a more precise value then change your database structure, if you don't, then don't.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    204
    Rep Power
    2
    Originally Posted by E-Oreo
    I don't really understand the problem, if you want to store a more precise value then change your database structure, if you don't, then don't.
    I found the solution. The problem was that the lat/lng number had a different length every time. Sometimes 6 decimals, sometimes more

    by using
    Code:
    latitude = results[0].geometry.location.lat().toFixed(6);
    I always have the 6 decimals behind the comma.

IMN logo majestic logo threadwatch logo seochat tools logo