地图研究

地图应用知识大汇总:

1.0 百度坐标、经纬度坐标得到像素坐标在计算得到瓦片编号

http://www.cnblogs.com/jz1108/archive/2011/07/02/2095376.html


http://www.jiazhengblog.com/blog/2011/07/02/289/


2.0 离线百度地图怎么实现?

https://blog.csdn.net/sunsijia21983/article/details/78602746


3.0 下载瓦片的代码:

public static void main(String[] args)  
	        throws Exception  
	    {  
	        String link =  
	            "http://online3.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&udt=20170712&scaler=1&p=1";  
	        int z = 18;//层级  
	        int xmin = 50617;//x最小值  1552
	        int xmax = 50617;//x最大值   1671
	        int ymin = 18851;//y最小值   492
	        int ymax = 18851;//y最大值   569
	        int c = 0;//成功数  
	        int fail = 0;//失败数量  
	        for (int i = xmin; i <= xmax; i++)  
	        {  
	            for (int j = ymin; j <= ymax; j++)  
	            {  
	                try  
	                {  
	                    URL url = new URL(link.replace("{x}", i + "").replace("{y}", j + "").replace("{z}", z + ""));  
	                    HttpURLConnection conn = (HttpURLConnection)url.openConnection();  
	                    conn.setConnectTimeout(100);  
	                    conn.connect();  
	                    InputStream in = conn.getInputStream();  
	                    File dir = new File("d:/mybaidumapdownload1/tiles/" + z + "/" + i);  
	                    if (!dir.exists())  
	                    {  
	                        dir.mkdirs();  
	                    }  
	                    File file = new File("d:/mybaidumapdownload1/tiles/" + z + "/" + i + "/" + j + ".png");  
	                    if (!file.exists())  
	                    {  
	                        file.createNewFile();  
	                    }  
	                    OutputStream out = new FileOutputStream(file);  
	                    byte[] bytes = new byte[1024 * 20];  
	                    int len = 0;  
	                    while ((len = in.read(bytes)) != -1)  
	                    {  
	                        out.write(bytes, 0, len);  
	                    }  
	                    out.close();  
	                    in.close();  
	                    System.out.println("已成功下载:" + z + "_" + i + "_" + j + ".png");  
	                  
	                }catch(Throwable t) {
	                	t.printStackTrace();  
	                }
	            }
	          }
	    }

4.0 瓦片编号计算

https://www.cnblogs.com/xiaozhi_5638/p/4748186.html

阅读更多
文章标签: 地图
个人分类: 地图应用开发
上一篇java实现串口通信的方法
下一篇Lambda表达式详细解答
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭