本文整理匯總了Golang中github.com/omniscale/imposm3/geom/geos.Geos.UnionPolygons方法的典型用法代碼示例。如果您正苦於以下問題:Golang Geos.UnionPolygons方法的具體用法?Golang Geos.UnionPolygons怎麽用?Golang Geos.UnionPolygons使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/omniscale/imposm3/geom/geos.Geos
的用法示例。
在下文中一共展示了Geos.UnionPolygons方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: mergeGeometries
// mergeGeometries
func mergeGeometries(g *geos.Geos, geoms []*geos.Geom, geomType string) []*geos.Geom {
// intersections from multiple sub-polygons
// try to merge them back to a single geometry
if strings.HasSuffix(geomType, "Polygon") {
polygons := flattenPolygons(g, geoms)
polygon := g.UnionPolygons(polygons)
if polygon == nil {
return nil
}
g.DestroyLater(polygon)
return []*geos.Geom{polygon}
} else if strings.HasSuffix(geomType, "LineString") {
linestrings := flattenLineStrings(g, geoms)
linestrings = filterInvalidLineStrings(g, linestrings)
if len(linestrings) == 0 {
return nil
}
union := g.LineMerge(linestrings)
for _, l := range union {
g.DestroyLater(l)
}
return union
} else if geomType == "Point" {
if len(geoms) >= 1 {
for _, p := range geoms {
g.DestroyLater(p)
}
return geoms[0:1]
}
return nil
} else {
panic("unexpected geometry type" + geomType)
}
}