Exemple #1
0
// Return the geometry as a KML element.
func AsKMLVersion(c aspect.ColumnElem, version, maxdigits int) aspect.ColumnElem {
	return c.SetInner(
		aspect.FuncClause{
			Inner: aspect.ArrayClause{
				Clauses: []aspect.Clause{
					aspect.IntClause{D: version},
					c.Inner(),
					aspect.IntClause{D: maxdigits},
				},
				Sep: ", ",
			},
			F: "ST_AsKML",
		},
	)
}
Exemple #2
0
func StringAgg(c aspect.ColumnElem, separator string) aspect.ColumnElem {
	return c.SetInner(
		aspect.FuncClause{
			Inner: aspect.ArrayClause{
				Clauses: []aspect.Clause{
					c,
					aspect.StringClause{
						Name: separator,
					},
				},
				Sep: separator,
			},
			F: "string_agg",
		},
	)
}
Exemple #3
0
// Return the Degrees, Minutes, Seconds representation of the given point
func AsLatLon(c aspect.ColumnElem) aspect.ColumnElem {
	return c.SetInner(
		aspect.FuncClause{Inner: c.Inner(), F: "ST_AsLatLonText"},
	)
}
Exemple #4
0
// Return the Well-Known Binary (WKB) representation of the geometry/geography
// without SRID meta data
func AsBinary(c aspect.ColumnElem) aspect.ColumnElem {
	return c.SetInner(
		aspect.FuncClause{Inner: c.Inner(), F: "ST_AsBinary"},
	)
}
Exemple #5
0
// Return a GeoHash representation of the geometry.
func GeoHash(c aspect.ColumnElem) aspect.ColumnElem {
	return c.SetInner(
		aspect.FuncClause{Inner: c.Inner(), F: "ST_GeoHash"},
	)
}
Exemple #6
0
// Return the geometry as a GeoJSON element
func AsGeoJSON(c aspect.ColumnElem) aspect.ColumnElem {
	return c.SetInner(
		aspect.FuncClause{Inner: c.Inner(), F: "ST_AsGeoJSON"},
	)
}
Exemple #7
0
func AsGeography(c aspect.ColumnElem) aspect.ColumnElem {
	return c.SetInner(aspect.BinaryClause{
		Pre: c.Inner(),
		Sep: "::geography",
	})
}
Exemple #8
0
// Returns the area of the given column
// For "geometry" type area is in SRID units.
// For "geography" area is in square meters.
func AreaOf(c aspect.ColumnElem) aspect.ColumnElem {
	return c.SetInner(
		aspect.FuncClause{Inner: c.Inner(), F: "ST_Area"},
	)
}