MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / geomToGeoJSONCRS

Function geomToGeoJSONCRS

pkg/geo/encode.go:90–108  ·  view source on GitHub ↗

geomToGeoJSONCRS converts a geom to its CRS GeoJSON form.

(t geom.T, long bool)

Source from the content-addressed store, hash-verified

88
89// geomToGeoJSONCRS converts a geom to its CRS GeoJSON form.
90func geomToGeoJSONCRS(t geom.T, long bool) (*geojson.CRS, error) {
91 projection, err := geoprojbase.Projection(geopb.SRID(t.SRID()))
92 if err != nil {
93 return nil, err
94 }
95 var prop string
96 if long {
97 prop = fmt.Sprintf("urn:ogc:def:crs:%s::%d", projection.AuthName, projection.AuthSRID)
98 } else {
99 prop = fmt.Sprintf("%s:%d", projection.AuthName, projection.AuthSRID)
100 }
101 crs := &geojson.CRS{
102 Type: "name",
103 Properties: map[string]interface{}{
104 "name": prop,
105 },
106 }
107 return crs, nil
108}
109
110// SpatialObjectToGeoJSON transforms a given SpatialObject to GeoJSON.
111func SpatialObjectToGeoJSON(

Callers 1

SpatialObjectToGeoJSONFunction · 0.85

Calls 3

ProjectionFunction · 0.92
SRIDTypeAlias · 0.92
SRIDMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…