func renderReq(r *maps.Request) render.Request { result := render.Request{} result.BBOX[0] = r.BBOX.MinX result.BBOX[1] = r.BBOX.MinY result.BBOX[2] = r.BBOX.MaxX result.BBOX[3] = r.BBOX.MaxY result.Width = r.Width result.Height = r.Height result.EPSGCode = r.EPSGCode result.Format = r.Format return result }
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) } }
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) } }
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) } }
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) } }