经纬度转换成十进制
public class TestJingWeiDU { public static void main(String[] args) { TestJingWeiDU t = new TestJingWeiDU(); String lat = "35.37.39.55324"; String lon = "139.44.13.1546"; t.countLatLon(lat); t.countLatLon(lon); t.countLatLon("35.681123"); } /** * 将平面坐标转成十进制 * @param dushu 35°37′39.55324″ * @return */ public double countLatLon(String dushu) { double tmpd = 0.0 ; if( dushu != null && !"".equals(dushu) ) { //<Latitude>35.37.39.55324</Latitude> //<Longitude>139.44.13.1546</Longitude> String[] tmp = dushu.split("\\."); if(tmp.length==4){ tmpd = Double.parseDouble(tmp[0]); tmpd = tmpd + Double.parseDouble(tmp[1])/60; tmpd = tmpd + Double.parseDouble(tmp[2]+"."+tmp[3])/3600; } else { tmpd = Double.parseDouble(dushu) ; } } System.out.println(tmpd); return tmpd; } }
##############阁下如果是抄袭,爬取文章作恶或误导他人的开发者,请阅读中国现行法律的相关处罚条例再动手,转载之前最好先验证#############