Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Need to generate correct longitude & latitude .SQL

Need to auto-generate extra coordinate numbers in a .SQL file

4:02 pm on Jul 6, 2014 (gmt 0)

New User

5+ Year Member

joined:Aug 20, 2010
posts: 9
votes: 0

Hi guys,
I'm not fluent in database programming languages, but I am trying to auto-generate some numbers to put in a .sql file.

The numbers I am trying to auto-generate refer to something that are called rad_latitude and rad_longitude in this particular .SQL file.

See example below:

 INSERT INTO `dsb_loc_zips` (`zip_id`, `zipcode`, `fk_country_id`, `fk_state_id`, `fk_city_id`, `latitude`, `rad_latitude`, `longitude`, `rad_longitude`) VALUES

(42789, 'OX1', 217, 63, 212310, 51.729639, 0.9028525214180669, -1.28049, -0.02234876653886219),

51.729639 latitude

0.9028525214180669 rad_latitude

-1.28049 longitude

-0.02234876653886219 rad_longitude

I was able to generate the above code by "manually" entering some location info, including the latitude and longitude numbers into a Admin/CMS area of a website.
... I did not know the "rad_" numbers. The site auto-generated them.

Do you know of any Program, Website or Excel file etc, that by entering a long list of "latitude" and "longitude" numbers... can auto-generate the relevant "rad_latitude" and "rad_longitude" numbers?

Thank you for reading :)
4:50 pm on July 6, 2014 (gmt 0)

Moderator from US 

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 10, 2005
votes: 76

Converting degrees to radians (and back again) is fairly basic trigonometry- multiply the number of degrees by pi/180.
9:58 am on July 8, 2014 (gmt 0)

New User

5+ Year Member

joined:Aug 20, 2010
posts: 9
votes: 0

Thank you.
Will look into this...