Search…
projections Property
Vega projections map longitude and latitude data to projected x and y coordinates. When working with geospatial data in OmniSci, you can use projections to define geographic points and regions.
General projections property JSON format:
1
"projections": [
2
{
3
"name": "<projectionName>",
4
"type": "<projectionType>",
5
"bounds": {
6
"x": [<minLong>,<maxLong>],
7
"y": [<minLat>,<maxLat>]
8
}
9
}
10
]
Copied!
When you specify a projection, you must reference it in the Marks Property using the transform object. For example, if you define the projection my_mercator_projection:
1
"projections": [
2
{
3
"name": "my_mercator_projection",
4
"type": "mercator",
5
"bounds": {
6
"x": [-120.0, 120.0],
7
"y": [-20.0,20.0]
8
}
9
}
10
]
Copied!
you then reference it as follows:
1
"marks": [
2
{
3
"type": "symbol",
4
"from": { "data": "fec_contributions_oct" },
5
"properties": { ... elided ... }
6
"transform": {
7
"projection": "my_mercator_projection"
8
}
9
}
10
]
Copied!
The projections specification has the following properties:
Property
Data Type
Required
Description
name
string
X
User-assigned name of the projection.
type
string
X
Projection type. Currently supported types:
    mercator: Mercator map projection.
bounds
object
Specifies the longitude and latitude bounding box for the projection. Default values:
    x: [-180.0, 180.0]
    y: [-85.0, 85.0]

Example

Use Vega projection projection alongside array columns:
1
{
2
"width": 1024,
3
"height": 1024,
4
"data": [
5
{
6
"name": "table",
7
"sql": "SELECT rowid, coords[1] as x, coords[2] as y FROM cities WHERE coords[1] BETWEEN $minLon AND $maxLon AND coords[2] BETWEEN $minLat AND $maxLat"
8
}
9
],
10
"projections": [
11
{
12
"name": "projection",
13
"type": "mercator",
14
"bounds": {
15
"x": [-120.0, 120.0],
16
"y": [-20.0, 20.0]
17
}
18
}
19
],
20
"scales": [
21
],
22
"marks": [
23
{
24
"type": "symbol",
25
"from": {"data": "table"},
26
"properties": {
27
"shape": "circle",
28
"xc": {
29
"field": "x"
30
},
31
"yc": {
32
"field": "y"
33
},
34
"fillColor": "darkblue",
35
"width": 25,
36
"height": 25
37
},
38
"transform": {
39
"projection": "projection"
40
}
41
}
42
]
43
}
Copied!
Last modified 1yr ago
Export as PDF
Copy link
Contents
Example