update for delete function

master
keen 2015-09-08 01:05:53 +09:00
parent 1c2a6fab49
commit cf742c17d4
16 changed files with 18 additions and 16 deletions

View File

@ -39,30 +39,32 @@ func (c GoMap) Toilet() revel.Result {
}
var bboxSlice = strings.Split(bbox,",");
var toilets []models.Toilet
//177000,437000,219000,466000
minx,err := strconv.ParseFloat(bboxSlice[0],64)
miny,err := strconv.ParseFloat(bboxSlice[1],64)
maxx,err := strconv.ParseFloat(bboxSlice[2],64)
maxy,err := strconv.ParseFloat(bboxSlice[3],64)
width,err := strconv.Atoi(widthStr)
height,err := strconv.Atoi(heightStr)
fmt.Println("converted",minx,miny,maxx,maxy,width,height);
Db.Where("geom && ST_Transform(ST_MakeEnvelope(?,?,?,?,?),2097)",minx,miny,maxx,maxy,srsNo).Find(&toilets);
var contertedBndStr string
srsNoStr :=strconv.Itoa(srsNo)
rows, err := Db.Model(toilets).First(&contertedBndStr).Select("ST_Transform(ST_MakeEnvelope("+bboxSlice[0]+","+bboxSlice[1]+","+bboxSlice[2]+","+bboxSlice[3]+","+srsNoStr+"),2097))").Rows() // (*sql.Rows, error)
defer rows.Close()
fmt.Println("converted bounds : ",contertedBndStr);
fmt.Println(len(toilets));
selectQuery:="Gid,Gu_nm,Hnr_nam,Mtc_at,Masterno,Slaveno,Neadres_nm,Wc_nam,Wc_gbn,Hd_wc_yno,Creat_de,Po_fe_nm,"
selectQuery+="ST_Transform(Geom,3857) as Geom"
whereQuery:="geom && ST_Transform(ST_MakeEnvelope(?,?,?,?,?),2097)"
Db.Where(whereQuery,minx,miny,maxx,maxy,srsNo).Select(selectQuery).Find(&toilets)
minP := models.Point{int(minx),int(miny)}
maxP := models.Point{int(maxx),int(maxy)}
bnd := &models.Bounds{models.Rectangle{minP,maxP}}
filename := services.DrawPoint( toilets, bnd, width,height )
fmt.Println(revel.BasePath,filename);
// fmt.Println(revel.BasePath,filename);
file, _ := os.Open(revel.BasePath+"/output/wms/"+filename)
// defer file.Close()
fileInfo, err:= file.Stat()
fmt.Println(fileInfo,err) //the err is nil
// return c.Render(filename)
if err != nil {
fmt.Println(err) //the err is nil
return nil
}
defer func(){
os.Remove(revel.BasePath+"/output/wms/"+filename)
}()
return c.RenderFile(file, revel.Inline )//Not an attachment. But Who disconnect the file.
}

View File

@ -18,7 +18,7 @@ func PrintPoint(toilets []models.Toilet) {
}
}
func DrawPoint( toilets []models.Toilet, b *models.Bounds, imgWidth int, imgHeight int) string{
fmt.Println(imgWidth,imgHeight);
// fmt.Println(imgWidth,imgHeight);
filename := strconv.Itoa(b.Min.X) + "_" + strconv.Itoa(b.Min.Y)
filename += "_" + strconv.Itoa(b.Max.X) + "_" + strconv.Itoa(b.Max.Y)
filename += "_" +strconv.Itoa(imgWidth) + "_" + strconv.Itoa(imgHeight) +".png"
@ -33,7 +33,7 @@ func DrawPoint( toilets []models.Toilet, b *models.Bounds, imgWidth int, imgHeig
dx := (toilet.Geom.Lng-float64(b.Min.X))/float64(HRes)//x
dy := float64(imgHeight) - (toilet.Geom.Lat-float64(b.Min.Y))/float64(VRes)//y
// fmt.Println("toilet :", toilet,dx,dy);
draw2dkit.Circle(gc, dx, dy, 5)
draw2dkit.Circle(gc, dx, dy, 3)
gc.FillStroke()
}
gc.Close()

BIN
output/wms/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 KiB