renderGeoGeometry renders the geometry expression for SpatiaLite
(ctx Context, geo *qcode.GeoExp)
| 560 | |
| 561 | // renderGeoGeometry renders the geometry expression for SpatiaLite |
| 562 | func (d *SQLiteDialect) renderGeoGeometry(ctx Context, geo *qcode.GeoExp) { |
| 563 | if len(geo.Point) == 2 { |
| 564 | ctx.WriteString(fmt.Sprintf(`MakePoint(%f, %f, %d)`, |
| 565 | geo.Point[0], geo.Point[1], geo.SRID)) |
| 566 | } else if len(geo.Polygon) > 0 { |
| 567 | ctx.WriteString(`GeomFromText('POLYGON((`) |
| 568 | for i, pt := range geo.Polygon { |
| 569 | if i > 0 { |
| 570 | ctx.WriteString(`, `) |
| 571 | } |
| 572 | ctx.WriteString(fmt.Sprintf(`%f %f`, pt[0], pt[1])) |
| 573 | } |
| 574 | ctx.WriteString(fmt.Sprintf(`))', %d)`, geo.SRID)) |
| 575 | } else if len(geo.GeoJSON) > 0 { |
| 576 | ctx.WriteString(fmt.Sprintf(`GeomFromGeoJSON('%s')`, strings.ReplaceAll(string(geo.GeoJSON), "'", "''"))) |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | // renderGeoDistance renders the distance value for SpatiaLite (in meters) |
| 581 | func (d *SQLiteDialect) renderGeoDistance(ctx Context, geo *qcode.GeoExp) { |
no test coverage detected