Skip to content

Commit

Permalink
Merge pull request #22 from PDOK/fix-pbf-extension
Browse files Browse the repository at this point in the history
fix .pbf
  • Loading branch information
roelarents authored Jun 8, 2023
2 parents 772bbfd + f28c3ac commit 3521e48
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ogc/tiles/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func (t *Tiles) Tile() http.HandlerFunc {
" Mapbox Vector Tiles (?f=mvt) tiles are supported", http.StatusBadRequest)
return
}
} else {
tileCol = tileCol[:len(tileCol)-4] // remove .pbf extension
}

// ogc spec is (default) z/row/col but tileserver is z/col/row (z/x/y)
Expand Down
19 changes: 17 additions & 2 deletions ogc/tiles/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ func TestTiles_Tile(t *testing.T) {
},
},
{
name: "NetherlandsRDNewQuad/5/10/15.pbf",
name: "NetherlandsRDNewQuad/5/10/15",
fields: fields{
configFile: "ogc/tiles/testdata/config_minimal_tiles.yaml",
url: "http://localhost:8080/tiles/:tileMatrixSetId/:tileMatrix/:tileRow/:tileCol.pbf",
url: "http://localhost:8080/tiles/:tileMatrixSetId/:tileMatrix/:tileRow/:tileCol",
tileMatrixSetID: "NetherlandsRDNewQuad",
tileMatrix: "5",
tileRow: "10",
Expand All @@ -158,6 +158,21 @@ func TestTiles_Tile(t *testing.T) {
statusCode: http.StatusBadRequest,
},
},
{
name: "NetherlandsRDNewQuad/5/10/15.pbf",
fields: fields{
configFile: "ogc/tiles/testdata/config_minimal_tiles.yaml",
url: "http://localhost:8080/tiles/:tileMatrixSetId/:tileMatrix/:tileRow/:tileCol",
tileMatrixSetID: "NetherlandsRDNewQuad",
tileMatrix: "5",
tileRow: "10",
tileCol: "15.pbf",
},
want: want{
body: "/NetherlandsRDNewQuad/5/15/10.pbf",
statusCode: http.StatusOK,
},
},
{
name: "different uriTemplateTiles",
fields: fields{
Expand Down
2 changes: 1 addition & 1 deletion ogc/tiles/templates/tiles/NetherlandsRDNewQuad.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h1 class="title">NetherlandsRDNewQuad</h1>
tile-url="{{ .Config.BaseURL }}/tiles/NetherlandsRDNewQuad"
zoom="12"
center-x="5.3896944" center-y="52.1562499"
xy-swap="true">
xy-swap="false">
</app-vectortile-view>
</p>
<h2>Tile matrix set limits</h2>
Expand Down

0 comments on commit 3521e48

Please sign in to comment.