func (wof WOFFeature) DumpCoords(poly []interface{}) geo.Polygon { polygon := geo.Polygon{} for _, icoords := range poly { coords := icoords.([]interface{}) lon := coords[0].(float64) lat := coords[1].(float64) pt := geo.NewPoint(lat, lon) polygon.Add(pt) } return polygon }
func (idx *Index) WOFPolygonToPolyclip(p *geo.Polygon) (*polyclip.Polygon, error) { poly := new(polyclip.Polygon) contour := new(polyclip.Contour) for _, _pt := range p.Points() { pt := polyclip.Point{ X: _pt.Lng(), Y: _pt.Lat(), } contour.Add(pt) } poly.Add(*contour) return poly, nil }