Ejemplo n.º 1
0
func renderMapserver(t *testing.T, c testCase) {
	caseBuildDir := filepath.Join("build", c.Name)

	mapReq := render.Request{}
	mapReq.EPSGCode = 3857
	mapReq.BBOX = extent(c, false)
	mapReq.Width = c.Width
	mapReq.Height = c.Height
	mapReq.Format = "image/png"

	buf, err := render.MapServer("mapserv", filepath.Join(caseBuildDir, "magnacarto.map"), mapReq)
	if err != nil {
		t.Fatal(err)
	}
	if err := ioutil.WriteFile(filepath.Join(caseBuildDir, "render-magnacarto-ms.png"), buf, 0644); err != nil {
		t.Fatal(err)
	}
}
Ejemplo n.º 2
0
func renderMapnik(t *testing.T, c testCase, name string) {
	caseBuildDir := filepath.Join("build", c.Name)

	mapReq := render.Request{}
	mapReq.EPSGCode = 3857
	mapReq.BBOX = extent(c, true)
	mapReq.Width = c.Width
	mapReq.Height = c.Height
	mapReq.Format = "png24"

	buf, err := render.Mapnik(filepath.Join(caseBuildDir, name+".xml"), mapReq)
	if err != nil {
		t.Fatal(err)
	}
	if err := ioutil.WriteFile(filepath.Join(caseBuildDir, "render-"+name+".png"), buf, 0644); err != nil {
		t.Fatal(err)
	}
}
Ejemplo n.º 3
0
func renderMapserver(t *testing.T, c testCase) {
	caseBuildDir := filepath.Join("build", c.Name)

	mapReq := render.Request{}
	mapReq.EPSGCode = 3857
	mapReq.BBOX = extent(c, false)
	mapReq.Width = c.Width
	mapReq.Height = c.Height
	mapReq.Format = "image/png"

	if mapserverRenderer == nil {
		t.Skip("mapserver not initialized")
	}

	f, err := os.Create(filepath.Join(caseBuildDir, "render-magnacarto-ms.png"))
	if err != nil {
		t.Fatal(err)
	}
	defer f.Close()
	err = mapserverRenderer.Render(filepath.Join(caseBuildDir, "magnacarto.map"), f, mapReq)
	if err != nil {
		t.Fatal(err)
	}
}
Ejemplo n.º 4
0
func renderMapnik(t *testing.T, c testCase, name string) {
	caseBuildDir := filepath.Join("build", c.Name)

	mapReq := render.Request{}
	mapReq.EPSGCode = 3857
	mapReq.BBOX = extent(c, true)
	mapReq.Width = c.Width
	mapReq.Height = c.Height
	mapReq.Format = "png24"

	if mapnikRenderer == nil {
		t.Skip("mapnik not initialized")
	}

	f, err := os.Create(filepath.Join(caseBuildDir, "render-"+name+".png"))
	if err != nil {
		t.Fatal(err)
	}
	defer f.Close()
	err = mapnikRenderer.Render(filepath.Join(caseBuildDir, name+".xml"), f, mapReq)
	if err != nil {
		t.Fatal(err)
	}
}