source: subversion/applications/utils/export/osm2pgsql/osmtypes.h @ 26439

Last change on this file since 26439 was 26439, checked in by frederik, 8 years ago

rename osm2pgsql-64 to osm2pgsql. this is now the new default branch.
a define in osmtypes.h has been commented out so that it builds for 32bit IDs
by default. bumped version to 0.80.
todo: add 32/64 bit distinction to build process

File size: 1.8 KB
Line 
1/* Data types to hold OSM node, segment, way data */
2
3#ifndef OSMTYPES_H
4#define OSMTYPES_H
5
6#include <inttypes.h>
7
8// uncomment the following to build a version that supports 64bit IDs.
9// #define OSMID64
10
11#ifdef OSMID64
12typedef int64_t osmid_t;
13#define strtoosmid strtoll
14#define PRIdOSMID PRId64
15#define POSTGRES_OSMID_TYPE "int8"
16#else
17typedef int32_t osmid_t;
18#define strtoosmid strtol
19#define PRIdOSMID PRId32
20#define POSTGRES_OSMID_TYPE "int4"
21#endif
22
23#include "keyvals.h"
24
25enum OsmType { OSMTYPE_WAY, OSMTYPE_NODE, OSMTYPE_RELATION };
26
27struct osmNode {
28    double lon;
29    double lat;
30};
31
32struct member {
33    enum OsmType type;
34    osmid_t id;
35    char *role;
36};
37
38typedef enum { FILETYPE_NONE, FILETYPE_OSM, FILETYPE_OSMCHANGE, FILETYPE_PLANETDIFF } filetypes_t;
39typedef enum { ACTION_NONE, ACTION_CREATE, ACTION_MODIFY, ACTION_DELETE } actions_t;
40
41struct osmdata_t {
42  osmid_t count_node,    max_node;
43  osmid_t count_way,     max_way;
44  osmid_t count_rel,     max_rel;
45
46  struct output_t *out;
47
48/* Since {node,way} elements are not nested we can guarantee the
49   values in an end tag must match those of the corresponding
50   start tag and can therefore be cached.
51*/
52  double node_lon, node_lat;
53  struct keyval tags;
54  osmid_t *nds;
55  int nd_count, nd_max;
56  struct member *members;
57  int member_count, member_max;
58  osmid_t osm_id;
59  filetypes_t filetype;
60  actions_t action;
61  int extra_attributes;
62
63  // Bounding box to filter imported data
64  const char *bbox;
65
66  double minlon, minlat, maxlon, maxlat;
67};
68
69void realloc_nodes(struct osmdata_t *osmdata);
70void realloc_members(struct osmdata_t *osmdata);
71void resetMembers(struct osmdata_t *osmdata);
72void printStatus(struct osmdata_t *osmdata);
73int node_wanted(struct osmdata_t *osmdata, double lat, double lon);
74
75/* exit_nicely - called to cleanup after fatal error */
76void exit_nicely(void);
77
78#endif
Note: See TracBrowser for help on using the repository browser.