Skip to content

Commit 2ba2962

Browse files
committed
Spatial
1 parent 39d6689 commit 2ba2962

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/e2e/Adapter/Scopes/SpatialTests.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,22 @@ public function testSpatialTypeDocuments(): void
138138
'notIntersects' => Query::notIntersects('pointAttr', [[1.0, 1.0]])
139139
];
140140

141+
$result = $database->find($collectionName);
142+
143+
function decodePoint(string $wkb): array {
144+
// WKB format: 1-byte byte order + 4-byte type + 8-byte X + 8-byte Y
145+
// Skip first 5 bytes (1 byte byte order + 4 bytes type)
146+
$coords = unpack('dX/dY', substr($wkb, 5, 16));
147+
return ['lon' => $coords['X'], 'lat' => $coords['Y']];
148+
}
149+
150+
// Example usage:
151+
$pointBinary = "\000\000\000\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000@";
152+
$coords = decodePoint($pointBinary);
153+
print_r($coords);
154+
155+
var_dump($result);
156+
$this->assertEquals(999,888);
141157
foreach ($pointQueries as $queryType => $query) {
142158
$result = $database->find($collectionName, [$query], Database::PERMISSION_READ);
143159
$this->assertNotEmpty($result, sprintf('Failed spatial query: %s on pointAttr', $queryType));

0 commit comments

Comments
 (0)