How to coordinate coordinates of GPS longitude and latitude
Original article:Http://hi.baidu.com/myonlylovegg/blog/item/dacc24d4db648acc51da4b28.html
It is easy to convert longitude and latitude to decimal.
As follows:
Decimal degrees = degrees + minutes/60 + seconds/3600
Example: 57 ° 55 '56. 6 "= 57 + 55/60 + 56.6/3600 = 57.9323888888888
114 ° 65 '24. 6 "= 114 + 65/60 + 24.6/3600 = calculate the result by yourself!
For example, set the longitude and latitude (205.395583333332, 57.9323888888888)
Convert data to coordinates (degrees, minutes, seconds) (205 ° 23 '44. 1 ", 57 ° 55' 56. 6 ").
The procedure is as follows:
1. Directly read "Degree": 205
2, (205.395583333332-205) * 60 = 23.734999999920 get "score": 23
3, (23.734999999920-23) * 60 = 44.099999995200 get "seconds": 44.1
Using the same method, we can obtain the latitude coordinates: 57 ° 55'56. 6"
If you need to convert a lot of latitude and longitude data, you can use the SQL query analyzer or Excel to convert. SQL is used for implementation.
Assume that the tablename table in my database has the following data:
Create Table [DBO]. [tablename] (
[ID] [int] identity (1, 1) not null,
[Address] [varchar] (20) Collate chinese_prc_ci_as null,
[Longpolling] [float] Null,
[Latitude] [float] Null
) On [primary]
Go
Table Data
ID address longpolling latitude
0 Add1 205.3955833 57.93238889
1 Add2 205.3911111 57.95194444
2 add3 205.3791667 57.98916667
3 add4 205.3713889 57.95611111
Directly call the following query statement in the SQL query Analyzer:
-- Declare the longpolling, latitude
Declare @ loadeg varchar (50)
Declare @ loamin varchar (100)
Declare @ loasec varchar (100)
Declare @ latdeg varchar (50)
Declare @ latmin varchar (100)
Declare @ latsec varchar (100)
-- Set the variable
Set @ loadeg = 'left (longpolling, 3 )'
Set @ loamin = 'left (longpolling-'+ @ loadeg +') * 60, 2 )'
Set @ loasec = 'left (longpolling-'+ @ loadeg +') * 60-'+ @ loamin +') * 60), 4 )'
Set @ latdeg = 'left (longpolling, 3 )'
Set @ latmin = 'left (longpolling-'+ @ latdeg +') * 60, 2 )'
Set @ latsec = 'left (longpolling-'+ @ latdeg +') * 60-'+ @ latmin +') * 60), 4 )'
-- Execute the command
Exec ('select ID, address, longpolling,
'+ @ Loadeg +' As loadegree,
'+ @ Loamin +' As loaminute,
'+ @ Loasec +' As loasecond
,
'+ @ Latdeg +' As latdegree,
'+ @ Latmin +' As latminute,
'+ @ Latsec +' As latsecond
From tablename ')
You can get:
ID address longpolling loadegree loaminute loasecond latitude latdegree latminute latsecond
1 Add1 205.3955833 205 23 44 57.93238889 205 23 44
2 Add2 205.3911111 205 23 28 57.95194444 205 23 28
3 add3 205.3791667 205 22 45 57.98916667 205 22 45
4 add4 205.3713889 205 22 17 57.95611111 22 17