java类中怎么根据经纬度获取地址

java类中怎么根据经纬度获取地址,第1张

思路是:通过传入地址作为参数拼接url调用百度地图,然后解析返回的页面,提取经纬度坐标

以下为具体步骤

1、修改excel表中的属性名(方便后面用查询读取)然后倒入到数据库。

2、代码实现

#网上搜来的

# 高斯坐标转经纬度算法 # B=大地坐标X # C=大地坐标Y  # IsSix=6度带或3度带

import math

def GetLatLon2(B, C,IsSix):

#带号

D = mathtrunc( C/ 1000000)

#中央经线(单位:弧度)

K = 0

if IsSix:

K = D 6 - 3 #6度带计算

else:

K = D 3 #3度带计算

L = B/(6378245(1-0006693421623)10050517739)

M = L +(000506237764 mathsin(2L)/2-000001062451mathsin(4L)/4+00000002081mathsin(6L)/6)/10050517739

N = L +(000506237764 mathsin(2M)/2-000001062451mathsin(4M)/4+00000002081mathsin(6M)/6)/10050517739

O = L +(000506237764 mathsin(2N)/2-000001062451mathsin(4N)/4+00000002081mathsin(6N)/6)/10050517739

P = L +(000506237764 mathsin(2O)/2-000001062451mathsin(4O)/4+00000002081mathsin(6O)/6)/10050517739

Q = L +(000506237764 mathsin(2P)/2-000001062451mathsin(4P)/4+00000002081mathsin(6P)/6)/10050517739

R = L +(000506237764 mathsin(2Q)/2-000001062451mathsin(4Q)/4+00000002081mathsin(6Q)/6)/10050517739

S = mathtan(R)

T = 0006738525415(mathcos(R))2

U = 6378245/mathsqrt(1-0006693421623(mathsin(R))2)

V = 6378245(1-0006693421623)/(mathsqrt((1-0006693421623(mathsin(R))2)))3

W = 5+3S2+T-9TS2

X = 61+90S2+45S4

Y = 1+2S2+T2

Z = 5+28S2+24S4+6T+8TS2

Lat= (180/mathpi)(R-(C-D1000000-500000)2S/(2VU)+(C-D1000000-500000)4W/(24U3V)-(C-D1000000-500000)6X/(7200U5V))

Lon= (180/mathpi)(C-D1000000-500000)(1-(C-D1000000-500000)2Y/(6U2)+(C-D1000000-500000)4Z/(120U4))/(Umathcos(P))

Lat = Lat

Lon = K + Lon

return (Lon, Lat)

以上就是关于java类中怎么根据经纬度获取地址全部的内容,包括:java类中怎么根据经纬度获取地址、python将高斯坐标转换经纬度 经纬度坐标与高斯坐标的转换代码、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9792680.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-02
下一篇 2023-05-02

发表评论

登录后才能评论

评论列表(0条)

保存