In Cartesian geometry, a vector is a mathematical object that has both magnitude (length) and direction. Vectors are often represented as arrows in a coordinate system and can be used to describe movement, transformations, and spatial relationships.
When working with Flow in Giraffe, vectors play a crucial role in defining points, lines, and polygon geometries.
In general, a vector is:
- A direction and a magnitude (think: an arrow)
- It tells you how to go from one point to another
In Cartesian geometry, a vector is often written as (x, y) or (x, y, z) representing how far to move in each axis.
Vectors in GeoJSON
GeoJSON is not made of vectors by default—it stores positions (points on Earth) using latitude and longitude.
But:
When you project those coordinates into a Cartesian space (like meters or pixels), you can start doing vector operations.
Behind the scenes, once your GeoJSON is projected, it’s basically a set of points in Cartesian space, and any change you apply is a vector operation.
Examples of Vectors in Mapping:
1. Translation (move a shape):
- You apply a vector like `(10, 0)` to move everything 10 meters east.
2. Difference between two points:
- Point A: `(100, 200)`
- Point B: `(120, 250)`
- Vector from A to B: `(20, 50)`
3. Direction + distance for movement:
- A vector can describe "move this geometry 30 meters north".
