diff --git a/Package.resolved b/Package.resolved index 83279f2..1d132d2 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,7 +6,7 @@ "location" : "https://github.com/Outdooractive/gis-tools", "state" : { "branch" : "45_feature_id_overflow", - "revision" : "4e74243416460049a927008a0e515001f3132566" + "revision" : "1cb8776f353dfd0b938251b1eb12ec6ddbb5f44c" } }, { diff --git a/Tests/MVTToolsTests/TestData/bigint_id.geojson b/Tests/MVTToolsTests/TestData/bigint_id.geojson new file mode 100644 index 0000000..a82ebc4 --- /dev/null +++ b/Tests/MVTToolsTests/TestData/bigint_id.geojson @@ -0,0 +1,37 @@ +{ + "bbox" : [ + -120.37960052490236, + 34.045263375550654, + -120.37960052490236, + 34.045263375550654 + ], + "geometry" : { + "coordinates" : [ + -120.37960052490236, + 34.045263375550654 + ], + "type" : "Point" + }, + "id" : 18446744073638380036, + "properties" : { + "class" : "island", + "name" : "San Miguel Island", + "name_de" : "San Miguel Island", + "name_en" : "San Miguel Island", + "name_int" : "San Miguel Island", + "name:ca" : "illa San Miguel", + "name:de" : "San Miguel Island", + "name:en" : "San Miguel Island", + "name:es" : "Isla San Miguel", + "name:et" : "San Migueli saar", + "name:fr" : "île San Miguel", + "name:it" : "Isola di San Miguel", + "name:ja" : "サンミゲル島 (チャンネル諸島)", + "name:latin" : "San Miguel Island", + "name:nl" : "San Miguel Island", + "name:pl" : "San Miguel Island", + "name:zh" : "聖米格爾島", + "rank" : 3 + }, + "type" : "Feature" +} diff --git a/Tests/MVTToolsTests/VectorTileTests.swift b/Tests/MVTToolsTests/VectorTileTests.swift index 0f1d19f..e4a589b 100644 --- a/Tests/MVTToolsTests/VectorTileTests.swift +++ b/Tests/MVTToolsTests/VectorTileTests.swift @@ -111,4 +111,19 @@ final class VectorTileTests: XCTestCase { XCTAssertEqual(tile1.features(for: "test2")!.count, 1) } + func testEncodeDecodeBigInt() throws { + let feature = try XCTUnwrap(Feature(jsonData: TestData.dataFromFile(name: "bigint_id.geojson"))) + XCTAssertEqual(feature.id, .uint(18446744073638380036)) + + var tile = try XCTUnwrap(VectorTile(x: 10, y: 25, z: 6)) + tile.setFeatures([feature], for: "test") + let tileData = try XCTUnwrap(tile.data()) + XCTAssertFalse(tileData.isEmpty) + + let tile2 = try XCTUnwrap(VectorTile(data: tileData, x: 10, y: 25, z: 6)) + let feature2: Feature = try XCTUnwrap(tile2.features(for: "test")?.first) + + XCTAssertEqual(feature.id, feature2.id) + } + }