geomToGeoJSONCRS converts a geom to its CRS GeoJSON form.
(t geom.T, long bool)
| 88 | |
| 89 | // geomToGeoJSONCRS converts a geom to its CRS GeoJSON form. |
| 90 | func 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. |
| 111 | func SpatialObjectToGeoJSON( |
no test coverage detected
searching dependent graphs…