谁可以帮我下载shader forge 下载1.7.10。我不会。急急急

you have been blocked经由过程百度地图API,将百度坐标转换成GPS经纬度 - 博客频道 - CSDN.NET
zh521lili的专栏
分类:java
百度地图API中,有GPS坐标转百度坐标的功能
/wiki/static/map/API/examples/?v=1.2&0_6#0&6
http接口是:http://api./ag/coord/convert?=0&to=4&x=116.397428&y=39.90923&callback=BMap.Convertor.cbk_7594
返回成果坐标是经由过程base64加密的。
这个转换算法百度是不会公开的,并且百度也没有供给百度坐标转成GPS坐标功能,这里我用了取巧的办法。
百度坐标和GPS坐标转换在很近的间隔时误差很是接近。
假设你有百度坐标:x1=116.397428,y1=39.90923
把这个坐标当成GPS坐标,经由过程接口获得他的百度坐标:x2=116.,y2=39.
经由过程策画就可以获得GPS的坐标:
x = 2*x1-x2,y = 2*y1-y2
在/wiki/static/map/API/examples/?v=1.2&0_6#0&6 将此坐标输入GPS数据项中获得的成果是:116.,39.
代码实现:
package com.baidu.
import it.sauronsoftware.base64.Base64;
import java.io.ByteArrayOutputS
import java.io.InputS
import java.net.HttpURLC
import java.net.URL;
import org.json.JSONO
//import javabase.gps2baidu.JSONO
public class Gps2BaiDu {
&public static void main(String[] args) {
&&// 转换前的GPS坐标
&&double x = 116.;
&&double y = 39.;
&&// 获得gps坐标
&&double[] gps = baidu2Gps(x, y);
&&System.out.println(&gps坐标& + gps[0] + & & + gps[1]);
&&// gps坐标 转换 百度坐标
&&double[] baidu = gps2Baidu(gps[0],gps[1]);
&&System.out.println(&百度地图:& + baidu[0] + & & + baidu[1]);
& * baidu坐标 转 gps坐标
& * @param x
& * @param y
& * @return
&static double[] baidu2Gps(double x, double y) {
&&double[] baidu2Gps = gps2Baidu(x, y);
&&double x1 = baidu2Gps[0];
&&double y1 = baidu2Gps[1];
&&double gps_x = 2 * x - x1;
&&double gps_y = 2 * y - y1;
&&baidu2Gps[0] = gps_x;
&&baidu2Gps[1] = gps_y;
&&return baidu2G
&// gps 坐标转换成 百度坐标
&static double[] gps2Baidu(double x, double y) {
&&double[] zuobiao = new double[2];
&&// gps坐标的type=0
&&// google坐标的type=2
&&// baidu坐标的type=4
&&String path = &=&
&&&&+ x + &&y=& + y + &&callback=BMap.Convertor.cbk_7594 &;
&&&// 使用http请求获取转换结果
&&&URL url = new URL(path);
&&&HttpURLConnection conn = (HttpURLConnection) url.openConnection();
&&&conn.setRequestMethod(&GET&);
&&&conn.setConnectTimeout(5 * 1000);
&&&InputStream inStream = conn.getInputStream();
&&&ByteArrayOutputStream outStream = new ByteArrayOutputStream();
&&&byte[] buffer = new byte[1024];
&&&int len = 0;
&&&while ((len = inStream.read(buffer)) != -1) {
&&&&outStream.write(buffer, 0, len);
&&&// 得到返回的结果
&&&String res = outStream.toString();
&&&// 处理结果
&&&if (res.indexOf(&(&) & 0 && res.indexOf(&)&) & 0) {
&&&&String str = res.substring(res.indexOf(&(&) + 1,
&&&&&&res.indexOf(&)&));
&&&&String err = res.substring(res.indexOf(&error&) + 7,
&&&&&&res.indexOf(&error&) + 8);
&&&if (res.indexOf(&(&) & 0 && res.indexOf(&)&) & 0) {
&&&&String str = res.substring(res.indexOf(&(&) + 1,
&&&&&&res.indexOf(&)&));
&&&&String err = res.substring(res.indexOf(&error&) + 7,
&&&&&&res.indexOf(&error&) + 8);
&&&&if (&0&.equals(err)) {
&&&&&JSONObject js = new JSONObject(str);
&&&&&// 编码转换
&&&&&String x1 = new String(Base64.decode(js.getString(&x&)));
&&&&&String y1 = new String(Base64.decode(js.getString(&y&)));
&&&&&zuobiao[0] = Double.parseDouble(x1);
&&&&&zuobiao[1] = Double.parseDouble(y1);
&&} catch (Exception e) {
&&&e.printStackTrace();
*&& 做完之后测试了一下,误差在20米以内,如果有更精确的算法,希望大家能多多交流
排名:千里之外
(11)(0)(0)(1)(1)(1)(1)(1)Delphi百度地图经纬度与地址互转
4,444views
用Delphi实现百度地图经纬度与地址互转
通过百度地图Geocoding API
json示例:
这里用的是返回xml格式,使用的是XMLDocument控件
主要代码:
procedure TForm1.Button1Click(Sender: TObject);
url: string;
url := 'http:
'&callback=renderReverse&location=' + Edit2.Text + ',' + Edit3.Text +
'&output=xml&pois=1';
XMLDocument1.LoadFromFile(url);
Memo1.Lines := XMLDocument1.X
Memo2.Lines.Add(XMLDocument1.DocumentElement.ChildNodes['result'].ChildNodes
['formatted_address'].NodeValue);
演示视频:
完整源码:
用 微信 OR 支付宝 扫描二维码
为本文作者 打个赏
金额随意 快来“打”我呀~
这个程序用不了呢?这个前面的怎么定义呢?
支付宝扫一扫,支持我们!
Copyright & 2017 | All Rights Reserved | Powered by你正在使用的浏览器版本过低,将不能正常浏览和使用知乎。调用百度地图API实现地址到经纬度信息的转换
var map = new BMap.Map("container");
map.centerAndZoom(new BMap.Point(115.404, 39.915), 11);
ggxy = function (){
& & // 创建地址解析器实例
& & var myGeo = new
BMap.Geocoder();
& & var myAddr =
document.getElementByIdx_x_x("ggX").
& & var myCity =
document.getElementByIdx_x_x("ggY").
& & myGeo.getPoint(myAddr,
translateCallback, myCity);
translateCallback = function (point){
& & if (point) {
& map.centerAndZoom(point, 16);
& map.addOverlay(new BMap.Marker(point));
& document.getElementByIdx_x_x("longtitude").value =
"" + point.
& document.getElementByIdx_x_x("latitude").value = ""
一个应用位置的例子:
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 codeforge破解下载器 的文章

 

随机推荐