Skip to content

Commit

Permalink
v0.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
wroge committed Mar 28, 2019
1 parent 94b36af commit 5f45b0d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![GitHub release](https://img.shields.io/github/release/wroge/wms.svg)](https://github.com/wroge/wms/releases/latest)
[![GolangCI](https://golangci.com/badges/github.com/wroge/wms.svg)](https://golangci.com/r/github.com/wroge/wms)
[![Go Report Card](https://goreportcard.com/badge/github.com/wroge/wms)](https://goreportcard.com/report/github.com/wroge/wms)

# Web Map Service - Manager

Expand Down Expand Up @@ -85,7 +84,14 @@ wms cap -u http://ows.terrestris.de/osm/service -e
wms map -u http://ows.terrestris.de/osm/service -e 12345
Error: Invalid EPSG: 12345
Valid EPSGs: [2154 4326 5668 31467 32632 32633 5650 4277 3857 25832 25833 31468 3067 4462 6870 900913 4647 27700 5669 31466 31469 6962]
Valid EPSGs: [3857 900913 4326 5650 31468 32624 25831 32605 32613 32628 32629
32640 5669 32606 32614 32619 32620 32627 32639 32645 4258 6962
32602 32604 32609 32618 32634 2154 6870 32601 32626 32631 32654
32603 32610 32612 32641 32647 32656 32660 25833 32630 32643 32646
3067 4978 25836 31466 32607 32623 32632 32651 32657 4647 32615 32616
32649 32650 25838 32608 32617 32636 32637 25834 25835 32621 25829
25832 32622 32633 32635 32653 4462 5668 32611 32638 32648 32652 25830
32642 4277 27700 31469 32658 32659 25837 31467 32625 32644 32655]
```

### Download several bounding boxes
Expand Down
21 changes: 10 additions & 11 deletions getmap/getmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"strings"

"github.com/wroge/go-coo"
"github.com/wroge/go-coo/epsg"
"github.com/wroge/wms/content"
"github.com/wroge/wms/getcap"
)
Expand Down Expand Up @@ -202,7 +201,7 @@ func (s *Service) AddEPSG(epsgCode int) (err error) {
if len(epsgCap) == 0 {
return errors.New("Adding EPSG failed")
}
for _, e := range epsg.List() {
for e, _ := range coo.EPSG {
redundant := false
for _, eeC := range epsgCap {
if eeC == e {
Expand Down Expand Up @@ -338,11 +337,11 @@ func WidthOption(width int) Option {
}

func utmCoord(minx, miny, maxx, maxy float64, e int) (x1, y1, x2, y2 float64) {
from, err := epsg.Code(e)
if err != nil {
from, ok := coo.EPSG[e]
if !ok {
return
}
to := epsg.Code4326
to := coo.EPSG4326
x1, y1, _ = coo.Transform(minx, miny, 0, from, to)
x2, y2, _ = coo.Transform(maxx, maxy, 0, from, to)
zone1 := math.Floor(x1/6) + 31
Expand All @@ -351,8 +350,8 @@ func utmCoord(minx, miny, maxx, maxy float64, e int) (x1, y1, x2, y2 float64) {
if y1 < 0 || y2 < 0 {
hemisphere = "S"
}
x1, y1 = coo.UTM((zone1+zone2)/2, hemisphere).FromGeographic(x1, y1, nil)
x2, y2 = coo.UTM((zone1+zone2)/2, hemisphere).FromGeographic(x2, y2, nil)
x1, y1, _ = coo.UTM((zone1+zone2)/2, hemisphere).FromGeographic(x1, y1, 0, coo.WGS84)
x2, y2, _ = coo.UTM((zone1+zone2)/2, hemisphere).FromGeographic(x2, y2, 0, coo.WGS84)
return
}

Expand All @@ -368,12 +367,12 @@ func (s *Service) GetMap(minx, miny, maxx, maxy float64, o Option) (r *bytes.Rea
}
epsgCap := s.Capabilities.GetLayers(s.Layers...).GetBBoxes().GetEPSG()
if !containsInt(epsgCap, s.EPSG) {
from, err := epsg.Code(s.EPSG)
if err != nil {
from, ok := coo.EPSG[s.EPSG]
if !ok {
return nil, 0, 0, err
}
to, err := epsg.Code(epsgCap[0])
if err != nil {
to, ok := coo.EPSG[epsgCap[0]]
if !ok {
return nil, 0, 0, err
}
minx, miny, _ = coo.Transform(minx, miny, 0, from, to)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ require (
github.com/spf13/cobra v0.0.3
github.com/spf13/viper v1.3.2
github.com/stretchr/testify v1.3.0
github.com/wroge/go-coo v0.0.8
github.com/wroge/go-coo v0.1.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/wroge/go-coo v0.0.8 h1:FqXpr2Gle0qCc5+2pa28Ii/UhbDzOIm8qcHC1YUU8xo=
github.com/wroge/go-coo v0.0.8/go.mod h1:tFHV+R0q1LC9gt9zjHhTES7dyeiokn8hcAfE5OOoSQE=
github.com/wroge/go-coo v0.1.0 h1:7WnIOZ3c0Jnl7mWY9jj/bopazyp33ihw1bV4YudpQsI=
github.com/wroge/go-coo v0.1.0/go.mod h1:tFHV+R0q1LC9gt9zjHhTES7dyeiokn8hcAfE5OOoSQE=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI=
Expand Down

0 comments on commit 5f45b0d

Please sign in to comment.