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

Revision 26664, 1.9 KB checked in by apmon, 3 years ago (diff)

[Osm2pgsql] Add an option to disable parallel indexing

This is a patch by Hartmut Holzgraefe (  https://github.com/hholzgra/osm2pgsql/commit/f779298ba9b2cc84b3949f3fd4b684ea64bcee34),
although it was adapted to have parallel indexing the default and the option disables it.

Under the conditions I have tested, parallel indexing seemed to be slightly faster than sequential indexing, but that may depend
on hard and or software, as well as the size of the planet (extract) to import, hence the option to disable it.

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        time_t  start_node, start_way, start_rel;
46
47  struct output_t *out;
48
49/* Since {node,way} elements are not nested we can guarantee the
50   values in an end tag must match those of the corresponding
51   start tag and can therefore be cached.
52*/
53  double node_lon, node_lat;
54  struct keyval tags;
55  osmid_t *nds;
56  int nd_count, nd_max;
57  struct member *members;
58  int member_count, member_max;
59  osmid_t osm_id;
60  filetypes_t filetype;
61  actions_t action;
62  int extra_attributes;
63
64  // Bounding box to filter imported data
65  const char *bbox;
66
67  double minlon, minlat, maxlon, maxlat;
68
69  int parallel_indexing;
70};
71
72void realloc_nodes(struct osmdata_t *osmdata);
73void realloc_members(struct osmdata_t *osmdata);
74void resetMembers(struct osmdata_t *osmdata);
75void printStatus(struct osmdata_t *osmdata);
76int node_wanted(struct osmdata_t *osmdata, double lat, double lon);
77
78/* exit_nicely - called to cleanup after fatal error */
79void exit_nicely(void);
80
81#endif
Note: See TracBrowser for help on using the repository browser.