Benutzer-Werkzeuge

Webseiten-Werkzeuge


wms-tk50

var DEG2RAD=0.0174532922519943; var PI=3.14159267;

function GK4(x,y) {

this.x = x; //Hochwert
this.y = y; //Rechtswert

}

function LatLng2GK4(lat,lng) {

// lat = Breite, lon = Länge
// sy = Zielsystemnummer (Meridiankennziffer)
var e2 = 0.0067192188;
var c = 6398786.849;
var sy = 4;

var bf = lat /  (180/PI);
var g = 111120.61962 * lat - 15988.63853 * Math.sin(2*bf) + 16.72995 * Math.sin(4*bf) - 0.02178 * Math.sin(6*bf) + 0.00003 * Math.sin(8*bf);
var co = Math.cos(bf);
var g2 = e2 * (co * co);
var g1 = c / Math.sqrt(1+g2);
var t = Math.sin(bf) / Math.cos(bf); 
var dl = lng - sy * 3;
var fa = co * dl / (180/PI);
var y = g + fa * fa * t * g1 / 2 + fa * fa * fa * fa * t * g1 * (5 - t * t + 9 * g2) / 24;
var rm = fa * g1 + fa * fa * fa * g1 * (1 - t * t + g2) / 6 + fa * fa * fa * fa * fa * g1 * (5 - 18 * t * t * t * t * t * t) / 120;
var x = rm + sy * 1000000 + 500000;
return new GK4(x+110,y+100);

}

function myLatLng2GK4(lat,lng) {

// lat = Breite, lon = Länge
var B = lat * DEG2RAD;
var L = (lng-12.0) * DEG2RAD;
// Bessel
//var aa = 6377397.155;
//var bb = 6356078.96282;
// WGS-84
var aa = 6378137.0;
var bb = 6356752.31424;
var eps = Math.sqrt(aa*aa-bb*bb);
var e = eps/aa;
var W = Math.sqrt(1.0 - e*e*Math.sin(B)*Math.sin(B));
var N = aa/W;
var x = N*Math.cos(B)*Math.cos(L);
var y = N*Math.cos(B)*Math.sin(L);
return new GK4(x,y + 4500000);

}

CustomGetTileUrl=function(a,b,c) {

if(this.layers=="TK50" && (b<13)) {
  return "";
}
if(this.layers=="TK50" && (b>16)) {
  return "";
}
if(this.layers=="UK500" && (b<10)) {
  return "";
}
if(this.layers=="UK500" && (b>12)) {
  return "";
}
//Bbox LatLong
if (typeof(window['this.myStyles'])=="undefined") this.myStyles="";
var lULP = new GPoint(a.x*256,(a.y+1)*256);
var lLRP = new GPoint((a.x+1)*256,a.y*256);
var lUL = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lULP,b,c);
var lLR = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lLRP,b,c);
var cc = this.mymap.getCenter();
//Rotationswinkel im Kartenzentrum ermitteln
var gkcc = LatLng2GK4(cc.y,cc.x);
var gkcc2 = LatLng2GK4(cc.y,cc.x+0.00001);
var dx = gkcc2.x-gkcc.x;
var dy = gkcc2.y-gkcc.y;
var rot = Math.atan(dy/dx); 
rot = rot - 0.5*DEG2RAD; // Korrektur 
var COS_PHI=Math.cos(rot); 
var SIN_PHI=Math.sin(rot);
//BBox um Zentrum der Karte rotieren (Lageanpassung an Gauß-Krüger)
var rx = (lUL.x - cc.x);
var ry = (lUL.y - cc.y);
lUL.x = COS_PHI*rx + SIN_PHI*ry + cc.x;
lUL.y = - SIN_PHI*rx + COS_PHI*ry + cc.y;
rx = (lLR.x - cc.x);
ry = (lLR.y - cc.y);
lLR.x = COS_PHI*rx + SIN_PHI*ry + cc.x;
lLR.y = - SIN_PHI*rx + COS_PHI*ry + cc.y;
//Bbox von LatLng nach GK4 transformieren
var lUL_GK = LatLng2GK4(lUL.y, lUL.x);
var lLR_GK = LatLng2GK4(lLR.y, lLR.x);

document.write(lUL.x+„, “+lUL.y+„ → “ + lUL_GK.x + „, “ + lUL_GK.y + „<br>“); var lBbox=lUL_GK.x+„,“+lUL_GK.y+„,“+lLR_GK.x+„,“+lLR_GK.y; if (this.transparent != „TRUE“) {this.transparent = „FALSE“; } var lURL=this.baseurl; lURL+=„&REQUEST=GetMap“; lURL+=„&SERVICE=WMS“; lURL+=„&VERSION=1.1.1“; lURL+=„&LAYERS=“+this.layers; lURL+=„&STYLES=“+this.myStyles; lURL+=„&FORMAT=image/png“; lURL+=„&BGCOLOR=0xFFFFFF“; lURL+=„&TRANSPARENT=“+this.transparent; lURL+=„&SRS=EPSG:31468“; lURL+=„&BBOX=“+lBbox; lURL+=„&reaspect=false“; if (this.resample==„ON“) { lURL+=„&WIDTH=512“; lURL+=„&HEIGHT=512“; lURL=„http://www.waidlerwiki.de/resize.php?url=“ + escape(lURL); } else { lURL+=„&WIDTH=256“; lURL+=„&HEIGHT=256“; } return lURL; } CustomGetTileUrlEPSG4326=function(a,b,c) { Bbox LatLong

if (typeof(window['this.myStyles'])=="undefined") this.myStyles="";
var lULP = new GPoint(a.x*256,(a.y+1)*256);
var lLRP = new GPoint((a.x+1)*256,a.y*256);
var lUL = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lULP,b,c);
var lLR = G_NORMAL_MAP.getProjection().fromPixelToLatLng(lLRP,b,c);
var lBbox=lUL.x+","+lUL.y+","+lLR.x+","+lLR.y;
      if (this.transparent != "TRUE") {this.transparent = "FALSE"; }
var lURL=this.baseurl;
lURL+="&REQUEST=GetMap";
lURL+="&SERVICE=WMS";
lURL+="&VERSION=1.1.1";
lURL+="&LAYERS="+this.layers;
lURL+="&STYLES="+this.myStyles;
lURL+="&FORMAT=image/png";
lURL+="&BGCOLOR=0xFFFFFF";
lURL+="&TRANSPARENT="+this.transparent;
lURL+="&SRS=EPSG:4326";
lURL+="&BBOX="+lBbox;
lURL+="&reaspect=false";
      if (this.resample=="ON") {
  lURL+="&WIDTH=512";
  lURL+="&HEIGHT=512";
        lURL="http://www.waidlerwiki.de/resize.php?url=" + escape(lURL);
      } else {
  lURL+="&WIDTH=400";
  lURL+="&HEIGHT=400";
      }

document.write(lURL + „<br/>“); return lURL; } function customOpacity() { return this.myOpacity; }

wms-tk50.txt · Zuletzt geändert: 2024/05/27 06:14 von 127.0.0.1