一、十进制转换成经纬度
把经纬度转换成十进制的方法很简单
如下就可以了
Decimal Degrees = Degrees + minutes/60 + seconds/3600
例:57°55'56.6" =57+55/60+56.6/3600=57.9323888888888
114°65'24.6"=114+65/60+24.6/3600=结果自己算!
如把经纬度 (longitude,latitude) (205.395583333332,57.9323888888888)
转换据成坐标(Degrees,minutes,seconds)(205°23'44.1",57°55'56.6")。
步骤如下:
1, 直接读取"度":205
2,(205.395583333332-205)*60=23.734999999920 得到"分":23
3,(23.734999999920-23)*60=44.099999995200 得到"秒":44.1
采用同样的方法可以得到纬度坐标:57°55'56.6"
如果需要转换的经纬度数据很多,可以借助Sql查询分析器或Excel来进行转换。这里介绍用Sql实现。
假如我的数据库里的表tableName有以下数据
CREATE TABLE [dbo].[tableName](
[ID] [int] IDENTITY(1,1) NOT NULL,
[address] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
[longitude] [float] NULL,
[latitude] [float] NULL
) ON [PRIMARY]
GO
表中的数据
ID address longitude 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
在sql 查询分析器里直接调用以下查询语句
--Declare The longitude,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(longitude,3)'
Set @LoaMin='left((longitude-'+@LoaDeg+')*60,2)'
Set @LoaSec='left((((longitude-'+@LoaDeg+')*60-'+@LoaMin+')*60),4)'
Set @LatDeg='left(longitude,3)'
Set @LatMin='left((longitude-'+@LatDeg+')*60,2)'
Set @LatSec='left((((longitude-'+@LatDeg+')*60-'+@LatMin+')*60),4)'
--Execute The Command
exec('select ID,address,longitude,
'+@LoaDeg+' as LoaDegree,
'+@LoaMin+' as LoaMinute,
'+@LoaSec+' as LoaSecond
,
'+@LatDeg+' as LatDegree,
'+@LatMin+' as LatMinute,
'+@LatSec+' as LatSecond
from TableName')
即可得到:
ID address longitude 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 205 22 17
- Visa Application for Your Guangzhou Visit
- Bars and Clubs in Guangzhou
- Shenzhen Stock Exchange Overview
- Shenzhen
- Guangzhou International Cartoon Festival animates city
- Orcollo Takes Guangzhou Guinness Title
- Zvonareva defeats Peng to win Guangzhou International
- SME Fair opens in Guangzhou
- Mizuho Corporate Bank establishes Guangzhou branch
- SUN Java Developers API Center