1
0
forked from MTSR/mapserver
mapserver/main.go

46 lines
600 B
Go
Raw Normal View History

2019-01-04 10:41:01 +03:00
package main
import (
2019-01-17 16:20:29 +03:00
"mapserver/initialrenderer"
2019-01-09 10:56:39 +03:00
"github.com/sirupsen/logrus"
2019-01-17 15:44:39 +03:00
"mapserver/layerconfig"
2019-01-18 10:47:38 +03:00
"mapserver/app"
"mapserver/params"
"fmt"
2019-01-04 10:41:01 +03:00
)
2019-01-18 10:47:38 +03:00
2019-01-07 10:56:02 +03:00
2019-01-04 13:00:49 +03:00
func main() {
2019-01-13 18:32:54 +03:00
logrus.SetLevel(logrus.InfoLevel)
2019-01-18 10:47:38 +03:00
//Parse command line
2019-01-13 18:32:54 +03:00
2019-01-18 10:47:38 +03:00
p := params.Parse()
2019-01-13 18:32:54 +03:00
2019-01-18 10:47:38 +03:00
if p.Help {
params.PrintHelp()
return
}
2019-01-13 18:32:54 +03:00
2019-01-18 10:47:38 +03:00
if p.Version {
fmt.Print("Mapserver version: ")
fmt.Println(app.Version)
return
}
2019-01-13 18:32:54 +03:00
2019-01-18 10:47:38 +03:00
//setup app context
2019-01-17 09:45:32 +03:00
2019-01-18 10:47:38 +03:00
ctx, err := app.Setup(p)
2019-01-13 18:32:54 +03:00
2019-01-17 10:34:21 +03:00
if err != nil {
2019-01-18 10:47:38 +03:00
//error case
2019-01-17 10:34:21 +03:00
panic(err)
2019-01-13 18:32:54 +03:00
}
2019-01-09 10:56:39 +03:00
2019-01-18 10:47:38 +03:00
//run initial rendering
2019-01-17 15:44:39 +03:00
2019-01-18 10:47:38 +03:00
initialrenderer.Render(ctx.Tilerenderer, layerconfig.DefaultLayers)
2019-01-17 10:34:21 +03:00
2019-01-04 13:00:49 +03:00
}