[英]Leaflet GeoJSON Uncaught TypeError: Cannot read properties of undefined (reading 'x')
[英]Uncaught TypeError: Cannot read properties of undefined (reading 'x')
我正在使用 react 编写应用程序,但出现此错误 - Uncaught TypeError: Cannot read properties of undefined (reading 'x') at calculateIntersectionX。 当限制常数中有合法的 x 部分时,我真的不知道为什么会收到此错误。
const limits = [
{ x: 12.3456777, y: -12.3456777 },
{ x: 12.3456777, y: -12.3456777 },
{ x: 12.3456777, y: -12.3456777 },
];
for (var i = 0; i < limits.length; i++) {
for (var g = 0; g < limits.length; i++) {
if (limits[i] != limits[g]) {
let a1 = limits[i];
let a2 = limits[g];
calculateIntersectionX(avgfakex1, avgfakex2, a1, a2);
calculateIntersectionY(avgfakey1, avgfakey2, a1, a2);
}
}
}
function calculateIntersectionX(p1, p2, p3, p4) {
var c2x = p3.x - p4.x; // (x3 - x4)
var c3x = p1.x - p2.x; // (x1 - x2)
var c2y = p3.y - p4.y; // (y3 - y4)
var c3y = p1.y - p2.y; // (y1 - y2)
我认为你必须改变:
考虑修复这些,也许它会帮助你弄清楚:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.