forked from osm2pgsql-dev/osm2pgsql
-
Notifications
You must be signed in to change notification settings - Fork 1
/
osmtypes.h
82 lines (64 loc) · 1.93 KB
/
osmtypes.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Data types to hold OSM node, segment, way data */
#ifndef OSMTYPES_H
#define OSMTYPES_H
#include <inttypes.h>
#include <time.h>
#include <config.h>
/* Use ./configure --enable-64bit-ids to build a version that supports 64bit IDs. */
#ifdef OSMID64
typedef int64_t osmid_t;
#define strtoosmid strtoll
#define PRIdOSMID PRId64
#define POSTGRES_OSMID_TYPE "int8"
#else
typedef int32_t osmid_t;
#define strtoosmid strtol
#define PRIdOSMID PRId32
#define POSTGRES_OSMID_TYPE "int4"
#endif
#include "keyvals.h"
enum OsmType { OSMTYPE_WAY, OSMTYPE_NODE, OSMTYPE_RELATION };
struct osmNode {
double lon;
double lat;
};
struct member {
enum OsmType type;
osmid_t id;
char *role;
};
typedef enum { FILETYPE_NONE, FILETYPE_OSM, FILETYPE_OSMCHANGE, FILETYPE_PLANETDIFF } filetypes_t;
typedef enum { ACTION_NONE, ACTION_CREATE, ACTION_MODIFY, ACTION_DELETE } actions_t;
struct osmdata_t {
osmid_t count_node, max_node;
osmid_t count_way, max_way;
osmid_t count_rel, max_rel;
time_t start_node, start_way, start_rel;
struct output_t *out;
/* Since {node,way} elements are not nested we can guarantee the
values in an end tag must match those of the corresponding
start tag and can therefore be cached.
*/
double node_lon, node_lat;
struct keyval tags;
osmid_t *nds;
int nd_count, nd_max;
struct member *members;
int member_count, member_max;
osmid_t osm_id;
filetypes_t filetype;
actions_t action;
int extra_attributes;
/* Bounding box to filter imported data */
const char *bbox;
double minlon, minlat, maxlon, maxlat;
int parallel_indexing;
};
void realloc_nodes(struct osmdata_t *osmdata);
void realloc_members(struct osmdata_t *osmdata);
void resetMembers(struct osmdata_t *osmdata);
void printStatus(struct osmdata_t *osmdata);
int node_wanted(struct osmdata_t *osmdata, double lat, double lon);
/* exit_nicely - called to cleanup after fatal error */
void exit_nicely(void);
#endif