Skip to content

Commit

Permalink
Merge pull request #27 from PDOK/areyouinorout
Browse files Browse the repository at this point in the history
various things from processing ozon on z0
  • Loading branch information
roelarents authored Feb 16, 2024
2 parents 327b5fd + 1993bbb commit 0daad64
Show file tree
Hide file tree
Showing 6 changed files with 685 additions and 200 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/pdok/texel

go 1.21
go 1.21.6

require (
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
Expand All @@ -16,6 +16,7 @@ require (
github.com/muesli/reflow v0.3.0
github.com/perimeterx/marshmallow v1.1.5
github.com/stretchr/testify v1.8.4
github.com/tobshub/go-sortedmap v1.0.3
github.com/wk8/go-ordered-map/v2 v2.1.8
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
)
Expand Down Expand Up @@ -44,6 +45,5 @@ require (
github.com/gdey/errors v0.0.0-20190426172550-8ebd5bc891fb // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/umpc/go-sortedmap v0.0.0-20180422175548-64ab94c482f4
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tobshub/go-sortedmap v1.0.3 h1:oUhj/5tqzjTX4bhWqB1ZFTDtMULJ1ZYUnS8WAugSfjY=
github.com/tobshub/go-sortedmap v1.0.3/go.mod h1:JLxyU94+lfKuCgelxXpwRr29ei6SqLbaeVuNVMvENbE=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/umpc/go-sortedmap v0.0.0-20180422175548-64ab94c482f4 h1:qk1XyC6UGfPa51PGmsTQJavyhfMLScqw97pEV3sFClI=
github.com/umpc/go-sortedmap v0.0.0-20180422175548-64ab94c482f4/go.mod h1:X6iKjXCleSyo/LZzKZ9zDF/ZB2L9gC36I5gLMf32w3M=
github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs=
github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
Expand Down
18 changes: 18 additions & 0 deletions snap/geom.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package snap

import "math"

// https://en.wikipedia.org/wiki/Shoelace_formula
func shoelace(pts [][2]float64) float64 {
sum := 0.
if len(pts) == 0 {
return 0.
}

p0 := pts[len(pts)-1]
for _, p1 := range pts {
sum += p0[1]*p1[0] - p0[0]*p1[1]
p0 = p1
}
return math.Abs(sum / 2)
}
25 changes: 0 additions & 25 deletions snap/pointindex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,31 +450,6 @@ func newSimplePointIndex(maxDepth Level, cellSize float64) *PointIndex {
return &ix
}

//nolint:unparam
func newSimpleTileMatrixSet(maxDepth Level, cellSize float64) tms20.TileMatrixSet {
zeroZero := tms20.TwoDPoint([2]float64{0.0, 0.0})
tms := tms20.TileMatrixSet{
CRS: fakeCRS{},
OrderedAxes: []string{"X", "Y"},
TileMatrices: make(map[tms20.TMID]tms20.TileMatrix),
}
for tmID := 0; tmID <= int(maxDepth); tmID++ {
tmCellSize := cellSize * float64(pow2(maxDepth-uint(tmID)))
tms.TileMatrices[tmID] = tms20.TileMatrix{
ID: "0",
ScaleDenominator: tmCellSize / tms20.StandardizedRenderingPixelSize,
CellSize: tmCellSize,
CornerOfOrigin: tms20.BottomLeft,
PointOfOrigin: &zeroZero,
TileWidth: 1,
TileHeight: 1,
MatrixWidth: 1,
MatrixHeight: 1,
}
}
return tms
}

func loadEmbeddedTileMatrixSet(t *testing.T, tmsID string) tms20.TileMatrixSet {
tms, err := tms20.LoadEmbeddedTileMatrixSet(tmsID)
require.NoError(t, err)
Expand Down
Loading

0 comments on commit 0daad64

Please sign in to comment.