"n amenity=biergarten poi_biergarten\n"
"n historic=boundary_stone poi_boundary_stone\n"
"n historic=castle poi_castle\n"
+ "n historic=ruins poi_ruins\n"
"n Annehmlichkeit=Hochsitz poi_hunting_stand\n"
"n amenity=hunting_stand poi_hunting_stand\n"
"n historic=memorial poi_memorial\n"
"n amenity=toilets poi_toilets\n"
"n tourism=viewpoint poi_viewpoint\n"
"w *=* street_unkn\n"
+ "w contour_ext=elevation_major height_line_1\n"
+ "w contour_ext=elevation_medium height_line_2\n"
+ "w contour_ext=elevation_minor height_line_3\n"
"w amenity=place_of_worship poly_building\n"
"w building=* poly_building\n"
"w aeroway=aerodrome poly_airport\n"
"w highway=path,bicycle=designated cycleway\n"
"w highway=footway footway\n"
"w piste:type=nordic piste_nordic\n"
+ "w highway=footway,piste:type=nordic footway_and_piste_nordic\n"
"w route=ski piste_nordic\n"
"w piste:type=downhill,piste:difficulty=novice piste_downhill_novice\n"
"w piste:type=downhill,piste:difficulty=easy piste_downhill_easy\n"
int count;
struct rect r;
} country_table[] = {
- { 40,"Austria,�sterreich,AUT"},
- {124,"Canada"},
- {208,"Denmark,Danmark,DK"},
- {246,"Finland,Suomi"},
- {250,"France,R�publique fran�aise,FR"},
- {276,"Germany,Deutschland,Bundesrepublik Deutschland"},
- {380,"Italy,Italia"},
- {578,"Norway,Norge,Noreg,NO"},
- {752,"Sweden,Sverige,Konungariket Sverige,SE"},
- {528,"Nederland,The Netherlands,Niederlande,NL"},
- {724,"Spain,Espana,Espana,Reino de Espana"},
+ { 40,"Austria,�sterreich,AUT"},
+ {124,"Canada"},
+ {208,"Denmark,Danmark,DK"},
+ {246,"Finland,Suomi"},
+ {250,"France,R�publique fran�aise,FR"},
+ {276,"Germany,Deutschland,Bundesrepublik Deutschland"},
+ {380,"Italy,Italia"},
+ {528,"Nederland,The Netherlands,Niederlande,NL"},
+ {578,"Norway,Norge,Noreg,NO"},
+ {724,"Spain,Espana,Espana,Reino de Espana"},
+ {752,"Sweden,Sverige,Konungariket Sverige,SE"},
{756,"Schweiz"},
+ {826,"United Kingdom,UK"},
{840,"USA"}
};
}
static void
+item_buffer_set_type(char *buffer, enum item_type type)
+{
+ struct item_bin *ib=(struct item_bin *) buffer;
+ ib->clen=0;
+ ib->len=2;
+ ib->type=type;
+}
+
+static void
+item_buffer_add_coord(char *buffer, struct coord *c, int count)
+{
+ struct item_bin *ib=(struct item_bin *) buffer;
+ struct coord *c2=(struct coord *)(ib+1);
+ c2+=ib->clen/2;
+ memcpy(c2, c, count*sizeof(struct coord));
+ ib->clen+=count*2;
+ ib->len+=count*2;
+}
+
+static void
+item_buffer_add_attr(char *buffer, struct attr *attr)
+{
+ struct item_bin *ib=(struct item_bin *) buffer;
+ struct attr_bin *ab=(struct attr_bin *)((int *)ib+ib->len+1);
+ if (attr->type >= attr_type_string_begin && attr->type <= attr_type_string_end) {
+ ab->type=attr->type;
+ strcpy((char *)(ab+1),attr->u.str);
+ pad_text_attr(ab, (char *)(ab+1));
+ ib->len+=ab->len+1;
+ }
+}
+
+static void
+item_buffer_write(char *buffer, FILE *out)
+{
+ struct item_bin *ib=(struct item_bin *) buffer;
+ fwrite(buffer, (ib->len+1)*4, 1, out);
+}
+
+static void
write_attr(FILE *out, struct attr_bin *attr, void *buffer)
{
if (attr->len) {
}
#endif
-static char buffer[150000];
+static char buffer[200000];
+
+static void
+phase1_map(struct map *map, FILE *out_ways, FILE *out_nodes)
+{
+ struct map_rect *mr=map_rect_new(map, NULL);
+ struct item *item;
+ int count,max=16384;
+ struct coord ca[max];
+ struct item_bin ib;
+ struct attr attr;
+ FILE *file;
+
+ while ((item = map_rect_get_item(mr))) {
+ count=item_coord_get(item, ca, item->type < type_line ? 1: max);
+ item_buffer_set_type(buffer, item->type);
+ item_buffer_add_coord(buffer, ca, count);
+ while (item_attr_get(item, attr_any, &attr)) {
+ item_buffer_add_attr(buffer, &attr);
+ }
+ if (item->type >= type_line)
+ item_buffer_write(buffer, out_ways);
+ else
+ item_buffer_write(buffer, out_nodes);
+ }
+ map_rect_destroy(mr);
+}
+
int bytes_read=0;
if (r != 1)
return NULL;
bytes_read+=r;
- assert((ib->len+1) < sizeof(buffer));
+ assert((ib->len+1)*4 < sizeof(buffer));
s=(ib->len+1)*4-sizeof(*ib);
r=fread(ib+1, s, 1, in);
if (r != 1)
}
}
-
static void
write_item_part(FILE *out, struct item_bin *orig, int first, int last)
{
crc=crc32(0, NULL, 0);
crc=crc32(crc, (unsigned char *)data, data_size);
+#ifdef HAVE_ZLIB
if (compression_level) {
error=compress2_int((Byte *)compbuffer, &destlen, (Bytef *)data, data_size, compression_level);
if (error == Z_OK) {
fprintf(stderr,"compress2 returned %d\n", error);
}
}
+#endif
lfh.zipcrc=crc;
lfh.zipsize=comp_size;
lfh.zipuncmp=data_size;
int i,c,start=1,end=4,dump_coordinates=0;
int keep_tmpfiles=0;
int process_nodes=1, process_ways=1;
+#ifdef HAVE_ZLIB
int compression_level=9;
+#else
+ int compression_level=0;
+#endif
int output=0;
int input=0;
char *result,*dbstr=NULL;
FILE* input_file = stdin;
struct plugins *plugins=NULL;
struct attr **attrs;
+ struct map *map_handle=NULL;
while (1) {
#if 0
#endif
{"dedupe-ways", 0, 0, 'w'},
{"dump", 0, 0, 'D'},
+ {"dump-coordinates", 0, 0, 'c'},
{"end", 1, 0, 'e'},
{"help", 0, 0, 'h'},
{"keep-tmpfiles", 0, 0, 'k'},
#ifdef HAVE_POSTGRESQL
"d:"
#endif
- "e:hi:knm:ps:w", long_options, &option_index);
+ "e:hi:knm:p:s:w", long_options, &option_index);
if (c == -1)
break;
switch (c) {
&(struct attr){attr_type,{"textfile"}},
&(struct attr){attr_data,{"bookmark.txt"}},
NULL};
- map_new(attrs);
+ map_handle=map_new(attrs);
fprintf(stderr,"optarg=%s\n", optarg);
break;
case 'n':
case 'p':
if (! plugins)
plugins=plugins_new();
+ fprintf(stderr,"optarg=%s\n",optarg);
attrs=(struct attr*[]){&(struct attr){attr_path,{optarg}},NULL};
plugins_add_path(plugins, attrs);
break;
exit( -1 );
}
break;
+#ifdef HAVE_ZLIB
case 'z':
compression_level=atoi(optarg);
break;
+#endif
case '?':
usage(stderr);
break;
phase1_db(dbstr,ways,nodes);
else
#endif
+ if (map_handle) {
+ phase1_map(map_handle,ways,nodes);
+ map_destroy(map_handle);
+ }
+ else
phase1(input_file,ways,nodes);
if (ways)
fclose(ways);