将传单 geojsonFeature 对象的坐标数组从十进制值转换为整数值
Convert leaflet geojsonFeature object's coordinates array from decimal to integer values
我需要 convert/display 多个对象中的传单坐标从十进制到整数值,以便在 turfjs 方法中使用它:
https://www.npmjs.com/package/@turf/boolean-point-in-polygon
coord = geojsonFeature.geometry.coordinates:
{type: "D", designator: "EPD53A", availabilities: Array(1), info: Array(2), geometry: {…}}
{type: "TRA", designator: "EPTR105", availabilities: Array(1), info: Array(2), geometry: {…}}
{type: "D", designator: "UMD192", availabilities: Array(1), info: Array(2), geometry: {…}}
(...)
geometry:
type: "Polygon"
coordinates: Array(1)
0: Array(8):
0: (2) [16.845, 54.587777778]
1: (2) [16.647777778, 54.515]
2: (2) [16.545277778, 54.543611111]
(...)
有什么简单的方法吗? (angular/typescript)
我正在尝试检查点击点是否位于两个或多个图层多边形上。我真的需要将此值转换为整数吗?
var pt2 = turf.point([22.65380859375, 49.710272582105695]);
var multiPoly = turf.multiPolygon([[[
[22.828611111111112, 49.68472222222222],
[23.065833333333334, 49.9],
[23.20861111111111, 49.843333333333334],
[22.98611111111111, 49.650555555555556],
[22.828611111111112, 49.68472222222222],
[22.828611111111112, 49.68472222222222],
[22.828611111111112, 49.68472222222222]
]]]);
console.log("test-turf",turf.booleanPointInPolygon(pt2, multiPoly));
它returns假
所有 TurfJS 方法都接受(格式良好的)GeoJSON 作为输入。坐标不需要使用整数值。
It returns false
你对 boolanPointInPolygon
returns 的调用是错误的,因为那个点在那个多边形之外:
我需要 convert/display 多个对象中的传单坐标从十进制到整数值,以便在 turfjs 方法中使用它:
https://www.npmjs.com/package/@turf/boolean-point-in-polygon
coord = geojsonFeature.geometry.coordinates:
{type: "D", designator: "EPD53A", availabilities: Array(1), info: Array(2), geometry: {…}}
{type: "TRA", designator: "EPTR105", availabilities: Array(1), info: Array(2), geometry: {…}}
{type: "D", designator: "UMD192", availabilities: Array(1), info: Array(2), geometry: {…}}
(...)
geometry:
type: "Polygon"
coordinates: Array(1)
0: Array(8):
0: (2) [16.845, 54.587777778]
1: (2) [16.647777778, 54.515]
2: (2) [16.545277778, 54.543611111]
(...)
有什么简单的方法吗? (angular/typescript)
我正在尝试检查点击点是否位于两个或多个图层多边形上。我真的需要将此值转换为整数吗?
var pt2 = turf.point([22.65380859375, 49.710272582105695]);
var multiPoly = turf.multiPolygon([[[
[22.828611111111112, 49.68472222222222],
[23.065833333333334, 49.9],
[23.20861111111111, 49.843333333333334],
[22.98611111111111, 49.650555555555556],
[22.828611111111112, 49.68472222222222],
[22.828611111111112, 49.68472222222222],
[22.828611111111112, 49.68472222222222]
]]]);
console.log("test-turf",turf.booleanPointInPolygon(pt2, multiPoly));
它returns假
所有 TurfJS 方法都接受(格式良好的)GeoJSON 作为输入。坐标不需要使用整数值。
It returns false
你对 boolanPointInPolygon
returns 的调用是错误的,因为那个点在那个多边形之外: