Docs
Search…
Geo Web Coordinate

Summary

The Geo Web Coordinate library defines the Geo Web's fixed global grid and coordinate system. It is the basis for the spatial definition of all Geo Web land parcels.
The system's grid lines create rectangular areas referred to as Geo Web Coordinates. Each Geo Web land parcel is an array of Geo Web Coordinates.
A single Geo Web Coordinate (yellow rectangle) on the Kovan testnet
In the testnet implementation, a larger grid size was used for more practical large land claims. Mainnet will use a (smaller) grid size that balances transaction fees/size with enabling faithful representation of existing real world property lines.
The Geo Web Parcel contract uses the library defined in Geo Web Coordinate to traverse parcel paths and map coordinates to the word index.

Code

Reference Documentation

GeoWebCoordinate

GeoWebCoordinate is an unsigned 64-bit integer that contains x and y coordinates in the upper and lower 32 bits, respectively.

Grid Size

1
uint64 constant MAX_X = ((2**19) - 1);
2
uint64 constant MAX_Y = ((2**18) - 1);
Copied!
Sets the fixed number of latitudinal and longitudinal gridlines.

traverse

1
function traverse(
2
uint64 origin,
3
uint256 direction,
4
uint256 _i_x,
5
uint256 _i_y,
6
uint256 _i
7
)
8
public
9
pure
10
returns (
11
uint64 destination,
12
uint256 i_x,
13
uint256 i_y,
14
uint256 i
15
);
Copied!
Returns the destination coordinate traversed in single direction from the origin coordinate.

toWordIndex

1
function toWordIndex(uint64 coord)
2
public
3
pure
4
returns (
5
uint256 i_x,
6
uint256 i_y,
7
uint256 i
8
);
Copied!
Returns a word index converted from a coordinate.

GeoWebCoordinatePath

GeoWebCoordinatePath stores a path of directions in a uint256. The most significant 8 bits encodes the length of the path.
1
uint256 constant INNER_PATH_MASK = (2**(256 - 8)) - 1;
2
uint256 constant PATH_SEGMENT_MASK = (2**2) - 1;
Copied!

nextDirection

1
function nextDirection(uint256 path)
2
public
3
pure
4
returns (
5
bool hasNext,
6
uint256 direction,
7
uint256 nextPath
8
);
Copied!
Returns the next direction (if it exists) from a path.