Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Contents of /trunk/src/filedumper.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 470 - (show annotations) (download) (as text)
Tue Aug 3 18:28:30 2010 UTC (14 years, 7 months ago) by amb
File MIME type: text/x-csrc
File size: 23400 byte(s)
Rename the variables that hold the node allowed transports and flags.

1 /***************************************
2 $Header: /home/amb/CVS/routino/src/filedumper.c,v 1.51 2010-08-03 18:28:30 amb Exp $
3
4 Memory file dumper.
5
6 Part of the Routino routing software.
7 ******************/ /******************
8 This file Copyright 2008-2010 Andrew M. Bishop
9
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Affero General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
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 Affero General Public License for more details.
19
20 You should have received a copy of the GNU Affero General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ***************************************/
23
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <sys/stat.h>
29 #include <sys/time.h>
30 #include <time.h>
31
32 #include "types.h"
33 #include "nodes.h"
34 #include "segments.h"
35 #include "ways.h"
36
37 #include "files.h"
38 #include "visualiser.h"
39 #include "xmlparse.h"
40
41
42 /* Local functions */
43
44 static void print_node(Nodes* nodes,index_t item);
45 static void print_segment(Segments *segments,index_t item);
46 static void print_way(Ways *ways,index_t item);
47
48 static void print_head_osm(void);
49 static void print_node_osm(Nodes* nodes,index_t item);
50 static void print_segment_osm(Segments *segments,index_t item,Ways *ways);
51 static void print_tail_osm(void);
52
53 static char *RFC822Date(time_t t);
54
55 static void print_usage(int detail);
56
57
58 /*++++++++++++++++++++++++++++++++++++++
59 The main program for the file dumper.
60 ++++++++++++++++++++++++++++++++++++++*/
61
62 int main(int argc,char** argv)
63 {
64 Nodes *OSMNodes;
65 Segments *OSMSegments;
66 Ways *OSMWays;
67 int arg;
68 char *dirname=NULL,*prefix=NULL;
69 char *nodes_filename,*segments_filename,*ways_filename;
70 int option_statistics=0;
71 int option_visualiser=0,coordcount=0;
72 double latmin=0,latmax=0,lonmin=0,lonmax=0;
73 char *option_data=NULL;
74 int option_dump=0;
75 int option_dump_osm=0,option_no_super=0;
76
77 /* Parse the command line arguments */
78
79 for(arg=1;arg<argc;arg++)
80 {
81 if(!strcmp(argv[arg],"--help"))
82 print_usage(1);
83 else if(!strncmp(argv[arg],"--dir=",6))
84 dirname=&argv[arg][6];
85 else if(!strncmp(argv[arg],"--prefix=",9))
86 prefix=&argv[arg][9];
87 else if(!strcmp(argv[arg],"--statistics"))
88 option_statistics=1;
89 else if(!strcmp(argv[arg],"--visualiser"))
90 option_visualiser=1;
91 else if(!strcmp(argv[arg],"--dump"))
92 option_dump=1;
93 else if(!strcmp(argv[arg],"--dump-osm"))
94 option_dump_osm=1;
95 else if(!strncmp(argv[arg],"--latmin",8) && argv[arg][8]=='=')
96 {latmin=degrees_to_radians(atof(&argv[arg][9]));coordcount++;}
97 else if(!strncmp(argv[arg],"--latmax",8) && argv[arg][8]=='=')
98 {latmax=degrees_to_radians(atof(&argv[arg][9]));coordcount++;}
99 else if(!strncmp(argv[arg],"--lonmin",8) && argv[arg][8]=='=')
100 {lonmin=degrees_to_radians(atof(&argv[arg][9]));coordcount++;}
101 else if(!strncmp(argv[arg],"--lonmax",8) && argv[arg][8]=='=')
102 {lonmax=degrees_to_radians(atof(&argv[arg][9]));coordcount++;}
103 else if(!strncmp(argv[arg],"--data",6) && argv[arg][6]=='=')
104 option_data=&argv[arg][7];
105 else if(!strcmp(argv[arg],"--no-super"))
106 option_no_super=1;
107 else if(!strncmp(argv[arg],"--node=",7))
108 ;
109 else if(!strncmp(argv[arg],"--segment=",10))
110 ;
111 else if(!strncmp(argv[arg],"--way=",6))
112 ;
113 else
114 print_usage(0);
115 }
116
117 if(!option_statistics && !option_visualiser && !option_dump && !option_dump_osm)
118 print_usage(0);
119
120 /* Load in the data - Note: No error checking because Load*List() will call exit() in case of an error. */
121
122 OSMNodes=LoadNodeList(nodes_filename=FileName(dirname,prefix,"nodes.mem"));
123
124 OSMSegments=LoadSegmentList(segments_filename=FileName(dirname,prefix,"segments.mem"));
125
126 OSMWays=LoadWayList(ways_filename=FileName(dirname,prefix,"ways.mem"));
127
128 /* Write out the visualiser data */
129
130 if(option_visualiser)
131 {
132 if(coordcount!=4)
133 {
134 fprintf(stderr,"The --visualiser option must have --latmin, --latmax, --lonmin, --lonmax.\n");
135 exit(1);
136 }
137
138 if(!option_data)
139 {
140 fprintf(stderr,"The --visualiser option must have --data.\n");
141 exit(1);
142 }
143
144 if(!strcmp(option_data,"junctions"))
145 OutputJunctions(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax);
146 else if(!strcmp(option_data,"super"))
147 OutputSuper(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax);
148 else if(!strcmp(option_data,"oneway"))
149 OutputOneway(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax);
150 else if(!strcmp(option_data,"speed"))
151 OutputSpeedLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax);
152 else if(!strcmp(option_data,"weight"))
153 OutputWeightLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax);
154 else if(!strcmp(option_data,"height"))
155 OutputHeightLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax);
156 else if(!strcmp(option_data,"width"))
157 OutputWidthLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax);
158 else if(!strcmp(option_data,"length"))
159 OutputLengthLimits(OSMNodes,OSMSegments,OSMWays,latmin,latmax,lonmin,lonmax);
160 else
161 {
162 fprintf(stderr,"Unrecognised data option '%s' with --visualiser.\n",option_data);
163 exit(1);
164 }
165 }
166
167 /* Print out statistics */
168
169 if(option_statistics)
170 {
171 struct stat buf;
172
173 /* Examine the files */
174
175 printf("Files\n");
176 printf("-----\n");
177 printf("\n");
178
179 stat(nodes_filename,&buf);
180
181 printf("'%s%snodes.mem' - %9lld Bytes\n",prefix?prefix:"",prefix?"-":"",(long long)buf.st_size);
182 printf("%s\n",RFC822Date(buf.st_mtime));
183 printf("\n");
184
185 stat(segments_filename,&buf);
186
187 printf("'%s%ssegments.mem' - %9lld Bytes\n",prefix?prefix:"",prefix?"-":"",(long long)buf.st_size);
188 printf("%s\n",RFC822Date(buf.st_mtime));
189 printf("\n");
190
191 stat(ways_filename,&buf);
192
193 printf("'%s%sways.mem' - %9lld Bytes\n",prefix?prefix:"",prefix?"-":"",(long long)buf.st_size);
194 printf("%s\n",RFC822Date(buf.st_mtime));
195 printf("\n");
196
197 /* Examine the nodes */
198
199 printf("Nodes\n");
200 printf("-----\n");
201 printf("\n");
202
203 printf("sizeof(Node) =%9d Bytes\n",sizeof(Node));
204 printf("Number =%9d\n",OSMNodes->file.number);
205 printf("Number(super)=%9d\n",OSMNodes->file.snumber);
206 printf("\n");
207
208 printf("Lat bins= %4d\n",OSMNodes->file.latbins);
209 printf("Lon bins= %4d\n",OSMNodes->file.lonbins);
210 printf("\n");
211
212 printf("Lat zero=%5d (%8.4f deg)\n",OSMNodes->file.latzero,radians_to_degrees(latlong_to_radians(bin_to_latlong(OSMNodes->file.latzero))));
213 printf("Lon zero=%5d (%8.4f deg)\n",OSMNodes->file.lonzero,radians_to_degrees(latlong_to_radians(bin_to_latlong(OSMNodes->file.lonzero))));
214
215 /* Examine the segments */
216
217 printf("\n");
218 printf("Segments\n");
219 printf("--------\n");
220 printf("\n");
221
222 printf("sizeof(Segment)=%9d Bytes\n",sizeof(Segment));
223 printf("Number(total) =%9d\n",OSMSegments->file.number);
224 printf("Number(super) =%9d\n",OSMSegments->file.snumber);
225 printf("Number(normal) =%9d\n",OSMSegments->file.nnumber);
226
227 /* Examine the ways */
228
229 printf("\n");
230 printf("Ways\n");
231 printf("----\n");
232 printf("\n");
233
234 printf("sizeof(Way) =%9d Bytes\n",sizeof(Way));
235 printf("Number(compacted)=%9d\n",OSMWays->file.number);
236 printf("Number(original) =%9d\n",OSMWays->file.onumber);
237 printf("\n");
238
239 printf("Total names =%9ld Bytes\n",(long)buf.st_size-sizeof(Ways)-OSMWays->file.number*sizeof(Way));
240 printf("\n");
241
242 printf("Included transports: %s\n",AllowedNameList(OSMWays->file.allow));
243 printf("Included properties: %s\n",PropertiesNameList(OSMWays->file.props));
244 }
245
246 /* Print out internal data */
247
248 if(option_dump)
249 {
250 index_t item;
251
252 for(arg=1;arg<argc;arg++)
253 if(!strcmp(argv[arg],"--node=all"))
254 {
255 for(item=0;item<OSMNodes->file.number;item++)
256 print_node(OSMNodes,item);
257 }
258 else if(!strncmp(argv[arg],"--node=",7))
259 {
260 item=atoi(&argv[arg][7]);
261
262 if(item>=0 && item<OSMNodes->file.number)
263 print_node(OSMNodes,item);
264 else
265 printf("Invalid node number; minimum=0, maximum=%d.\n",OSMNodes->file.number-1);
266 }
267 else if(!strcmp(argv[arg],"--segment=all"))
268 {
269 for(item=0;item<OSMSegments->file.number;item++)
270 print_segment(OSMSegments,item);
271 }
272 else if(!strncmp(argv[arg],"--segment=",10))
273 {
274 item=atoi(&argv[arg][10]);
275
276 if(item>=0 && item<OSMSegments->file.number)
277 print_segment(OSMSegments,item);
278 else
279 printf("Invalid segment number; minimum=0, maximum=%d.\n",OSMSegments->file.number-1);
280 }
281 else if(!strcmp(argv[arg],"--way=all"))
282 {
283 for(item=0;item<OSMWays->file.number;item++)
284 print_way(OSMWays,item);
285 }
286 else if(!strncmp(argv[arg],"--way=",6))
287 {
288 item=atoi(&argv[arg][6]);
289
290 if(item>=0 && item<OSMWays->file.number)
291 print_way(OSMWays,item);
292 else
293 printf("Invalid way number; minimum=0, maximum=%d.\n",OSMWays->file.number-1);
294 }
295 }
296
297 /* Print out internal data in XML format */
298
299 if(option_dump_osm)
300 {
301 if(coordcount>0 && coordcount!=4)
302 {
303 fprintf(stderr,"The --dump-osm option must have all of --latmin, --latmax, --lonmin, --lonmax or none.\n");
304 exit(1);
305 }
306
307 print_head_osm();
308
309 if(coordcount)
310 {
311 int32_t latminbin=latlong_to_bin(radians_to_latlong(latmin))-OSMNodes->file.latzero;
312 int32_t latmaxbin=latlong_to_bin(radians_to_latlong(latmax))-OSMNodes->file.latzero;
313 int32_t lonminbin=latlong_to_bin(radians_to_latlong(lonmin))-OSMNodes->file.lonzero;
314 int32_t lonmaxbin=latlong_to_bin(radians_to_latlong(lonmax))-OSMNodes->file.lonzero;
315 int latb,lonb,llbin;
316 index_t item,index1,index2;
317
318 /* Loop through all of the nodes. */
319
320 for(latb=latminbin;latb<=latmaxbin;latb++)
321 for(lonb=lonminbin;lonb<=lonmaxbin;lonb++)
322 {
323 llbin=lonb*OSMNodes->file.latbins+latb;
324
325 if(llbin<0 || llbin>(OSMNodes->file.latbins*OSMNodes->file.lonbins))
326 continue;
327
328 index1=LookupNodeOffset(OSMNodes,llbin);
329 index2=LookupNodeOffset(OSMNodes,llbin+1);
330
331 for(item=index1;item<index2;item++)
332 {
333 Node *node=LookupNode(OSMNodes,item,1);
334 double lat=latlong_to_radians(bin_to_latlong(OSMNodes->file.latzero+latb)+off_to_latlong(node->latoffset));
335 double lon=latlong_to_radians(bin_to_latlong(OSMNodes->file.lonzero+lonb)+off_to_latlong(node->lonoffset));
336
337 if(lat>latmin && lat<latmax && lon>lonmin && lon<lonmax)
338 {
339 Segment *segment;
340
341 print_node_osm(OSMNodes,item);
342
343 segment=FirstSegment(OSMSegments,OSMNodes,item);
344
345 while(segment)
346 {
347 if(item>OtherNode(segment,item))
348 if(!option_no_super || IsNormalSegment(segment))
349 print_segment_osm(OSMSegments,IndexSegment(OSMSegments,segment),OSMWays);
350
351 segment=NextSegment(OSMSegments,segment,item);
352 }
353 }
354 }
355 }
356 }
357 else
358 {
359 index_t item;
360
361 for(item=0;item<OSMNodes->file.number;item++)
362 print_node_osm(OSMNodes,item);
363
364 for(item=0;item<OSMSegments->file.number;item++)
365 if(!option_no_super || IsNormalSegment(LookupSegment(OSMSegments,item,1)))
366 print_segment_osm(OSMSegments,item,OSMWays);
367 }
368
369 print_tail_osm();
370 }
371
372 return(0);
373 }
374
375
376 /*++++++++++++++++++++++++++++++++++++++
377 Print out the contents of a node from the routing database.
378
379 Nodes *nodes The set of nodes to use.
380
381 index_t item The node index to print.
382 ++++++++++++++++++++++++++++++++++++++*/
383
384 static void print_node(Nodes* nodes,index_t item)
385 {
386 Node *node=LookupNode(nodes,item,1);
387 double latitude,longitude;
388
389 GetLatLong(nodes,item,&latitude,&longitude);
390
391 printf("Node %d\n",item);
392 printf(" firstseg=%d\n",node->firstseg);
393 printf(" latoffset=%d lonoffset=%d (latitude=%.6f longitude=%.6f)\n",node->latoffset,node->lonoffset,radians_to_degrees(latitude),radians_to_degrees(longitude));
394 printf(" allow=%02x (%s)\n",node->allow,AllowedNameList(node->allow));
395 if(IsSuperNode(nodes,item))
396 printf(" Super-Node\n");
397 }
398
399
400 /*++++++++++++++++++++++++++++++++++++++
401 Print out the contents of a segment from the routing database.
402
403 Segments *segments The set of segments to use.
404
405 index_t item The segment index to print.
406 ++++++++++++++++++++++++++++++++++++++*/
407
408 static void print_segment(Segments *segments,index_t item)
409 {
410 Segment *segment=LookupSegment(segments,item,1);
411
412 printf("Segment %d\n",item);
413 printf(" node1=%d node2=%d\n",segment->node1,segment->node2);
414 printf(" next2=%d\n",segment->next2);
415 printf(" way=%d\n",segment->way);
416 printf(" distance=%d (%.3f km)\n",DISTANCE(segment->distance),distance_to_km(DISTANCE(segment->distance)));
417 if(IsSuperSegment(segment) && IsNormalSegment(segment))
418 printf(" Super-Segment AND normal Segment\n");
419 else if(IsSuperSegment(segment) && !IsNormalSegment(segment))
420 printf(" Super-Segment\n");
421 if(IsOnewayTo(segment,segment->node1))
422 printf(" One-Way from node2 to node1\n");
423 if(IsOnewayTo(segment,segment->node2))
424 printf(" One-Way from node1 to node2\n");
425 }
426
427
428 /*++++++++++++++++++++++++++++++++++++++
429 Print out the contents of a way from the routing database.
430
431 Ways *ways The set of ways to use.
432
433 index_t item The way index to print.
434 ++++++++++++++++++++++++++++++++++++++*/
435
436 static void print_way(Ways *ways,index_t item)
437 {
438 Way *way=LookupWay(ways,item,1);
439
440 printf("Way %d\n",item);
441 printf(" name=%s\n",WayNameHighway(ways,way));
442 printf(" type=%02x (%s%s%s)\n",way->type,HighwayName(HIGHWAY(way->type)),way->type&Way_OneWay?",One-Way":"",way->type&Way_Roundabout?",Roundabout":"");
443 printf(" allow=%02x (%s)\n",way->allow,AllowedNameList(way->allow));
444 if(way->props)
445 printf(" props=%02x (%s)\n",way->props,PropertiesNameList(way->props));
446 if(way->speed)
447 printf(" speed=%d (%d km/hr)\n",way->speed,speed_to_kph(way->speed));
448 if(way->weight)
449 printf(" weight=%d (%.1f tonnes)\n",way->weight,weight_to_tonnes(way->weight));
450 if(way->height)
451 printf(" height=%d (%.1f m)\n",way->height,height_to_metres(way->height));
452 if(way->width)
453 printf(" width=%d (%.1f m)\n",way->width,width_to_metres(way->width));
454 if(way->length)
455 printf(" length=%d (%.1f m)\n",way->length,length_to_metres(way->length));
456 }
457
458
459 /*++++++++++++++++++++++++++++++++++++++
460 Print out a header in OSM XML format.
461 ++++++++++++++++++++++++++++++++++++++*/
462
463 static void print_head_osm(void)
464 {
465 printf("<?xml version='1.0' encoding='UTF-8'?>\n");
466 printf("<osm version='0.6' generator='JOSM'>\n");
467 }
468
469
470 /*++++++++++++++++++++++++++++++++++++++
471 Print out the contents of a node from the routing database in OSM XML format.
472
473 Nodes *nodes The set of nodes to use.
474
475 index_t item The node index to print.
476 ++++++++++++++++++++++++++++++++++++++*/
477
478 static void print_node_osm(Nodes* nodes,index_t item)
479 {
480 Node *node=LookupNode(nodes,item,1);
481 double latitude,longitude;
482
483 GetLatLong(nodes,item,&latitude,&longitude);
484
485 if(IsSuperNode(nodes,item))
486 {
487 int i;
488
489 printf(" <node id='%lu' lat='%.7f' lon='%.7f' version='1'>\n",(unsigned long)item+1,radians_to_degrees(latitude),radians_to_degrees(longitude));
490 printf(" <tag k='routino:super' v='yes' />\n");
491
492 for(i=1;i<Transport_Count;i++)
493 if(!(node->allow & ALLOWED(i)))
494 printf(" <tag k='%s' v='no' />\n",TransportName(i));
495
496 printf(" </node>\n");
497 }
498 else
499 printf(" <node id='%lu' lat='%.7f' lon='%.7f' version='1' />\n",(unsigned long)item+1,radians_to_degrees(latitude),radians_to_degrees(longitude));
500 }
501
502
503 /*++++++++++++++++++++++++++++++++++++++
504 Print out the contents of a segment from the routing database as a way in OSM XML format.
505
506 Segments *segments The set of segments to use.
507
508 index_t item The segment index to print.
509
510 Ways *ways The set of ways to use.
511 ++++++++++++++++++++++++++++++++++++++*/
512
513 static void print_segment_osm(Segments *segments,index_t item,Ways *ways)
514 {
515 Segment *segment=LookupSegment(segments,item,1);
516 Way *way=LookupWay(ways,segment->way,1);
517 int i;
518
519 printf(" <way id='%lu' version='1'>\n",(unsigned long)item+1);
520
521 if(IsOnewayTo(segment,segment->node1))
522 {
523 printf(" <nd ref='%lu' />\n",(unsigned long)segment->node2+1);
524 printf(" <nd ref='%lu' />\n",(unsigned long)segment->node1+1);
525 }
526 else
527 {
528 printf(" <nd ref='%lu' />\n",(unsigned long)segment->node1+1);
529 printf(" <nd ref='%lu' />\n",(unsigned long)segment->node2+1);
530 }
531
532 if(IsSuperSegment(segment))
533 printf(" <tag k='routino:super' v='yes' />\n");
534 if(IsNormalSegment(segment))
535 printf(" <tag k='routino:normal' v='yes' />\n");
536
537 if(way->type & Way_OneWay)
538 printf(" <tag k='oneway' v='yes' />\n");
539 if(way->type & Way_Roundabout)
540 printf(" <tag k='junction' v='roundabout' />\n");
541
542 printf(" <tag k='highway' v='%s' />\n",HighwayName(HIGHWAY(way->type)));
543
544 if(IsNormalSegment(segment) && WayNamed(ways,way))
545 printf(" <tag k='name' v='%s' />\n",ParseXML_Encode_Safe_XML(WayNameHighway(ways,way)));
546
547 for(i=1;i<Transport_Count;i++)
548 if(way->allow & ALLOWED(i))
549 printf(" <tag k='%s' v='yes' />\n",TransportName(i));
550
551 for(i=1;i<Property_Count;i++)
552 if(way->props & PROPERTIES(i))
553 printf(" <tag k='%s' v='yes' />\n",PropertyName(i));
554
555 if(way->speed)
556 printf(" <tag k='maxspeed' v='%d' />\n",speed_to_kph(way->speed));
557
558 if(way->weight)
559 printf(" <tag k='maxweight' v='%.1f' />\n",weight_to_tonnes(way->weight));
560 if(way->height)
561 printf(" <tag k='maxheight' v='%.1f' />\n",height_to_metres(way->height));
562 if(way->width)
563 printf(" <tag k='maxwidth' v='%.1f' />\n",width_to_metres(way->width));
564 if(way->length)
565 printf(" <tag k='maxlength' v='%.1f' />\n",length_to_metres(way->length));
566
567 printf(" </way>\n");
568 }
569
570
571 /*++++++++++++++++++++++++++++++++++++++
572 Print out a tail in OSM XML format.
573 ++++++++++++++++++++++++++++++++++++++*/
574
575 static void print_tail_osm(void)
576 {
577 printf("</osm>\n");
578 }
579
580
581 /*+ Conversion from time_t to date string (day of week). +*/
582 static const char* const weekdays[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
583
584 /*+ Conversion from time_t to date string (month of year). +*/
585 static const char* const months[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
586
587
588 /*++++++++++++++++++++++++++++++++++++++
589 Convert the time into an RFC 822 compliant date.
590
591 char *RFC822Date Returns a pointer to a fixed string containing the date.
592
593 time_t t The time.
594 ++++++++++++++++++++++++++++++++++++++*/
595
596 static char *RFC822Date(time_t t)
597 {
598 static char value[32];
599 char weekday[4];
600 char month[4];
601 struct tm *tim;
602
603 tim=gmtime(&t);
604
605 strcpy(weekday,weekdays[tim->tm_wday]);
606 strcpy(month,months[tim->tm_mon]);
607
608 /* Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 */
609
610 sprintf(value,"%3s, %02d %3s %4d %02d:%02d:%02d %s",
611 weekday,
612 tim->tm_mday,
613 month,
614 tim->tm_year+1900,
615 tim->tm_hour,
616 tim->tm_min,
617 tim->tm_sec,
618 "GMT"
619 );
620
621 return(value);
622 }
623
624
625 /*++++++++++++++++++++++++++++++++++++++
626 Print out the usage information.
627
628 int detail The level of detail to use - 0 = low, 1 = high.
629 ++++++++++++++++++++++++++++++++++++++*/
630
631 static void print_usage(int detail)
632 {
633 fprintf(stderr,
634 "Usage: filedumper [--help]\n"
635 " [--dir=<dirname>] [--prefix=<name>]\n"
636 " [--statistics]\n"
637 " [--visualiser --latmin=<latmin> --latmax=<latmax>\n"
638 " --lonmin=<lonmin> --lonmax=<lonmax>\n"
639 " --data=<data-type>]\n"
640 " [--dump [--node=<node> ...]\n"
641 " [--segment=<segment> ...]\n"
642 " [--way=<way> ...]]\n"
643 " [--dump-osm [--no-super]\n"
644 " [--latmin=<latmin> --latmax=<latmax>\n"
645 " --lonmin=<lonmin> --lonmax=<lonmax>]]\n");
646
647 if(detail)
648 fprintf(stderr,
649 "\n"
650 "--help Prints this information.\n"
651 "\n"
652 "--dir=<dirname> The directory containing the routing database.\n"
653 "--prefix=<name> The filename prefix for the routing database.\n"
654 "\n"
655 "--statistics Print statistics about the routing database.\n"
656 "\n"
657 "--visualiser Extract selected data from the routing database:\n"
658 " --latmin=<latmin> * the minimum latitude (degrees N).\n"
659 " --latmax=<latmax> * the maximum latitude (degrees N).\n"
660 " --lonmin=<lonmin> * the minimum longitude (degrees E).\n"
661 " --lonmax=<lonmax> * the maximum longitude (degrees E).\n"
662 " --data=<data-type> * the type of data to select.\n"
663 "\n"
664 " <data-type> can be selected from:\n"
665 " junctions = segment count at each junction.\n"
666 " super = super-node and super-segments.\n"
667 " oneway = oneway segments.\n"
668 " speed = speed limits.\n"
669 " weight = weight limits.\n"
670 " height = height limits.\n"
671 " width = width limits.\n"
672 " length = length limits.\n"
673 "\n"
674 "--dump Dump selected contents of the database.\n"
675 " --node=<node> * the node with the selected number.\n"
676 " --segment=<segment> * the segment with the selected number.\n"
677 " --way=<way> * the way with the selected number.\n"
678 " Use 'all' instead of a number to get all of them.\n"
679 "\n"
680 "--dump-osm Dump all or part of the database as an XML file.\n"
681 " --no-super * exclude the super-segments.\n"
682 " --latmin=<latmin> * the minimum latitude (degrees N).\n"
683 " --latmax=<latmax> * the maximum latitude (degrees N).\n"
684 " --lonmin=<lonmin> * the minimum longitude (degrees E).\n"
685 " --lonmax=<lonmax> * the maximum longitude (degrees E).\n");
686
687 exit(!detail);
688 }

Properties

Name Value
cvs:description Test program for mmap files.