Skip to content

Commit

Permalink
Update API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tidwall committed Jan 10, 2025
1 parent 403acb1 commit 5accbdd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
42 changes: 42 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ Functions for parsing geometries from external data representations. It's recomm
- [tg_parse_ix()](#group___geometry_parsing_1gae0bfc62deb68979a46ed62facfee1280)
- [tg_geom_error()](#group___geometry_parsing_1gae77b27ad34c2a215cc281647ab6dbc7e)
- [tg_geobin_fullrect()](#group___geometry_parsing_1gac77e3d8d51a7e66381627cb25853d80f)
- [tg_geobin_rect()](#group___geometry_parsing_1gabf4ef20303d65ccb265ce5359abdfa79)
- [tg_geobin_point()](#group___geometry_parsing_1gab318b6a815f21bb81440ad3edbb61afe)


<a name='group___geometry_writing'></a>
Expand Down Expand Up @@ -2406,6 +2408,46 @@ Returns the minimum bounding rectangle of GeoBIN data.



<a name='group___geometry_parsing_1gabf4ef20303d65ccb265ce5359abdfa79'></a>
## tg_geobin_rect()
```c
struct tg_rect tg_geobin_rect(const uint8_t *geobin, size_t len);
```
Returns the minimum bounding rectangle of GeoBIN data.

**Parameters**

- **geobin**: GeoBIN data
- **len**: Length of data



**Return**

- the rectangle



<a name='group___geometry_parsing_1gab318b6a815f21bb81440ad3edbb61afe'></a>
## tg_geobin_point()
```c
struct tg_point tg_geobin_point(const uint8_t *geobin, size_t len);
```
Returns the center point of GeoBIN data.

**Parameters**

- **geobin**: GeoBIN data
- **len**: Length of data



**Return**

- the center point



<a name='group___geometry_writing_1gae4669b8ee598a46e7f4c5a11e645fe8f'></a>
## tg_geom_geojson()
```c
Expand Down
8 changes: 8 additions & 0 deletions tg.c
Original file line number Diff line number Diff line change
Expand Up @@ -14811,6 +14811,10 @@ int tg_geobin_fullrect(const uint8_t *geobin, size_t len, double min[4],
return dims;
}

/// Returns the minimum bounding rectangle of GeoBIN data.
/// @param geobin GeoBIN data
/// @param len Length of data
/// @return the rectangle
struct tg_rect tg_geobin_rect(const uint8_t *geobin, size_t len) {
struct tg_rect rect = { 0 };
if (geobin && len > 2 && geobin[0] >= 0x01 && geobin[0] <= 0x04) {
Expand Down Expand Up @@ -14838,6 +14842,10 @@ struct tg_rect tg_geobin_rect(const uint8_t *geobin, size_t len) {
return rect;
}

/// Returns the center point of GeoBIN data.
/// @param geobin GeoBIN data
/// @param len Length of data
/// @return the center point
struct tg_point tg_geobin_point(const uint8_t *geobin, size_t len) {
struct tg_point point = { 0 };
if (geobin && len > 2 && geobin[0] >= 0x01 && geobin[0] <= 0x04) {
Expand Down
1 change: 0 additions & 1 deletion tg.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ const char *tg_geom_error(const struct tg_geom *geom);
int tg_geobin_fullrect(const uint8_t *geobin, size_t len, double min[4], double max[4]);
struct tg_rect tg_geobin_rect(const uint8_t *geobin, size_t len);
struct tg_point tg_geobin_point(const uint8_t *geobin, size_t len);

/// @}

/// @defgroup GeometryWriting Geometry writing
Expand Down

0 comments on commit 5accbdd

Please sign in to comment.