Skip to content
This repository
Newer
Older
100644 706 lines (634 sloc) 28.079 kb
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
1 /*
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
2 #-----------------------------------------------------------------------------
3 # osm2pgsql - converts planet.osm file into PostgreSQL
4 # compatible output suitable to be rendered by mapnik
5 # Use: osm2pgsql planet.osm.bz2
6 #-----------------------------------------------------------------------------
7 # Original Python implementation by Artem Pavlenko
8 # Re-implementation by Jon Burgess, Copyright 2006
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License
12 # as published by the Free Software Foundation; either version 2
13 # of the License, or (at your option) any later version.
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
14 #
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
19 #
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #-----------------------------------------------------------------------------
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
24 */
25
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
26 #include "config.h"
27
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
28 #define _GNU_SOURCE
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
29 #include <stdio.h>
30 #include <unistd.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <assert.h>
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
34 #include <getopt.h>
ef591d07 » jonb
2009-02-11 osm2plsql: Use svnversion for version string. Update to version 0.65.…
35 #include <libgen.h>
80dbadbc » giggls
2010-11-06 Auto-detect filetype pbf/osm based on file extension if no Input fron…
36 #include <time.h>
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
37
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
38 #include <libpq-fe.h>
39
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
40 #include <libxml/xmlstring.h>
41 #include <libxml/xmlreader.h>
42
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
43 #include "osmtypes.h"
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
44 #include "build_geometry.h"
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
45 #include "middle-pgsql.h"
46 #include "middle-ram.h"
e3d6404c » apmon
2011-10-16 Optimize node ram cache for sparse node representation
47 #include "node-ram-cache.h"
128b667b » jonb
2009-01-04 Fix compile problem by removing output-gazetteer.h reference
48 #include "output-pgsql.h"
b8ab6f7e » tomhughes
2009-04-30 Initial work on generating a gazetteer database.
49 #include "output-gazetteer.h"
6024f4c1 » zere
2009-04-30 Use bzip2 interface directly, rather than through the zlib compatibil…
50 #include "output-null.h"
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
51 #include "sanitizer.h"
52 #include "reprojection.h"
44e32bf2 » jonb
2007-08-19 osm2pgsql 0.04: Further improve handling of polygons with holes. Redu…
53 #include "text-tree.h"
447ad84e » jonb
2007-09-07 osm2pgsql 0.07: Make UTF8sanitize optional since it is generally no l…
54 #include "input.h"
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
55 #include "sprompt.h"
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
56 #include "parse-xml2.h"
57 #include "parse-primitive.h"
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
58
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
59 #ifdef BUILD_READER_PBF
60 # include "parse-pbf.h"
61 #endif
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
62
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
63 #define INIT_MAX_MEMBERS 64
64 #define INIT_MAX_NODES 4096
65
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
66 int verbose;
67
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
68 // Data structure carrying all parsing related variables
69 static struct osmdata_t osmdata = {
70 .filetype = FILETYPE_NONE,
71 .action = ACTION_NONE,
72 .bbox = NULL
73 };
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
74
803065e3 » jonb
2007-09-02 osm2pgsql: Allow multiple .osm files to be imported simultaneoulsy, e…
75
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
76 static int parse_bbox(struct osmdata_t *osmdata)
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
77 {
78 int n;
79
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
80 if (!osmdata->bbox)
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
81 return 0;
82
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
83 n = sscanf(osmdata->bbox, "%lf,%lf,%lf,%lf", &(osmdata->minlon), &(osmdata->minlat), &(osmdata->maxlon), &(osmdata->maxlat));
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
84 if (n != 4) {
85 fprintf(stderr, "Bounding box must be specified like: minlon,minlat,maxlon,maxlat\n");
86 return 1;
87 }
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
88 if (osmdata->maxlon <= osmdata->minlon) {
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
89 fprintf(stderr, "Bounding box failed due to maxlon <= minlon\n");
90 return 1;
91 }
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
92 if (osmdata->maxlat <= osmdata->minlat) {
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
93 fprintf(stderr, "Bounding box failed due to maxlat <= minlat\n");
94 return 1;
95 }
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
96 printf("Applying Bounding box: %f,%f to %f,%f\n", osmdata->minlon, osmdata->minlat, osmdata->maxlon, osmdata->maxlat);
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
97 return 0;
98 }
99
42db89f0 » jonb
2009-12-19 Allow user,uid,version & timestamp attributes to be imported from osm…
100
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
101
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
102 void exit_nicely()
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
103 {
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
104 fprintf(stderr, "Error occurred, cleaning up\n");
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
105 osmdata.out->cleanup();
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
106 exit(1);
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
107 }
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
108
ef591d07 » jonb
2009-02-11 osm2plsql: Use svnversion for version string. Update to version 0.65.…
109 static void short_usage(char *arg0)
110 {
111 const char *name = basename(arg0);
112
113 fprintf(stderr, "Usage error. For further information see:\n");
114 fprintf(stderr, "\t%s -h|--help\n", name);
115 }
116
117 static void long_usage(char *arg0)
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
118 {
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
119 int i;
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
120 const char *name = basename(arg0);
121
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
122 printf("Usage:\n");
123 printf("\t%s [options] planet.osm\n", name);
124 printf("\t%s [options] planet.osm.{gz,bz2}\n", name);
125 printf("\t%s [options] file1.osm file2.osm file3.osm\n", name);
126 printf("\nThis will import the data from the OSM file(s) into a PostgreSQL database\n");
127 printf("suitable for use by the Mapnik renderer\n");
128 printf("\nOptions:\n");
129 printf(" -a|--append\t\tAdd the OSM file into the database without removing\n");
130 printf(" \t\texisting data.\n");
131 printf(" -b|--bbox\t\tApply a bounding box filter on the imported data\n");
132 printf(" \t\tMust be specified as: minlon,minlat,maxlon,maxlat\n");
133 printf(" \t\te.g. --bbox -0.5,51.25,0.5,51.75\n");
134 printf(" -c|--create\t\tRemove existing data from the database. This is the \n");
135 printf(" \t\tdefault if --append is not specified.\n");
136 printf(" -d|--database\tThe name of the PostgreSQL database to connect\n");
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
137 printf(" \t\tto (default: gis).\n");
138 printf(" -i|--tablespace-index\tThe name of the PostgreSQL tablespace where\n");
2d9680fc » frederik
2011-03-22 fix tablespaces AGAIN. problem was that with no tablespaces specified,
139 printf(" \t\tall indexes will be created.\n");
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
140 printf(" \t\tThe following options allow more fine-grained control:\n");
141 printf(" --tablespace-main-data \ttablespace for main tables\n");
142 printf(" --tablespace-main-index\ttablespace for main table indexes\n");
143 printf(" --tablespace-slim-data \ttablespace for slim mode tables\n");
144 printf(" --tablespace-slim-index\ttablespace for slim mode indexes\n");
2d9680fc » frederik
2011-03-22 fix tablespaces AGAIN. problem was that with no tablespaces specified,
145 printf(" \t\t(if unset, use db's default; -i is equivalent to setting\n");
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
146 printf(" \t\t--tablespace-main-index and --tablespace-slim-index)\n");
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
147 printf(" -l|--latlong\t\tStore data in degrees of latitude & longitude.\n");
148 printf(" -m|--merc\t\tStore data in proper spherical mercator (default)\n");
149 printf(" -M|--oldmerc\t\tStore data in the legacy OSM mercator format\n");
150 printf(" -E|--proj num\tUse projection EPSG:num\n");
151 printf(" -u|--utf8-sanitize\tRepair bad UTF8 input data (present in planet\n");
152 printf(" \tdumps prior to August 2007). Adds about 10%% overhead.\n");
153 printf(" -p|--prefix\t\tPrefix for table names (default planet_osm)\n");
154 printf(" -s|--slim\t\tStore temporary data in the database. This greatly\n");
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
155 printf(" \t\treduces the RAM usage but is much slower. This switch is\n");
156 printf(" \t\trequired if you want to update with --append later.\n");
9428f371 » feixm
2010-04-07 When running on 32bit systems, userprocess can allocate as much
157
158 if (sizeof(int*) == 4) {
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
159 printf(" \t\tThis program was compiled on a 32bit system, so at most\n");
160 printf(" \t\t3GB of RAM will be used. If you encounter problems\n");
161 printf(" \t\tduring import, you should try this switch.\n");
9428f371 » feixm
2010-04-07 When running on 32bit systems, userprocess can allocate as much
162 }
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
163 printf(" --drop\t\tonly with --slim: drop temporary tables after import (no updates).\n");
9428f371 » feixm
2010-04-07 When running on 32bit systems, userprocess can allocate as much
164
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
165 printf(" -S|--style\t\tLocation of the style file. Defaults to " OSM2PGSQL_DATADIR "/default.style\n");
7f19f4f0 » frederik
2011-11-11 do not require dpatch; change help text
166 printf(" -C|--cache\t\tNow required for slim and non-slim modes: \n");
167 printf(" \t\tUse up to this many MB for caching nodes (default: 800)\n");
1b8b757d » giggls
2011-09-02 2 minor changes:
168 printf(" -U|--username\tPostgresql user name\n");
169 printf(" \t\tpassword can be given by prompt or PGPASS environment variable.\n");
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
170 printf(" -W|--password\tForce password prompt.\n");
171 printf(" -H|--host\t\tDatabase server hostname or socket location.\n");
172 printf(" -P|--port\t\tDatabase server port.\n");
173 printf(" -e|--expire-tiles [min_zoom-]max_zoom\tCreate a tile expiry list.\n");
174 printf(" -o|--expire-output filename\tOutput filename for expired tiles list.\n");
175 printf(" -r|--input-reader\tInput frontend.\n");
176 printf(" \t\tlibxml2 - Parse XML using libxml2. (default)\n");
177 printf(" \t\tprimitive - Primitive XML parsing.\n");
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
178 #ifdef BUILD_READER_PBF
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
179 printf(" \t\tpbf - OSM binary format.\n");
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
180 #endif
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
181 printf(" -O|--output\t\tOutput backend.\n");
182 printf(" \t\tpgsql - Output to a PostGIS database. (default)\n");
183 printf(" \t\tgazetteer - Output to a PostGIS database suitable for gazetteer\n");
184 printf(" \t\tnull - No output. Useful for testing.\n");
185 printf(" -x|--extra-attributes\n");
186 printf(" \t\tInclude attributes for each object in the database.\n");
187 printf(" \t\tThis includes the username, userid, timestamp and version.\n");
188 printf(" \t\tNote: this option also requires additional entries in your style file.\n");
a25883a4 » giggls
2011-03-24 Minor rework of hstore functionality:
189 printf(" -k|--hstore\t\tAdd tags without column to an additional hstore (key/value) column to postgresql tables\n");
bfd1531b » frederik
2012-03-27 new osm2pgsql configuration option --hstore-match-only, intended to b…
190 printf(" --hstore-match-only\tOnly keep objects that have a value in one of the columns\n");
191 printf(" - \t(normal action with --hstore is to keep all objects)\n");
ae223991 » giggls
2011-04-04 Fix bug in hstore rework.
192 printf(" -j|--hstore-all\tAdd all tags to an additional hstore (key/value) column in postgresql tables\n");
a25883a4 » giggls
2011-03-24 Minor rework of hstore functionality:
193 printf(" -z|--hstore-column\tAdd an additional hstore (key/value) column containing all tags\n");
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
194 printf(" \tthat start with the specified string, eg --hstore-column \"name:\" will\n");
195 printf(" \tproduce an extra hstore column that contains all name:xx tags\n");
246432b1 » jonb
2010-12-05 osm2pgsql: Add command line switch to include natural=coastline ways …
196 printf(" -G|--multi-geometry\tGenerate multi-geometry features in postgresql tables.\n");
197 printf(" -K|--keep-coastlines\tKeep coastline data rather than filtering it out.\n");
198 printf(" \t\tBy default natural=coastline tagged data will be discarded based on the\n");
199 printf(" \t\tassumption that post-processed Coastline Checker shapefiles will be used.\n");
74608f20 » apmon
2011-10-16 [osm2pgsql] Parralellize pending ways / relations
200 printf(" --number-processes\t\tSpecifies the number of parallel processes used for certain operations\n");
e887d774 » apmon
2011-11-13 [osm2pgsql] - Change default to not use parallel processing
201 printf(" \t\tDefault is 1\n");
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
202 printf(" -I|--disable-parallel-indexing\tDisable indexing all tables concurrently.\n");
17ce900b » frederik
2012-04-16 fix help message
203 printf(" --unlogged\tUse unlogged tables (lost on crash but faster). Requires PostgreSQL 9.1.\n");
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
204 printf(" --cache-strategy\tSpecifies the method used to cache nodes in ram.\n");
e3d6404c » apmon
2011-10-16 Optimize node ram cache for sparse node representation
205 printf(" \t\tAvailable options are:\n");
206 printf(" \t\tdense: caching strategy optimised for full planet import\n");
207 printf(" \t\tchunked: caching strategy optimised for non-contigouse memory allocation\n");
208 printf(" \t\tsparse: caching strategy optimised for small extracts\n");
209 printf(" \t\toptimized: automatically combines dense and sparse strategies for optimal storage efficiency.\n");
210 printf(" \t\t optimized may use twice as much virtual memory, but no more physical memory\n");
211 #ifdef __amd64__
212 printf(" \t\t The default is \"optimized\"\n");
213 #else
214 /* use "chunked" as a default in 32 bit compilations, as it is less wasteful of virtual memory than "optimized"*/
215 printf(" \t\t The default is \"chunked\"\n");
216 #endif
217
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
218 printf(" -h|--help\t\tHelp information.\n");
219 printf(" -v|--verbose\t\tVerbose output.\n");
220 printf("\n");
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
221 if(!verbose)
0f9ae55d » martinvoosterhout
2008-03-22 Add support for a -E|--proj option which allows users to use any epsg
222 {
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
223 printf("Add -v to display supported projections.\n");
224 printf("Use -E to access any espg projections (usually in /usr/share/proj/epsg)\n" );
0f9ae55d » martinvoosterhout
2008-03-22 Add support for a -E|--proj option which allows users to use any epsg
225 }
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
226 else
227 {
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
228 printf("Supported projections:\n" );
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
229 for(i=0; i<PROJ_COUNT; i++ )
230 {
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
231 printf( "%-20s(%2s) SRS:%6d %s\n",
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
232 Projection_Info[i].descr, Projection_Info[i].option, Projection_Info[i].srs, Projection_Info[i].proj4text);
233 }
234 }
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
235 }
236
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
237 const char *build_conninfo(const char *db, const char *username, const char *password, const char *host, const char *port)
238 {
239 static char conninfo[1024];
240
241 conninfo[0]='\0';
242 strcat(conninfo, "dbname='");
243 strcat(conninfo, db);
244 strcat(conninfo, "'");
245
246 if (username) {
247 strcat(conninfo, " user='");
248 strcat(conninfo, username);
249 strcat(conninfo, "'");
250 }
251 if (password) {
252 strcat(conninfo, " password='");
253 strcat(conninfo, password);
254 strcat(conninfo, "'");
255 }
256 if (host) {
257 strcat(conninfo, " host='");
258 strcat(conninfo, host);
259 strcat(conninfo, "'");
260 }
261 if (port) {
262 strcat(conninfo, " port='");
263 strcat(conninfo, port);
264 strcat(conninfo, "'");
265 }
266
267 return conninfo;
268 }
269
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
270 void realloc_nodes(struct osmdata_t *osmdata)
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
271 {
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
272 if( osmdata->nd_max == 0 )
273 osmdata->nd_max = INIT_MAX_NODES;
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
274 else
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
275 osmdata->nd_max <<= 1;
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
276
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
277 osmdata->nds = realloc( osmdata->nds, osmdata->nd_max * sizeof( osmdata->nds[0] ) );
278 if( !osmdata->nds )
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
279 {
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
280 fprintf( stderr, "Failed to expand node list to %d\n", osmdata->nd_max );
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
281 exit_nicely();
282 }
283 }
284
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
285 void realloc_members(struct osmdata_t *osmdata)
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
286 {
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
287 if( osmdata->member_max == 0 )
288 osmdata->member_max = INIT_MAX_NODES;
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
289 else
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
290 osmdata->member_max <<= 1;
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
291
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
292 osmdata->members = realloc( osmdata->members, osmdata->member_max * sizeof( osmdata->members[0] ) );
293 if( !osmdata->members )
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
294 {
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
295 fprintf( stderr, "Failed to expand member list to %d\n", osmdata->member_max );
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
296 exit_nicely();
297 }
298 }
299
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
300 void resetMembers(struct osmdata_t *osmdata)
301 {
ab561df6 » hholzgra
2010-11-07 fixed some warnings, code compiles clean with
302 for(unsigned i = 0; i < osmdata->member_count; i++ )
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
303 free( osmdata->members[i].role );
304 }
305
306 void printStatus(struct osmdata_t *osmdata)
307 {
8c21f8c3 » apmon
2011-08-28 [osm2pgsql] Report some more timing information to see where osm2pgsq…
308 time_t now;
309 time(&now);
310 time_t end_nodes = osmdata->start_way > 0 ? osmdata->start_way : now;
311 time_t end_way = osmdata->start_rel > 0 ? osmdata->start_rel : now;
312 time_t end_rel = now;
313 fprintf(stderr, "\rProcessing: Node(%" PRIdOSMID "k %.1fk/s) Way(%" PRIdOSMID "k %.2fk/s) Relation(%" PRIdOSMID " %.2f/s)",
314 osmdata->count_node/1000,
315 (double)osmdata->count_node/1000.0/((int)(end_nodes - osmdata->start_node) > 0 ? (double)(end_nodes - osmdata->start_node) : 1.0),
316 osmdata->count_way/1000,
317 osmdata->count_way > 0 ? (double)osmdata->count_way/1000.0/
318 ((double)(end_way - osmdata->start_way) > 0.0 ? (double)(end_way - osmdata->start_way) : 1.0) : 0.0,
319 osmdata->count_rel,
320 osmdata->count_rel > 0 ? (double)osmdata->count_rel/
321 ((double)(end_rel - osmdata->start_rel) > 0.0 ? (double)(end_rel - osmdata->start_rel) : 1.0) : 0.0);
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
322 }
323
324 int node_wanted(struct osmdata_t *osmdata, double lat, double lon)
325 {
326 if (!osmdata->bbox)
327 return 1;
328
329 if (lat < osmdata->minlat || lat > osmdata->maxlat)
330 return 0;
331 if (lon < osmdata->minlon || lon > osmdata->maxlon)
332 return 0;
333 return 1;
334 }
335
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
336 int main(int argc, char *argv[])
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
337 {
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
338 int append=0;
339 int create=0;
340 int slim=0;
447ad84e » jonb
2007-09-07 osm2pgsql 0.07: Make UTF8sanitize optional since it is generally no l…
341 int sanitize=0;
674cbc50 » jonb
2009-10-06 Apply fix from Milo to display projection information when executed w…
342 int long_usage_bool=0;
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
343 int pass_prompt=0;
44374416 » jonb
2008-06-18 osm2pgsql: Make spherical mercator the default, old format is now -M|…
344 int projection = PROJ_SPHERE_MERC;
a635604f » stevehill
2009-02-08 Adds tile expiry support - see http://lists.openstreetmap.org/piperma…
345 int expire_tiles_zoom = -1;
4db09cbe » stevehill
2009-02-11 Replace the in-memory dirty tile store with something a bit more effi…
346 int expire_tiles_zoom_min = -1;
a25883a4 » giggls
2011-03-24 Minor rework of hstore functionality:
347 int enable_hstore = HSTORE_NONE;
bfd1531b » frederik
2012-03-27 new osm2pgsql configuration option --hstore-match-only, intended to b…
348 int hstore_match_only = 0;
c022af68 » jonb
2009-12-19 osm2pgsql: Apply multipolygon patch from Twain with a few changes.
349 int enable_multi = 0;
69abcd0c » apmon
2011-09-17 [Osm2pgsql] Add an option to disable parallel indexing
350 int parallel_indexing = 1;
e3d6404c » apmon
2011-10-16 Optimize node ram cache for sparse node representation
351 #ifdef __amd64__
352 int alloc_chunkwise = ALLOC_SPARSE | ALLOC_DENSE;
353 #else
b2b2e4da » apmon
2011-10-17 [osm2pgsql] Fix some bugs introduced by the previous commits
354 int alloc_chunkwise = ALLOC_DENSE_CHUNK | ALLOC_DENSE;
e3d6404c » apmon
2011-10-16 Optimize node ram cache for sparse node representation
355 #endif
e887d774 » apmon
2011-11-13 [osm2pgsql] - Change default to not use parallel processing
356 int num_procs = 1;
3277fc9e » frederik
2011-10-27 new --drop flag drops temporary tables after --slim import, saving ti…
357 int droptemp = 0;
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
358 int unlogged = 0;
a635604f » stevehill
2009-02-08 Adds tile expiry support - see http://lists.openstreetmap.org/piperma…
359 const char *expire_tiles_filename = "dirty_tiles";
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
360 const char *db = "gis";
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
361 const char *username=NULL;
362 const char *host=NULL;
363 const char *password=NULL;
364 const char *port = "5432";
2d9680fc » frederik
2011-03-22 fix tablespaces AGAIN. problem was that with no tablespaces specified,
365 const char *tblsmain_index = NULL; // no default TABLESPACE for index on main tables
366 const char *tblsmain_data = NULL; // no default TABLESPACE for main tables
367 const char *tblsslim_index = NULL; // no default TABLESPACE for index on slim mode tables
368 const char *tblsslim_data = NULL; // no default TABLESPACE for slim mode tables
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
369 const char *conninfo = NULL;
562875b2 » martinvoosterhout
2007-11-23 Add support for a --prefix option so that you can easily run multiple…
370 const char *prefix = "planet_osm";
a7bb1b49 » jonb
2010-05-15 osm2pgsql: Add C++ compiler into autoconf. Rename DATADIR to prevent …
371 const char *style = OSM2PGSQL_DATADIR "/default.style";
4db09cbe » stevehill
2009-02-11 Replace the in-memory dirty tile store with something a bit more effi…
372 const char *temparg;
d76bd7df » zere
2009-04-30 Changed terminology for choosable backend.
373 const char *output_backend = "pgsql";
80dbadbc » giggls
2010-11-06 Auto-detect filetype pbf/osm based on file extension if no Input fron…
374 const char *input_reader = "auto";
5a775397 » mazdermind
2010-07-19 add hstore-column option, which allows to create specific hstore colu…
375 const char **hstore_columns = NULL;
376 int n_hstore_columns = 0;
246432b1 » jonb
2010-12-05 osm2pgsql: Add command line switch to include natural=coastline ways …
377 int keep_coastlines=0;
5701c4a6 » martinvoosterhout
2008-04-12 Add a caching level to the slim-mode with configurable size, so it ac…
378 int cache = 800;
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
379 struct output_options options;
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
380 PGconn *sql_conn;
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
381
382 int (*streamFile)(char *, int, struct osmdata_t *);
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
383
7fc24c69 » frederik
2011-08-03 rename osm2pgsql-64 to osm2pgsql. this is now the new default branch.
384 printf("osm2pgsql SVN version %s (%lubit id space)\n\n", VERSION, 8 * sizeof(osmid_t));
2a8ea5b2 » jonb
2007-08-12 osm2pgsql: Remove hard coded maximum IDs. Support negative IDs. Add R…
385
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
386 while (1) {
387 int c, option_index = 0;
388 static struct option long_options[] = {
389 {"append", 0, 0, 'a'},
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
390 {"bbox", 1, 0, 'b'},
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
391 {"create", 0, 0, 'c'},
392 {"database", 1, 0, 'd'},
447ad84e » jonb
2007-09-07 osm2pgsql 0.07: Make UTF8sanitize optional since it is generally no l…
393 {"latlong", 0, 0, 'l'},
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
394 {"verbose", 0, 0, 'v'},
395 {"slim", 0, 0, 's'},
562875b2 » martinvoosterhout
2007-11-23 Add support for a --prefix option so that you can easily run multiple…
396 {"prefix", 1, 0, 'p'},
0f9ae55d » martinvoosterhout
2008-03-22 Add support for a -E|--proj option which allows users to use any epsg
397 {"proj", 1, 0, 'E'},
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
398 {"merc", 0, 0, 'm'},
44374416 » jonb
2008-06-18 osm2pgsql: Make spherical mercator the default, old format is now -M|…
399 {"oldmerc", 0, 0, 'M'},
447ad84e » jonb
2007-09-07 osm2pgsql 0.07: Make UTF8sanitize optional since it is generally no l…
400 {"utf8-sanitize", 0, 0, 'u'},
5701c4a6 » martinvoosterhout
2008-04-12 Add a caching level to the slim-mode with configurable size, so it ac…
401 {"cache", 1, 0, 'C'},
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
402 {"username", 1, 0, 'U'},
403 {"password", 0, 0, 'W'},
404 {"host", 1, 0, 'H'},
405 {"port", 1, 0, 'P'},
bfefb619 » rodo
2010-06-09 Add an option to Create indexes on a different tablespace, close #2988
406 {"tablespace-index", 1, 0, 'i'},
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
407 {"tablespace-slim-data", 1, 0, 200},
408 {"tablespace-slim-index", 1, 0, 201},
409 {"tablespace-main-data", 1, 0, 202},
410 {"tablespace-main-index", 1, 0, 203},
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
411 {"help", 0, 0, 'h'},
e1810b62 » martinvoosterhout
2008-08-30 Allow the location of the style file to be specified on the command l…
412 {"style", 1, 0, 'S'},
a635604f » stevehill
2009-02-08 Adds tile expiry support - see http://lists.openstreetmap.org/piperma…
413 {"expire-tiles", 1, 0, 'e'},
414 {"expire-output", 1, 0, 'o'},
42db89f0 » jonb
2009-12-19 Allow user,uid,version & timestamp attributes to be imported from osm…
415 {"output", 1, 0, 'O'},
416 {"extra-attributes", 0, 0, 'x'},
5a775397 » mazdermind
2010-07-19 add hstore-column option, which allows to create specific hstore colu…
417 {"hstore", 0, 0, 'k'},
a25883a4 » giggls
2011-03-24 Minor rework of hstore functionality:
418 {"hstore-all", 0, 0, 'j'},
5a775397 » mazdermind
2010-07-19 add hstore-column option, which allows to create specific hstore colu…
419 {"hstore-column", 1, 0, 'z'},
bfd1531b » frederik
2012-03-27 new osm2pgsql configuration option --hstore-match-only, intended to b…
420 {"hstore-match-only", 0, 0, 208},
c022af68 » jonb
2009-12-19 osm2pgsql: Apply multipolygon patch from Twain with a few changes.
421 {"multi-geometry", 0, 0, 'G'},
246432b1 » jonb
2010-12-05 osm2pgsql: Add command line switch to include natural=coastline ways …
422 {"keep-coastlines", 0, 0, 'K'},
423 {"input-reader", 1, 0, 'r'},
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
424 {"version", 0, 0, 'V'},
69abcd0c » apmon
2011-09-17 [Osm2pgsql] Add an option to disable parallel indexing
425 {"disable-parallel-indexing", 0, 0, 'I'},
e3d6404c » apmon
2011-10-16 Optimize node ram cache for sparse node representation
426 {"cache-strategy", 1, 0, 204},
74608f20 » apmon
2011-10-16 [osm2pgsql] Parralellize pending ways / relations
427 {"number-processes", 1, 0, 205},
3277fc9e » frederik
2011-10-27 new --drop flag drops temporary tables after --slim import, saving ti…
428 {"drop", 0, 0, 206},
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
429 {"unlogged", 0, 0, 207},
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
430 {0, 0, 0, 0}
431 };
432
69abcd0c » apmon
2011-09-17 [Osm2pgsql] Add an option to disable parallel indexing
433 c = getopt_long (argc, argv, "ab:cd:KhlmMp:suvU:WH:P:i:IE:C:S:e:o:O:xkjGz:r:V", long_options, &option_index);
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
434 if (c == -1)
435 break;
436
437 switch (c) {
447ad84e » jonb
2007-09-07 osm2pgsql 0.07: Make UTF8sanitize optional since it is generally no l…
438 case 'a': append=1; break;
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
439 case 'b': osmdata.bbox=optarg; break;
447ad84e » jonb
2007-09-07 osm2pgsql 0.07: Make UTF8sanitize optional since it is generally no l…
440 case 'c': create=1; break;
441 case 'v': verbose=1; break;
442 case 's': slim=1; break;
246432b1 » jonb
2010-12-05 osm2pgsql: Add command line switch to include natural=coastline ways …
443 case 'K': keep_coastlines=1; break;
447ad84e » jonb
2007-09-07 osm2pgsql 0.07: Make UTF8sanitize optional since it is generally no l…
444 case 'u': sanitize=1; break;
0f9ae55d » martinvoosterhout
2008-03-22 Add support for a -E|--proj option which allows users to use any epsg
445 case 'l': projection=PROJ_LATLONG; break;
446 case 'm': projection=PROJ_SPHERE_MERC; break;
44374416 » jonb
2008-06-18 osm2pgsql: Make spherical mercator the default, old format is now -M|…
447 case 'M': projection=PROJ_MERC; break;
0f9ae55d » martinvoosterhout
2008-03-22 Add support for a -E|--proj option which allows users to use any epsg
448 case 'E': projection=-atoi(optarg); break;
562875b2 » martinvoosterhout
2007-11-23 Add support for a --prefix option so that you can easily run multiple…
449 case 'p': prefix=optarg; break;
447ad84e » jonb
2007-09-07 osm2pgsql 0.07: Make UTF8sanitize optional since it is generally no l…
450 case 'd': db=optarg; break;
5701c4a6 » martinvoosterhout
2008-04-12 Add a caching level to the slim-mode with configurable size, so it ac…
451 case 'C': cache = atoi(optarg); break;
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
452 case 'U': username=optarg; break;
453 case 'W': pass_prompt=1; break;
454 case 'H': host=optarg; break;
455 case 'P': port=optarg; break;
e1810b62 » martinvoosterhout
2008-08-30 Allow the location of the style file to be specified on the command l…
456 case 'S': style=optarg; break;
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
457 case 'i': tblsmain_index=tblsslim_index=optarg; break;
458 case 200: tblsslim_data=optarg; break;
459 case 201: tblsslim_index=optarg; break;
460 case 202: tblsmain_data=optarg; break;
461 case 203: tblsmain_index=optarg; break;
4db09cbe » stevehill
2009-02-11 Replace the in-memory dirty tile store with something a bit more effi…
462 case 'e':
463 expire_tiles_zoom_min = atoi(optarg);
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
464 temparg = strchr(optarg, '-');
465 if (temparg) expire_tiles_zoom = atoi(temparg + 1);
466 if (expire_tiles_zoom < expire_tiles_zoom_min) expire_tiles_zoom = expire_tiles_zoom_min;
4db09cbe » stevehill
2009-02-11 Replace the in-memory dirty tile store with something a bit more effi…
467 break;
a635604f » stevehill
2009-02-08 Adds tile expiry support - see http://lists.openstreetmap.org/piperma…
468 case 'o': expire_tiles_filename=optarg; break;
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
469 case 'O': output_backend = optarg; break;
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
470 case 'x': osmdata.extra_attributes=1; break;
a25883a4 » giggls
2011-03-24 Minor rework of hstore functionality:
471 case 'k': enable_hstore=HSTORE_NORM; break;
bfd1531b » frederik
2012-03-27 new osm2pgsql configuration option --hstore-match-only, intended to b…
472 case 208: hstore_match_only = 1; break;
473 case 'j': enable_hstore=HSTORE_ALL; break;
5a775397 » mazdermind
2010-07-19 add hstore-column option, which allows to create specific hstore colu…
474 case 'z':
475 n_hstore_columns++;
476 hstore_columns = (const char**)realloc(hstore_columns, sizeof(&n_hstore_columns) * n_hstore_columns);
477 hstore_columns[n_hstore_columns-1] = optarg;
478 break;
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
479 case 'G': enable_multi=1; break;
480 case 'r': input_reader = optarg; break;
674cbc50 » jonb
2009-10-06 Apply fix from Milo to display projection information when executed w…
481 case 'h': long_usage_bool=1; break;
69abcd0c » apmon
2011-09-17 [Osm2pgsql] Add an option to disable parallel indexing
482 case 'I':
483 #ifdef HAVE_PTHREAD
484 parallel_indexing=0;
485 #endif
486 break;
e3d6404c » apmon
2011-10-16 Optimize node ram cache for sparse node representation
487 case 204:
488 if (strcmp(optarg,"dense") == 0) alloc_chunkwise = ALLOC_DENSE;
489 if (strcmp(optarg,"chunk") == 0) alloc_chunkwise = ALLOC_DENSE | ALLOC_DENSE_CHUNK;
490 if (strcmp(optarg,"sparse") == 0) alloc_chunkwise = ALLOC_SPARSE;
491 if (strcmp(optarg,"optimized") == 0) alloc_chunkwise = ALLOC_DENSE | ALLOC_SPARSE;
492 break;
74608f20 » apmon
2011-10-16 [osm2pgsql] Parralellize pending ways / relations
493 case 205: num_procs = atoi(optarg); break;
3277fc9e » frederik
2011-10-27 new --drop flag drops temporary tables after --slim import, saving ti…
494 case 206: droptemp = 1; break;
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
495 case 207: unlogged = 1; break;
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
496 case 'V': exit(EXIT_SUCCESS);
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
497 case '?':
498 default:
ef591d07 » jonb
2009-02-11 osm2plsql: Use svnversion for version string. Update to version 0.65.…
499 short_usage(argv[0]);
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
500 exit(EXIT_FAILURE);
501 }
502 }
503
674cbc50 » jonb
2009-10-06 Apply fix from Milo to display projection information when executed w…
504 if (long_usage_bool) {
505 long_usage(argv[0]);
b7178aa8 » hholzgra
2010-11-17 std-options check requires that --help and --version output
506 exit(EXIT_SUCCESS);
674cbc50 » jonb
2009-10-06 Apply fix from Milo to display projection information when executed w…
507 }
508
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
509 if (argc == optind) { // No non-switch arguments
ef591d07 » jonb
2009-02-11 osm2plsql: Use svnversion for version string. Update to version 0.65.…
510 short_usage(argv[0]);
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
511 exit(EXIT_FAILURE);
512 }
513
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
514 if (append && create) {
515 fprintf(stderr, "Error: --append and --create options can not be used at the same time!\n");
516 exit(EXIT_FAILURE);
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
517 }
a635604f » stevehill
2009-02-08 Adds tile expiry support - see http://lists.openstreetmap.org/piperma…
518
3277fc9e » frederik
2011-10-27 new --drop flag drops temporary tables after --slim import, saving ti…
519 if (droptemp && !slim) {
520 fprintf(stderr, "Error: --drop only makes sense with --slim.\n");
521 exit(EXIT_FAILURE);
522 }
523
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
524 if (unlogged && !create) {
525 fprintf(stderr, "Warning: --unlogged only makes sense with --create; ignored.\n");
526 unlogged = 0;
527 }
528
bfd1531b » frederik
2012-03-27 new osm2pgsql configuration option --hstore-match-only, intended to b…
529 if (enable_hstore == HSTORE_NONE && hstore_match_only)
530 {
531 fprintf(stderr, "Warning: --hstore-match-only only makes sense with --hstore, --hstore-all, or --hstore-column; ignored.\n");
532 hstore_match_only = 0;
533 }
534
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
535 if (cache < 0) cache = 0;
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
536
74608f20 » apmon
2011-10-16 [osm2pgsql] Parralellize pending ways / relations
537 if (num_procs < 1) num_procs = 1;
538
a1c6e40a » tomhughes
2008-07-21 Only prompt for a password if -W/--password is given. This is what
539 if (pass_prompt)
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
540 password = simple_prompt("Password:", 100, 0);
74bfa80c » giggls
2010-06-11 * remove malloc.h for proper compi8lation on Macosx
541 else {
542 password = getenv("PGPASS");
543 }
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
544
545 conninfo = build_conninfo(db, username, password, host, port);
546 sql_conn = PQconnectdb(conninfo);
547 if (PQstatus(sql_conn) != CONNECTION_OK) {
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
548 fprintf(stderr, "Error: Connection to database failed: %s\n", PQerrorMessage(sql_conn));
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
549 exit(EXIT_FAILURE);
550 }
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
551 if (unlogged && PQserverVersion(sql_conn) < 90100) {
552 fprintf(stderr, "Error: --unlogged works only with PostgreSQL 9.1 and above, but\n");
553 fprintf(stderr, "you are using PostgreSQL %d.%d.%d.\n", PQserverVersion(sql_conn) / 10000, (PQserverVersion(sql_conn) / 100) % 100, PQserverVersion(sql_conn) % 100);
554 exit(EXIT_FAILURE);
555 }
556
5929e54f » jonb
2008-02-18 osm2pgsql: Add authentication options (user, host, port, password).
557 PQfinish(sql_conn);
558
44e32bf2 » jonb
2007-08-19 osm2pgsql 0.04: Further improve handling of polygons with holes. Redu…
559 text_init();
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
560 initList(&osmdata.tags);
630f93ed » gabriel
2007-10-07 Make changes for 0.5.
561
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
562 osmdata.count_node = osmdata.max_node = 0;
563 osmdata.count_way = osmdata.max_way = 0;
564 osmdata.count_rel = osmdata.max_rel = 0;
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
565
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
566 LIBXML_TEST_VERSION
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
567
0f9ae55d » martinvoosterhout
2008-03-22 Add support for a -E|--proj option which allows users to use any epsg
568 project_init(projection);
52047755 » martinvoosterhout
2007-11-20 Restructure the projection code so it can support more projections,
569 fprintf(stderr, "Using projection SRS %d (%s)\n",
570 project_getprojinfo()->srs, project_getprojinfo()->descr );
2a8ea5b2 » jonb
2007-08-12 osm2pgsql: Remove hard coded maximum IDs. Support negative IDs. Add R…
571
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
572 if (parse_bbox(&osmdata))
6afbea87 » jonb
2008-02-09 osm2pgsql: Add option to filter import with bounding box
573 return 1;
574
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
575 options.conninfo = conninfo;
576 options.prefix = prefix;
577 options.append = append;
578 options.slim = slim;
579 options.projection = project_getprojinfo()->srs;
580 options.scale = (projection==PROJ_LATLONG)?10000000:100;
581 options.mid = slim ? &mid_pgsql : &mid_ram;
5701c4a6 » martinvoosterhout
2008-04-12 Add a caching level to the slim-mode with configurable size, so it ac…
582 options.cache = cache;
e1810b62 » martinvoosterhout
2008-08-30 Allow the location of the style file to be specified on the command l…
583 options.style = style;
449b137f » frederik
2011-01-31 * automatically turn fastupdate off on indexes if database version is…
584 options.tblsmain_index = tblsmain_index;
585 options.tblsmain_data = tblsmain_data;
586 options.tblsslim_index = tblsslim_index;
587 options.tblsslim_data = tblsslim_data;
a635604f » stevehill
2009-02-08 Adds tile expiry support - see http://lists.openstreetmap.org/piperma…
588 options.expire_tiles_zoom = expire_tiles_zoom;
4db09cbe » stevehill
2009-02-11 Replace the in-memory dirty tile store with something a bit more effi…
589 options.expire_tiles_zoom_min = expire_tiles_zoom_min;
a635604f » stevehill
2009-02-08 Adds tile expiry support - see http://lists.openstreetmap.org/piperma…
590 options.expire_tiles_filename = expire_tiles_filename;
c022af68 » jonb
2009-12-19 osm2pgsql: Apply multipolygon patch from Twain with a few changes.
591 options.enable_multi = enable_multi;
7640a3a9 » giggls
2010-03-14 Add an experimental feature to generate hstore enabled PgSQL tables.
592 options.enable_hstore = enable_hstore;
bfd1531b » frederik
2012-03-27 new osm2pgsql configuration option --hstore-match-only, intended to b…
593 options.hstore_match_only = hstore_match_only;
5a775397 » mazdermind
2010-07-19 add hstore-column option, which allows to create specific hstore colu…
594 options.hstore_columns = hstore_columns;
595 options.n_hstore_columns = n_hstore_columns;
246432b1 » jonb
2010-12-05 osm2pgsql: Add command line switch to include natural=coastline ways …
596 options.keep_coastlines = keep_coastlines;
69abcd0c » apmon
2011-09-17 [Osm2pgsql] Add an option to disable parallel indexing
597 options.parallel_indexing = parallel_indexing;
3540ae3d » apmon
2011-09-17 [osm2pgsql] allocate node cache in one big chunk instead of small pieces
598 options.alloc_chunkwise = alloc_chunkwise;
74608f20 » apmon
2011-10-16 [osm2pgsql] Parralellize pending ways / relations
599 options.num_procs = num_procs;
3277fc9e » frederik
2011-10-27 new --drop flag drops temporary tables after --slim import, saving ti…
600 options.droptemp = droptemp;
3f12b309 » frederik
2012-02-18 support unlogged tables for postgres 9.1
601 options.unlogged = unlogged;
6024f4c1 » zere
2009-04-30 Use bzip2 interface directly, rather than through the zlib compatibil…
602
d76bd7df » zere
2009-04-30 Changed terminology for choosable backend.
603 if (strcmp("pgsql", output_backend) == 0) {
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
604 osmdata.out = &out_pgsql;
b8ab6f7e » tomhughes
2009-04-30 Initial work on generating a gazetteer database.
605 } else if (strcmp("gazetteer", output_backend) == 0) {
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
606 osmdata.out = &out_gazetteer;
d76bd7df » zere
2009-04-30 Changed terminology for choosable backend.
607 } else if (strcmp("null", output_backend) == 0) {
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
608 osmdata.out = &out_null;
6024f4c1 » zere
2009-04-30 Use bzip2 interface directly, rather than through the zlib compatibil…
609 } else {
d6471242 » frederik
2009-10-15 fix error message
610 fprintf(stderr, "Output backend `%s' not recognised. Should be one of [pgsql, gazetteer, null].\n", output_backend);
6024f4c1 » zere
2009-04-30 Use bzip2 interface directly, rather than through the zlib compatibil…
611 exit(EXIT_FAILURE);
612 }
74608f20 » apmon
2011-10-16 [osm2pgsql] Parralellize pending ways / relations
613 options.out = osmdata.out;
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
614
80dbadbc » giggls
2010-11-06 Auto-detect filetype pbf/osm based on file extension if no Input fron…
615 if (strcmp("auto", input_reader) != 0) {
616 if (strcmp("libxml2", input_reader) == 0) {
617 streamFile = &streamFileXML2;
618 } else if (strcmp("primitive", input_reader) == 0) {
619 streamFile = &streamFilePrimitive;
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
620 #ifdef BUILD_READER_PBF
80dbadbc » giggls
2010-11-06 Auto-detect filetype pbf/osm based on file extension if no Input fron…
621 } else if (strcmp("pbf", input_reader) == 0) {
622 streamFile = &streamFilePbf;
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
623 #endif
80dbadbc » giggls
2010-11-06 Auto-detect filetype pbf/osm based on file extension if no Input fron…
624 } else {
625 fprintf(stderr, "Input parser `%s' not recognised. Should be one of [libxml2, primitive"
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
626 #ifdef BUILD_READER_PBF
627 ", pbf"
628 #endif
629 "].\n", input_reader);
630 exit(EXIT_FAILURE);
80dbadbc » giggls
2010-11-06 Auto-detect filetype pbf/osm based on file extension if no Input fron…
631 }
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
632 }
633
8c21f8c3 » apmon
2011-08-28 [osm2pgsql] Report some more timing information to see where osm2pgsq…
634 time_t overall_start, overall_end;
635 time(&overall_start);
636
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
637 osmdata.out->start(&options);
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
638
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
639 realloc_nodes(&osmdata);
640 realloc_members(&osmdata);
803065e3 » jonb
2007-09-02 osm2pgsql: Allow multiple .osm files to be imported simultaneoulsy, e…
641
12308aac » rodo
2010-05-20 Do not warn about slim option on 32nits system if option is enabled
642 if (sizeof(int*) == 4 && options.slim != 1) {
9428f371 » feixm
2010-04-07 When running on 32bit systems, userprocess can allocate as much
643 fprintf(stderr, "\n!! You are running this on 32bit system, so at most\n");
644 fprintf(stderr, "!! 3GB of RAM can be used. If you encounter unexpected\n");
645 fprintf(stderr, "!! exceptions during import, you should try running in slim\n");
646 fprintf(stderr, "!! mode using parameter -s.\n");
647 }
648
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
649 while (optind < argc) {
80dbadbc » giggls
2010-11-06 Auto-detect filetype pbf/osm based on file extension if no Input fron…
650 /* if input_reader is not forced by -r switch try to auto-detect it
651 by file extension */
652 if (strcmp("auto", input_reader) == 0) {
653 #ifdef BUILD_READER_PBF
654 if (strcasecmp(".pbf",argv[optind]+strlen(argv[optind])-4) == 0) {
655 streamFile = &streamFilePbf;
656 } else {
657 streamFile = &streamFileXML2;
658 }
659 #else
660 streamFile = &streamFileXML2;
661 #endif
662 }
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
663 time_t start, end;
664
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
665 fprintf(stderr, "\nReading in file: %s\n", argv[optind]);
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
666 time(&start);
667 if (streamFile(argv[optind], sanitize, &osmdata) != 0)
803065e3 » jonb
2007-09-02 osm2pgsql: Allow multiple .osm files to be imported simultaneoulsy, e…
668 exit_nicely();
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
669 time(&end);
670 fprintf(stderr, " parse time: %ds\n", (int)(end - start));
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
671 optind++;
803065e3 » jonb
2007-09-02 osm2pgsql: Allow multiple .osm files to be imported simultaneoulsy, e…
672 }
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
673
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
674 xmlCleanupParser();
675 xmlMemoryDump();
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
676
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
677 if (osmdata.count_node || osmdata.count_way || osmdata.count_rel) {
8c21f8c3 » apmon
2011-08-28 [osm2pgsql] Report some more timing information to see where osm2pgsq…
678 time_t now;
679 time(&now);
680 time_t end_nodes = osmdata.start_way > 0 ? osmdata.start_way : now;
681 time_t end_way = osmdata.start_rel > 0 ? osmdata.start_rel : now;
682 time_t end_rel = now;
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
683 fprintf(stderr, "\n");
8c21f8c3 » apmon
2011-08-28 [osm2pgsql] Report some more timing information to see where osm2pgsq…
684 fprintf(stderr, "Node stats: total(%" PRIdOSMID "), max(%" PRIdOSMID ") in %is\n", osmdata.count_node, osmdata.max_node,
685 osmdata.count_node > 0 ? (int)(end_nodes - osmdata.start_node) : 0);
686 fprintf(stderr, "Way stats: total(%" PRIdOSMID "), max(%" PRIdOSMID ") in %is\n", osmdata.count_way, osmdata.max_way,
687 osmdata.count_way > 0 ? (int)(end_way - osmdata.start_way) : 0);
688 fprintf(stderr, "Relation stats: total(%" PRIdOSMID "), max(%" PRIdOSMID ") in %is\n", osmdata.count_rel, osmdata.max_rel,
689 osmdata.count_rel > 0 ? (int)(end_rel - osmdata.start_rel) : 0);
81ea2711 » jonb
2007-09-03 osm2pgsql version 0.06. Add command line options to select database n…
690 }
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
691 osmdata.out->stop();
c425fdc6 » martinvoosterhout
2008-04-11 Commit many new changes to osm2pgsql, including:
692
a2476330 » hholzgra
2010-11-06 * improved configure setup (including automake and libtool)
693 free(osmdata.nds);
694 free(osmdata.members);
5a775397 » mazdermind
2010-07-19 add hstore-column option, which allows to create specific hstore colu…
695
696 // free the column pointer buffer
697 free(hstore_columns);
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
698
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
699 project_exit();
803065e3 » jonb
2007-09-02 osm2pgsql: Allow multiple .osm files to be imported simultaneoulsy, e…
700 text_exit();
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
701 fprintf(stderr, "\n");
8c21f8c3 » apmon
2011-08-28 [osm2pgsql] Report some more timing information to see where osm2pgsq…
702 time(&overall_end);
703 fprintf(stderr, "Osm2pgsql took %ds overall\n", (int)(overall_end - overall_start));
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
704
43d6ebe5 » jonb
2007-05-07 osm2pgsql - make experimental version current, move previous implemen…
705 return 0;
77590e24 » joerg
2007-04-21 move utils to applications. This way it should be easier to build
706 }
Something went wrong with that request. Please try again.