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