我有一组坐标,并且有一个纬度为经度的点。我想弄清楚该点是否在该地理区域内。我正在使用https://github.com/d3/d3-geo#geoContains来做到这一点,但它返回的是false。我确实使用Google地图验证了经纬度是否在这些坐标内。
这是我的代码:
var d3Geo = require("d3-geo");
var zone = {
type: "Point",
coordinates: [
[
[-79.3998080492026, 43.67425448858397],
[-79.40088093280858, 43.67444072651661],
[-79.4027692079552, 43.67568229796387],
[-79.4070607423783, 43.674720082331845],
[-79.40894901752404, 43.674378647270174],
[-79.40937817096662, 43.67409928986548],
[-79.41418468952044, 43.67301288759574],
[-79.4213515520071, 43.671491891377556],
[-79.41933453082869, 43.666556148372024],
[-79.4158583879453, 43.667270148884725],
[-79.41345512866887, 43.667797882936135],
[-79.41233932971834, 43.664848721403594],
[-79.41141664981686, 43.66234958164444],
[-79.41021502017816, 43.662597948015225],
[-79.41034376621083, 43.66312572314246],
[-79.40768301486901, 43.66362244843536],
[-79.40532267093619, 43.66411916961763],
[-79.40279066562613, 43.66461588669057],
[-79.40266191959346, 43.66466245370542],
[-79.40055906772598, 43.66511259965352],
[-79.39914286136647, 43.66545408743106],
[-79.39989387989165, 43.66745640849134],
[-79.3973618745816, 43.66801518384336],
[-79.39753353595881, 43.668170398296205],
[-79.3998080492026, 43.67425448858397]
]
]
};
var hotel = [-79.4188145, 43.6528584];
console.log(
"The hotel is contained in area " +
d3Geo.geoContains(zone, hotel)
);
我不知道自己在做什么错?