實用的gis座標轉換工具類
package cn.ltsk.util;
import cn.ltsk.entity.gps;
public
class
positionutil
double dlat = transformlat(lon - 105.0, lat - 35.0);
double dlon = transformlon(lon - 105.0, lat - 35.0);
double radlat = lat / 180.0 * pi;
double magic = math.sin(radlat);
magic = 1 - ee * magic * magic;
double sqrtmagic = math.sqrt(magic);
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi);
dlon = (dlon * 180.0) / (a / sqrtmagic * math.cos(radlat) * pi);
double mglat = lat + dlat;
double mglon = lon + dlon;
return
new gps(mglat, mglon);
}// gcj-02 to 84
public
static gps gcj_to_gps84(double lat, double lon)
public
static gps gcj02_to_bd09(double gg_lat, double gg_lon)
public
static gps bd09_to_gcj02(double bd_lat, double bd_lon)
public
static gps bd09_to_gps84(double bd_lat, double bd_lon)
public
static
boolean
outofchina(double lat, double lon)
public
static gps transform(double lat, double lon)
double dlat = transformlat(lon - 105.0, lat - 35.0);
double dlon = transformlon(lon - 105.0, lat - 35.0);
double radlat = lat / 180.0 * pi;
double magic = math.sin(radlat);
magic = 1 - ee * magic * magic;
double sqrtmagic = math.sqrt(magic);
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi);
dlon = (dlon * 180.0) / (a / sqrtmagic * math.cos(radlat) * pi);
double mglat = lat + dlat;
double mglon = lon + dlon;
return
new gps(mglat, mglon);
}public
static
double
transformlat(double x, double y)
public
static
double
transformlon(double x, double y)
//gps轉高德
public
static
double wgs2mars(double wglat, double wglon) // y x
double dlat = transformlat(wglon - 105.0, wglat - 35.0);
double dlon = transformlon(wglon - 105.0, wglat - 35.0);
double radlat = wglat / 180.0 * pi;
double magic = math.sin(radlat);
magic = 1 - ee * magic * magic;
double sqrtmagic = math.sqrt(magic);
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi);
dlon = (dlon * 180.0) / (a / sqrtmagic * math.cos(radlat) * pi);
mglat = wglat + dlat;
mglon = wglon + dlon;
result[0]=mglat;
result[1]=mglon;
return result;
}//gps轉高德 多個點
public
static
double wgs2marsarrs(double xys)
public
static boolean outofchina(double lat, double lon)
public
static
void
main(string args)
}
這裡附上高德座標反查介面:
需要反查的位址」&key=」高德key」&city=」反查位址所在城市」
具體高德key可在進行申請,註冊後在控制台即可獲取key
GIS 中地理座標和螢幕座標的標準轉換方法
在gis中,當你拿到乙個圖層的地理座標後,如果需要繪製到螢幕上,那麼不可避免的需要在地理座標和螢幕座標之間進行轉換,轉換的方法相信每乙個做gis的都會有自己的實現方法,本文描述的是和arcgis wms openlayers完全一致的座標轉換方法,當然這三個工具 標準 指令碼也是採用的相同的方法 因...
三種開源庫實現GIS座標轉換
通過座標系proj4字串建立projpj型別座標系,呼叫pj transform函式實現。其中座標系proj4字串可在proj4 data資料夾中的epsg檔案中搜尋得到。double x dblsrcx double y dblsrcy double z dblsrcz projpj fref,t...
單個點座標座標轉換
需要js版本可以移步coordtransform lng 128.543 lat 37.065 result3 wgs84 to gcj02 lng,lat wgs84座標系 火星座標系 result4 gcj02 to wgs84 lng,lat 火星座標系 wgs84座標系 中文位址到火星座標系...