Http://www.makaidong.com/%E5%8D%9A%E5%AE%A2%E5%9B%AD%E7%89%9B/31781.shtml
Recently do Baidu map API-related application development, need to overlay their maps to Baidu map above, to see the official Baidu API description of the JavaScript section, do not have a good explanation of how to cover the interface.
Looking for relevant articles on the Internet to see the next, (http://www.makaidong.com/jz1108/archive/2011/10/08/2202239.html) This article to achieve this Chettu function, but the latest Baidu The highest scaling level of 19, the project needs, but only their own to write a map development tools.
Refer to another article by the same author (http://www.makaidong.com/jz1108/archive/2011/07/02/2095376.html), specifically speaking of Baidu coordinate system development.
Program is implemented in Java Web, struts 2 file tag and simple JS call.
Implementing Core Code
1.tileutils.java
1 package Com.xiefei.core;
2 3 Import java.awt.graphics2d;
4 Import Java.awt.image;
5 Import Java.awt.toolkit;
6 Import java.awt.transparency;
7 Import Java.awt.image.bufferedimage;
8 Import Java.awt.image.cropimagefilter;
9 Import Java.awt.image.filteredimagesource;
Import Java.awt.image.imagefilter;
Import Java.io.file;
Import Javax.imageio.imageio;
The public class Tileutils {private int minlevel;
the private int maxlevel;
a private int piclevel;
Private double Mercatorx;
Private double mercatory;
private string pic;
private string Savepath; Public Tileutils (string pic, double Mercatorx, double mercatory, string savepath) {26
This.pic = pic;
This.mercatorx = Mercatorx;
This.mercatory = mercatory;
This.savepath = Savepath; Public Tileutils (string pic, int minlevel, int maxlevel, int piclevel, DoubLe Mercatorx, double mercatory, string savepath) {this.pic = pic;
This.minlevel = MinLevel;
This.maxlevel = Maxlevel;
Panax Notoginseng This.mercatorx = Mercatorx;
This.mercatory = mercatory;
This.savepath = Savepath;
This.piclevel = Piclevel; Cutterall public void () throws exception {(int i = minlevel; I <= maxlevel; i++)
{Cutterone (i); Cutterone (int level) throws exception {50//pixel coordinates of the center of the picture (Pixelx,pix Ely), the picture Center plane coordinates namely the magic Cato coordinates (Mercatorx, mercatory) 51//pixel coordinates = plane coordinates * MATH.POW (2, level-18) Double Pixelx
= Mercatorx * MATH.POW (2, level-18);
Double pixely = mercatory * MATH.POW (2, level-18);
System.out.println ("Pixelx:" + pixelx);
System.out.println ("pixely:" + pixely); BufferedImage bi = imageio.read (