GIS 演算法,計算箭頭

2021-06-04 04:48:53 字數 1604 閱讀 5547

根據兩個點,計算箭頭。

var x2 = points[length - 1].x;

var y2 = points[length - 1].y;

var x1 = points[length - 2].x;

var y1 = points[length - 2].y;

var distance = math.sqrt(math.pow((x2 - x1),2) + math.pow((y2 - y1),2));

var yb = y2 - s * (x2 - x1) / (math.sqrt2 * distance) + s * (y1 - y2) / (math.sqrt2 * distance);

var xb = x2 - s * (x2 - x1) / (math.sqrt2 * distance) - s * (y1 - y2) / (math.sqrt2 * distance);

var ya = y2 + s * (x2 - x1) / (math.sqrt2 * distance) + s * (y1 - y2) / (math.sqrt2 * distance);

var xa = x2 - s * (x2 - x1) / (math.sqrt2 * distance) + s * (y1 - y2) / (math.sqrt2 * distance);

feature.geometry.components.push(new openlayers.geometry.point(xa, ya));

feature.geometry.components.push(new openlayers.geometry.point(x2, y2));

feature.geometry.components.push(new openlayers.geometry.point(xb, yb));

/*var x1 = points[length - 1].x;

var y1 = points[length - 1].y;

var x2 = points[length - 2].x;

var y2 = points[length - 2].y;

if (x2 != x1)

var angler = angle + math.pi / 4;

}else

} else

}else

}} else

var xn1 = x1 + s * math.sin(anglel);

var yn1 = y1 + s * math.cos(anglel);

var xn2 = x1 + s * math.sin(angler);

var yn2 = y1 + s * math.cos(angler);

feature.geometry.components.push(new openlayers.geometry.point(xn1, yn1));

feature.geometry.components.push(new openlayers.geometry.point(x1, y1));

feature.geometry.components.push(new openlayers.geometry.point(xn2, yn2));*/

GIS 計算面積

做了好一陣子專案,每每要算面積總是怪自己記憶甚差,又忘了怎麼做,作為乙個gis門外漢把解決過程記錄一次,希望幫助和我一樣初入門就被卡住的小夥伴。一開始總用偷懶的方式不想轉換投影座標,直接在field用計算器算 記得選python shape.geodesicarea squarekilometers...

GIS開發 分享常用的gis演算法(C )

在系統開發中,有時會用到一些常用的空間演算法,引用一些類庫是可以解決問題,但是有時類庫的執行效率比較慢,引用的東西比較多,如果需要的方法不多,可以寫一些簡單的計算方法。下邊分享幾個常用的gis計算方法 判斷點是否在麵裡 public bool ispointinpolygon listpoly,cv...

gis 向量切片讀取 GIS向量切片演算法

structtilestructure public classvectortiletool listtiles publicvectortiletool public bool seprateshplayer string sourcepath,string resultfolder,intlev...