1/*
2 * geospatial.h
3 *
4 * Copyright (C) 2015 Aerospike, Inc.
5 *
6 * Portions may be licensed to Aerospike, Inc. under one or more contributor
7 * license agreements.
8 *
9 * This program is free software: you can redistribute it and/or modify it under
10 * the terms of the GNU Affero General Public License as published by the Free
11 * Software Foundation, either version 3 of the License, or (at your option) any
12 * later version.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see http://www.gnu.org/licenses/
21 */
22
23#pragma once
24
25#include <stdbool.h>
26#include <stdint.h>
27#include <stddef.h>
28
29#include "base/datamodel.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35extern bool geo_parse(as_namespace * ns,
36 const char * buf,
37 size_t bufsz,
38 uint64_t * cellidp,
39 geo_region_t * regionp);
40
41extern bool geo_region_cover(as_namespace * ns,
42 geo_region_t region,
43 int maxnumcells,
44 uint64_t * cellctrp,
45 uint64_t * cellminp,
46 uint64_t * cellmaxp,
47 int * numcellsp);
48
49extern bool geo_point_centers(as_namespace * ns,
50 uint64_t cellidval,
51 int maxnumcenters,
52 uint64_t * center,
53 int * numcentersp);
54
55extern bool geo_point_within(uint64_t cellidval, geo_region_t region);
56
57extern void geo_region_destroy(geo_region_t region);
58
59#ifdef __cplusplus
60} // end extern "C"
61#endif
62