-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Foundation | ||
import MVTTools | ||
|
||
/* | ||
```console | ||
# Download from MapLibre a vector tile at zoom 2, with an extent showing Norway to India | ||
wget https://demotiles.maplibre.org/tiles/2/2/1.pbf | ||
``` | ||
*/ | ||
//: Set the path to the `.pbf` file in `<playground>/Resources` | ||
let playgroundFile = "maplibre.org_2_2_1.pbf" | ||
let fileURL = Bundle.main.url(forResource: playgroundFile, withExtension: nil)! | ||
let mvtData = try Data(contentsOf: fileURL) | ||
|
||
//: Load tile using MVT | ||
let tile = VectorTile(data: mvtData, x: 2, y: 1, z: 2, indexed: .hilbert)! | ||
|
||
//: Inspect the properties of the `VectorTile` | ||
tile.isIndexed | ||
tile.projection | ||
|
||
print(tile.layerNames.sorted()) | ||
//: ### MapLibre ZXY = 2/2/1 — Layers: ["centroids", "countries", "geolines"] | ||
//: ![](maplibre.org_2_2_1.png) | ||
//: --- | ||
//: ### OpenStreetMap ZXY = 2/2/1 | ||
//: ![](openstreetmap.org_2_2_1.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
wget https://demotiles.maplibre.org/tiles/2/2/1.pbf |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<playground version='5.0' target-platform='macos' display-mode='rendered' buildActiveScheme='true' importAppTypes='true'> | ||
<timeline fileName='timeline.xctimeline'/> | ||
</playground> |