@@ -6,22 +6,17 @@ function wkb2geom(buff, crs)
66 byteswap = isone (read (buff, UInt8)) ? ltoh : ntoh
77 wkbtype = read (buff, UInt32)
88 # Input variants of WKB supported are standard, extended, and ISO WKB geometry with Z dimensions (M/ZM not supported)
9- if CoordRefSystems. ncoords (crs) == 3
10- # SQL/MM Part 3 and SFSQL 1.2 use offsets of 1000 (Z), 2000 (M) and 3000 (ZM)
11- # to indicate the present of higher dimensional coordinates in a WKB geometry
12- if wkbtype >= 1001 && wkbtype <= 1007
13- # the SFSQL 1.2 offset of 1000 (Z) is present and subtracting a round number of 1000 gives the standard WKB type
14- wkbtype -= 1000
15- # 99-402 was a short-lived extension to SFSQL 1.1 that used a high-bit flag to indicate the presence of Z coordinates in a WKB geometry
16- # the high-bit flag 0x80000000 for Z (or 0x40000000 for M) is set and masking it off gives the standard WKB type
17- elseif wkbtype > 0x80000000
18- # the SFSQL 1.1 high-bit flag 0x80000000 (Z) is present and removing the flag reveals the standard WKB type
19- wkbtype -= 0x80000000
20- else
21- @error " Unsupported WKB Geometry Type with M or ZM dimension encoding: $wkbtype "
22- end
9+ # SQL/MM Part 3 and SFSQL 1.2 use offsets of 1000 (Z), 2000 (M) and 3000 (ZM)
10+ # to indicate the present of higher dimensional coordinates in a WKB geometry
11+ if wkbtype >= 1001 && wkbtype <= 1007
12+ # the SFSQL 1.2 offset of 1000 (Z) is present and subtracting a round number of 1000 gives the standard WKB type
13+ wkbtype -= UInt32 (1000 )
14+ # 99-402 was a short-lived extension to SFSQL 1.1 that used a high-bit flag to indicate the presence of Z coordinates in a WKB geometry
15+ # the high-bit flag 0x80000000 for Z (or 0x40000000 for M) is set and masking it off gives the standard WKB type
16+ elseif wkbtype > 0x80000000
17+ # the SFSQL 1.1 high-bit flag 0x80000000 (Z) is present and removing the flag reveals the standard WKB type
18+ wkbtype -= 0x80000000
2319 end
24-
2520 if wkbtype <= 3
2621 # 0 - 3 [Geometry, Point, Linestring, Polygon]
2722 wkb2single (buff, crs, wkbtype, byteswap)
0 commit comments