ClickHouse/docs/en/sql-reference/functions/geo/svg.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.1 KiB
Markdown
Raw Normal View History

2023-06-02 16:42:35 +00:00
---
slug: /en/sql-reference/functions/geo/svg
sidebar_label: SVG
title: "Functions for Generating SVG images from Geo data"
---
2024-04-27 14:47:43 +00:00
## Svg
Returns a string of select SVG element tags from Geo data.
**Syntax**
2023-06-02 16:42:35 +00:00
``` sql
2024-04-27 14:47:43 +00:00
Svg(geometry,[style])
2023-06-02 16:42:35 +00:00
```
2024-04-27 14:47:43 +00:00
Aliases: `SVG`, `svg`
2023-06-02 16:42:35 +00:00
2024-04-27 14:47:43 +00:00
**Parameters**
2023-06-02 16:42:35 +00:00
2024-04-27 14:52:13 +00:00
- `geometry` — Geo data. [Geo](../../data-types/geo).
2024-04-27 14:47:43 +00:00
- `style` — Optional style name. [String](../../data-types/string).
**Returned value**
2023-06-02 16:42:35 +00:00
- The SVG representation of the geometry. [String](../../data-types/string).
2023-06-02 16:42:35 +00:00
- SVG circle
- SVG polygon
- SVG path
2024-04-27 14:47:43 +00:00
**Examples**
2023-06-02 16:42:35 +00:00
2024-04-27 14:47:43 +00:00
**Circle**
Query:
2023-06-02 16:42:35 +00:00
```sql
SELECT SVG((0., 0.))
```
2024-04-27 14:47:43 +00:00
Result:
2023-06-02 16:42:35 +00:00
```response
<circle cx="0" cy="0" r="5" style=""/>
```
2024-04-27 14:47:43 +00:00
**Polygon**
Query:
2023-06-02 16:42:35 +00:00
```sql
SELECT SVG([(0., 0.), (10, 0), (10, 10), (0, 10)])
```
2024-04-27 14:47:43 +00:00
Result:
2023-06-02 16:42:35 +00:00
```response
<polygon points="0,0 0,10 10,10 10,0 0,0" style=""/>
```
2024-04-27 14:47:43 +00:00
**Path**
Query:
2023-06-02 16:42:35 +00:00
```sql
SELECT SVG([[(0., 0.), (10, 0), (10, 10), (0, 10)], [(4., 4.), (5, 4), (5, 5), (4, 5)]])
```
2024-04-27 14:47:43 +00:00
Result:
2023-06-02 16:42:35 +00:00
```response
<g fill-rule="evenodd"><path d="M 0,0 L 0,10 L 10,10 L 10,0 L 0,0M 4,4 L 5,4 L 5,5 L 4,5 L 4,4 z " style=""/></g>
```