forked from Ironholds/olctools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoders.h
More file actions
51 lines (27 loc) · 963 Bytes
/
coders.h
File metadata and controls
51 lines (27 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <algorithm>
#include "validate.h"
using namespace Rcpp;
#ifndef __OLC_CODE__
#define __OLC_CODE__
class olc_coders: public olc_validate {
protected:
int grid_rows;
int grid_cols;
double grid_degrees;
unsigned int max_pair_length;
std::vector < double > resolution_levels;
double clip_lat(double lat);
double clip_longitude(double longitude);
double lat_precision(unsigned int length);
std::vector < double > olc_decode_single(std::string olc);
std::string olc_encode_single(double lat, double longitude, unsigned int output_length);
private:
std::vector < double > olc_decode_pair(std::string code, int offset);
std::vector < double > olc_decode_grid(std::string code);
public:
CharacterVector olc_encode_vector(NumericVector latitude, NumericVector longitude,
IntegerVector code_length);
DataFrame olc_decode_vector(CharacterVector olcs);
olc_coders();
};
#endif