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/router.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1832 - (show annotations) (download) (as text)
Sat Oct 24 15:19:51 2015 UTC (9 years, 5 months ago) by amb
File MIME type: text/x-csrc
File size: 26447 byte(s)
Fix routing bug where missing waypoint data still gets routed.

1 /***************************************
2 OSM router.
3
4 Part of the Routino routing software.
5 ******************/ /******************
6 This file Copyright 2008-2015 Andrew M. Bishop
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Affero General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Affero General Public License for more details.
17
18 You should have received a copy of the GNU Affero General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ***************************************/
21
22
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
26 #include <ctype.h>
27
28 #include "version.h"
29
30 #include "types.h"
31 #include "nodes.h"
32 #include "segments.h"
33 #include "ways.h"
34 #include "relations.h"
35
36 #include "files.h"
37 #include "logging.h"
38 #include "functions.h"
39 #include "fakes.h"
40 #include "translations.h"
41 #include "profiles.h"
42
43
44 /*+ The maximum distance from the specified point to search for a node or segment (in km). +*/
45 #define MAXSEARCH 1
46
47
48 /* Global variables */
49
50 /*+ The option not to print any progress information. +*/
51 int option_quiet=0;
52
53 /*+ The option to calculate the quickest route insted of the shortest. +*/
54 extern int option_quickest;
55
56 /*+ The options to select the format of the file output. +*/
57 extern int option_file_html,option_file_gpx_track,option_file_gpx_route,option_file_text,option_file_text_all,option_file_stdout;
58 int option_file_none=0;
59
60
61 /* Local functions */
62
63 static void print_usage(int detail,const char *argerr,const char *err);
64
65
66 /*++++++++++++++++++++++++++++++++++++++
67 The main program for the router.
68 ++++++++++++++++++++++++++++++++++++++*/
69
70 int main(int argc,char** argv)
71 {
72 Nodes *OSMNodes;
73 Segments *OSMSegments;
74 Ways *OSMWays;
75 Relations *OSMRelations;
76 Results *results[NWAYPOINTS+1]={NULL};
77 int point_used[NWAYPOINTS+1]={0};
78 double point_lon[NWAYPOINTS+1],point_lat[NWAYPOINTS+1];
79 index_t point_node[NWAYPOINTS+1]={NO_NODE};
80 double heading=-999;
81 int help_profile=0,help_profile_xml=0,help_profile_json=0,help_profile_pl=0;
82 char *dirname=NULL,*prefix=NULL;
83 char *profiles=NULL,*profilename=NULL;
84 char *translations=NULL,*language=NULL;
85 int exactnodes=0,reverse=0,loop=0;
86 Transport transport=Transport_None;
87 Profile *profile=NULL;
88 Translation *translation=NULL;
89 index_t start_node,finish_node=NO_NODE;
90 index_t join_segment=NO_SEGMENT;
91 int arg,nresults=0;
92 waypoint_t start_waypoint,finish_waypoint=NO_WAYPOINT;
93 waypoint_t first_waypoint=NWAYPOINTS,last_waypoint=1,waypoint;
94 int inc_dec_waypoint=1;
95
96 printf_program_start();
97
98 /* Parse the command line arguments */
99
100 if(argc<2)
101 print_usage(0,NULL,NULL);
102
103 /* Get the non-routing, general program options */
104
105 for(arg=1;arg<argc;arg++)
106 {
107 if(!strcmp(argv[arg],"--version"))
108 print_usage(-1,NULL,NULL);
109 else if(!strcmp(argv[arg],"--help"))
110 print_usage(1,NULL,NULL);
111 else if(!strcmp(argv[arg],"--help-profile"))
112 help_profile=1;
113 else if(!strcmp(argv[arg],"--help-profile-xml"))
114 help_profile_xml=1;
115 else if(!strcmp(argv[arg],"--help-profile-json"))
116 help_profile_json=1;
117 else if(!strcmp(argv[arg],"--help-profile-perl"))
118 help_profile_pl=1;
119 else if(!strncmp(argv[arg],"--dir=",6))
120 dirname=&argv[arg][6];
121 else if(!strncmp(argv[arg],"--prefix=",9))
122 prefix=&argv[arg][9];
123 else if(!strncmp(argv[arg],"--profiles=",11))
124 profiles=&argv[arg][11];
125 else if(!strncmp(argv[arg],"--translations=",15))
126 translations=&argv[arg][15];
127 else if(!strcmp(argv[arg],"--exact-nodes-only"))
128 exactnodes=1;
129 else if(!strncmp(argv[arg],"--reverse",9))
130 {
131 if(argv[arg][9]=='=')
132 reverse=atoi(&argv[arg][10]);
133 else
134 reverse=1;
135 }
136 else if(!strncmp(argv[arg],"--loop",6))
137 {
138 if(argv[arg][6]=='=')
139 loop=atoi(&argv[arg][7]);
140 else
141 loop=1;
142 }
143 else if(!strcmp(argv[arg],"--quiet"))
144 option_quiet=1;
145 else if(!strcmp(argv[arg],"--loggable"))
146 option_loggable=1;
147 else if(!strcmp(argv[arg],"--logtime"))
148 option_logtime=2;
149 else if(!strcmp(argv[arg],"--logmemory"))
150 option_logmemory=1;
151 else if(!strcmp(argv[arg],"--output-html"))
152 option_file_html=1;
153 else if(!strcmp(argv[arg],"--output-gpx-track"))
154 option_file_gpx_track=1;
155 else if(!strcmp(argv[arg],"--output-gpx-route"))
156 option_file_gpx_route=1;
157 else if(!strcmp(argv[arg],"--output-text"))
158 option_file_text=1;
159 else if(!strcmp(argv[arg],"--output-text-all"))
160 option_file_text_all=1;
161 else if(!strcmp(argv[arg],"--output-none"))
162 option_file_none=1;
163 else if(!strcmp(argv[arg],"--output-stdout"))
164 { option_file_stdout=1; option_quiet=1; }
165 else if(!strncmp(argv[arg],"--profile=",10))
166 profilename=&argv[arg][10];
167 else if(!strncmp(argv[arg],"--language=",11))
168 language=&argv[arg][11];
169 else if(!strcmp(argv[arg],"--shortest"))
170 option_quickest=0;
171 else if(!strcmp(argv[arg],"--quickest"))
172 option_quickest=1;
173 else if(!strncmp(argv[arg],"--lon",5) && isdigit(argv[arg][5]))
174 {
175 int point;
176 char *p=&argv[arg][6];
177
178 while(isdigit(*p)) p++;
179 if(*p++!='=')
180 print_usage(0,argv[arg],NULL);
181
182 point=atoi(&argv[arg][5]);
183 if(point>NWAYPOINTS || point_used[point]&1)
184 print_usage(0,argv[arg],NULL);
185
186 point_lon[point]=degrees_to_radians(atof(p));
187 point_used[point]+=1;
188
189 if(point<first_waypoint)
190 first_waypoint=point;
191 if(point>last_waypoint)
192 last_waypoint=point;
193 }
194 else if(!strncmp(argv[arg],"--lat",5) && isdigit(argv[arg][5]))
195 {
196 int point;
197 char *p=&argv[arg][6];
198
199 while(isdigit(*p)) p++;
200 if(*p++!='=')
201 print_usage(0,argv[arg],NULL);
202
203 point=atoi(&argv[arg][5]);
204 if(point>NWAYPOINTS || point_used[point]&2)
205 print_usage(0,argv[arg],NULL);
206
207 point_lat[point]=degrees_to_radians(atof(p));
208 point_used[point]+=2;
209
210 if(point<first_waypoint)
211 first_waypoint=point;
212 if(point>last_waypoint)
213 last_waypoint=point;
214 }
215 else if(!strncmp(argv[arg],"--heading=",10))
216 {
217 double h=atof(&argv[arg][10]);
218
219 if(h>=-360 && h<=360)
220 {
221 heading=h;
222
223 if(heading<0) heading+=360;
224 }
225 }
226 else if(!strncmp(argv[arg],"--transport=",12))
227 {
228 transport=TransportType(&argv[arg][12]);
229
230 if(transport==Transport_None)
231 print_usage(0,argv[arg],NULL);
232 }
233 else
234 continue;
235
236 argv[arg]=NULL;
237 }
238
239 /* Check the specified command line options */
240
241 if(option_file_stdout && (option_file_html+option_file_gpx_track+option_file_gpx_route+option_file_text+option_file_text_all)!=1)
242 {
243 fprintf(stderr,"Error: The '--output-stdout' option requires exactly one other output option (but not '--output-none').\n");
244 exit(EXIT_FAILURE);
245 }
246
247 if(option_file_html==0 && option_file_gpx_track==0 && option_file_gpx_route==0 && option_file_text==0 && option_file_text_all==0 && option_file_none==0)
248 option_file_html=option_file_gpx_track=option_file_gpx_route=option_file_text=option_file_text_all=1;
249
250 /* Load in the selected profiles */
251
252 if(transport==Transport_None)
253 transport=Transport_Motorcar;
254
255 if(profiles)
256 {
257 if(!ExistsFile(profiles))
258 {
259 fprintf(stderr,"Error: The '--profiles' option specifies a file that does not exist.\n");
260 exit(EXIT_FAILURE);
261 }
262 }
263 else
264 {
265 profiles=FileName(dirname,prefix,"profiles.xml");
266
267 if(!ExistsFile(profiles))
268 {
269 free(profiles);
270
271 profiles=FileName(ROUTINO_DATADIR,NULL,"profiles.xml");
272
273 if(!ExistsFile(profiles))
274 {
275 fprintf(stderr,"Error: The '--profiles' option was not used and the default 'profiles.xml' does not exist.\n");
276 exit(EXIT_FAILURE);
277 }
278 }
279 }
280
281 if(!profilename)
282 profilename=(char*)TransportName(transport);
283
284 if(ParseXMLProfiles(profiles,profilename,(help_profile_xml|help_profile_json|help_profile_pl)))
285 {
286 fprintf(stderr,"Error: Cannot read the profiles in the file '%s'.\n",profiles);
287 exit(EXIT_FAILURE);
288 }
289
290 profile=GetProfile(profilename);
291
292 if(!profile)
293 {
294 fprintf(stderr,"Error: Cannot find a profile called '%s' in '%s'.\n",profilename,profiles);
295
296 profile=(Profile*)calloc(1,sizeof(Profile));
297 profile->transport=transport;
298 }
299
300 /* Parse the other command line arguments that modify the profile */
301
302 for(arg=1;arg<argc;arg++)
303 {
304 if(!argv[arg])
305 continue;
306 else if(!strncmp(argv[arg],"--highway-",10))
307 {
308 Highway highway;
309 char *equal=strchr(argv[arg],'=');
310 char *string;
311 double p;
312
313 if(!equal)
314 print_usage(0,argv[arg],NULL);
315
316 string=strcpy((char*)malloc(strlen(argv[arg])),argv[arg]+10);
317 string[equal-argv[arg]-10]=0;
318
319 highway=HighwayType(string);
320
321 if(highway==Highway_None)
322 print_usage(0,argv[arg],NULL);
323
324 p=atof(equal+1);
325
326 if(p<0 || p>100)
327 print_usage(0,argv[arg],NULL);
328
329 profile->highway[highway]=(score_t)(p/100);
330
331 free(string);
332 }
333 else if(!strncmp(argv[arg],"--speed-",8))
334 {
335 Highway highway;
336 char *equal=strchr(argv[arg],'=');
337 char *string;
338 double s;
339
340 if(!equal)
341 print_usage(0,argv[arg],NULL);
342
343 string=strcpy((char*)malloc(strlen(argv[arg])),argv[arg]+8);
344 string[equal-argv[arg]-8]=0;
345
346 highway=HighwayType(string);
347
348 if(highway==Highway_None)
349 print_usage(0,argv[arg],NULL);
350
351 s=atof(equal+1);
352
353 if(s<0)
354 print_usage(0,argv[arg],NULL);
355
356 profile->speed[highway]=kph_to_speed(s);
357
358 free(string);
359 }
360 else if(!strncmp(argv[arg],"--property-",11))
361 {
362 Property property;
363 char *equal=strchr(argv[arg],'=');
364 char *string;
365 double p;
366
367 if(!equal)
368 print_usage(0,argv[arg],NULL);
369
370 string=strcpy((char*)malloc(strlen(argv[arg])),argv[arg]+11);
371 string[equal-argv[arg]-11]=0;
372
373 property=PropertyType(string);
374
375 if(property==Property_None)
376 print_usage(0,argv[arg],NULL);
377
378 p=atof(equal+1);
379
380 if(p<0 || p>100)
381 print_usage(0,argv[arg],NULL);
382
383 profile->props[property]=(score_t)(p/100);
384
385 free(string);
386 }
387 else if(!strncmp(argv[arg],"--oneway=",9))
388 profile->oneway=!!atoi(&argv[arg][9]);
389 else if(!strncmp(argv[arg],"--turns=",8))
390 profile->turns=!!atoi(&argv[arg][8]);
391 else if(!strncmp(argv[arg],"--weight=",9))
392 profile->weight=tonnes_to_weight(atof(&argv[arg][9]));
393 else if(!strncmp(argv[arg],"--height=",9))
394 profile->height=metres_to_height(atof(&argv[arg][9]));
395 else if(!strncmp(argv[arg],"--width=",8))
396 profile->width=metres_to_width(atof(&argv[arg][8]));
397 else if(!strncmp(argv[arg],"--length=",9))
398 profile->length=metres_to_length(atof(&argv[arg][9]));
399 else
400 print_usage(0,argv[arg],NULL);
401 }
402
403 /* Print one of the profiles if requested */
404
405 if(help_profile)
406 {
407 PrintProfile(profile);
408
409 exit(EXIT_SUCCESS);
410 }
411 else if(help_profile_xml)
412 {
413 PrintProfilesXML();
414
415 exit(EXIT_SUCCESS);
416 }
417 else if(help_profile_json)
418 {
419 PrintProfilesJSON();
420
421 exit(EXIT_SUCCESS);
422 }
423 else if(help_profile_pl)
424 {
425 PrintProfilesPerl();
426
427 exit(EXIT_SUCCESS);
428 }
429
430 /* Load in the selected translation */
431
432 if(option_file_html || option_file_gpx_route || option_file_gpx_track || option_file_text || option_file_text_all)
433 {
434 if(translations)
435 {
436 if(!ExistsFile(translations))
437 {
438 fprintf(stderr,"Error: The '--translations' option specifies a file that does not exist.\n");
439 exit(EXIT_FAILURE);
440 }
441 }
442 else
443 {
444 translations=FileName(dirname,prefix,"translations.xml");
445
446 if(!ExistsFile(translations))
447 {
448 free(translations);
449
450 translations=FileName(ROUTINO_DATADIR,NULL,"translations.xml");
451
452 if(!ExistsFile(translations))
453 {
454 fprintf(stderr,"Error: The '--translations' option was not used and the default 'translations.xml' does not exist.\n");
455 exit(EXIT_FAILURE);
456 }
457 }
458 }
459
460 if(ParseXMLTranslations(translations,language,0))
461 {
462 fprintf(stderr,"Error: Cannot read the translations in the file '%s'.\n",translations);
463 exit(EXIT_FAILURE);
464 }
465
466 if(language)
467 {
468 translation=GetTranslation(language);
469
470 if(!translation)
471 {
472 fprintf(stderr,"Warning: Cannot find a translation called '%s' in '%s'.\n",language,translations);
473 exit(EXIT_FAILURE);
474 }
475 }
476 else
477 {
478 translation=GetTranslation("");
479
480 if(!translation)
481 {
482 fprintf(stderr,"Warning: No translations in '%s'.\n",translations);
483 exit(EXIT_FAILURE);
484 }
485 }
486 }
487
488 /* Check the waypoints are valid */
489
490 for(waypoint=1;waypoint<=NWAYPOINTS;waypoint++)
491 if(point_used[waypoint]==1 || point_used[waypoint]==2)
492 print_usage(0,NULL,"All waypoints must have latitude and longitude.");
493
494 if(first_waypoint>=last_waypoint)
495 print_usage(0,NULL,"At least two waypoints must be specified.");
496
497 /* Load in the data - Note: No error checking because Load*List() will call exit() in case of an error. */
498
499 if(!option_quiet)
500 printf_first("Loading Files:");
501
502 OSMNodes=LoadNodeList(FileName(dirname,prefix,"nodes.mem"));
503
504 OSMSegments=LoadSegmentList(FileName(dirname,prefix,"segments.mem"));
505
506 OSMWays=LoadWayList(FileName(dirname,prefix,"ways.mem"));
507
508 OSMRelations=LoadRelationList(FileName(dirname,prefix,"relations.mem"));
509
510 if(!option_quiet)
511 printf_last("Loaded Files: nodes, segments, ways & relations");
512
513 /* Check the profile is valid for use with this database */
514
515 if(UpdateProfile(profile,OSMWays))
516 {
517 fprintf(stderr,"Error: Profile is invalid or not compatible with database.\n");
518 exit(EXIT_FAILURE);
519 }
520
521 /* Find all waypoints */
522
523 for(waypoint=first_waypoint;waypoint<=last_waypoint;waypoint++)
524 {
525 distance_t distmax=km_to_distance(MAXSEARCH);
526 distance_t distmin;
527 index_t segment=NO_SEGMENT;
528 index_t node1,node2,node=NO_NODE;
529
530 if(point_used[waypoint]!=3)
531 continue;
532
533 /* Find the closest point */
534
535 if(!option_quiet)
536 printf_first("Finding Closest Point: Waypoint %d",waypoint);
537
538 if(exactnodes)
539 node=FindClosestNode(OSMNodes,OSMSegments,OSMWays,point_lat[waypoint],point_lon[waypoint],distmax,profile,&distmin);
540 else
541 {
542 distance_t dist1,dist2;
543
544 segment=FindClosestSegment(OSMNodes,OSMSegments,OSMWays,point_lat[waypoint],point_lon[waypoint],distmax,profile,&distmin,&node1,&node2,&dist1,&dist2);
545
546 if(segment!=NO_SEGMENT)
547 node=CreateFakes(OSMNodes,OSMSegments,waypoint,LookupSegment(OSMSegments,segment,1),node1,node2,dist1,dist2);
548 }
549
550 if(!option_quiet)
551 printf_last("Found Closest Point: Waypoint %d",waypoint);
552
553 if(node==NO_NODE)
554 {
555 fprintf(stderr,"Error: Cannot find node close to specified point %d.\n",waypoint);
556 exit(EXIT_FAILURE);
557 }
558
559 if(!option_quiet)
560 {
561 double lat,lon;
562
563 if(IsFakeNode(node))
564 GetFakeLatLong(node,&lat,&lon);
565 else
566 GetLatLong(OSMNodes,node,NULL,&lat,&lon);
567
568 if(IsFakeNode(node))
569 printf("Waypoint %d is segment %"Pindex_t" (node %"Pindex_t" -> %"Pindex_t"): %3.6f %4.6f = %2.3f km\n",waypoint,segment,node1,node2,
570 radians_to_degrees(lon),radians_to_degrees(lat),distance_to_km(distmin));
571 else
572 printf("Waypoint %d is node %"Pindex_t": %3.6f %4.6f = %2.3f km\n",waypoint,node,
573 radians_to_degrees(lon),radians_to_degrees(lat),distance_to_km(distmin));
574 }
575
576 point_node[waypoint]=node;
577 }
578
579 /* Check for reverse direction */
580
581 if(reverse)
582 {
583 waypoint_t temp;
584
585 temp=first_waypoint;
586 first_waypoint=last_waypoint;
587 last_waypoint=temp;
588
589 inc_dec_waypoint=-1;
590 }
591
592 /* Loop through all pairs of waypoints */
593
594 if(loop && reverse)
595 {
596 finish_node=point_node[last_waypoint];
597
598 finish_waypoint=last_waypoint;
599 }
600
601 for(waypoint=first_waypoint;waypoint!=(last_waypoint+inc_dec_waypoint);waypoint+=inc_dec_waypoint)
602 {
603 if(point_used[waypoint]!=3)
604 continue;
605
606 start_node=finish_node;
607 finish_node=point_node[waypoint];
608
609 start_waypoint=finish_waypoint;
610 finish_waypoint=waypoint;
611
612 if(start_node==NO_NODE)
613 continue;
614
615 if(heading!=-999 && join_segment==NO_SEGMENT)
616 join_segment=FindClosestSegmentHeading(OSMNodes,OSMSegments,OSMWays,start_node,heading,profile);
617
618 /* Calculate the route */
619
620 if(!option_quiet)
621 printf("Routing from waypoint %d to waypoint %d\n",start_waypoint,finish_waypoint);
622
623 results[nresults]=CalculateRoute(OSMNodes,OSMSegments,OSMWays,OSMRelations,profile,start_node,join_segment,finish_node,start_waypoint,finish_waypoint);
624
625 if(!results[nresults])
626 exit(EXIT_FAILURE);
627
628 join_segment=results[nresults]->last_segment;
629
630 nresults++;
631 }
632
633 if(loop && !reverse)
634 {
635 start_node=finish_node;
636 finish_node=point_node[first_waypoint];
637
638 start_waypoint=finish_waypoint;
639 finish_waypoint=first_waypoint;
640
641 /* Calculate the route */
642
643 if(!option_quiet)
644 printf("Routing from waypoint %d to waypoint %d\n",start_waypoint,finish_waypoint);
645
646 results[nresults]=CalculateRoute(OSMNodes,OSMSegments,OSMWays,OSMRelations,profile,start_node,join_segment,finish_node,start_waypoint,finish_waypoint);
647
648 if(!results[nresults])
649 exit(EXIT_FAILURE);
650
651 nresults++;
652 }
653
654 if(!option_quiet)
655 {
656 printf("Routed OK\n");
657 fflush(stdout);
658 }
659
660 /* Print out the combined route */
661
662 if(!option_quiet)
663 printf_first("Generating Result Outputs");
664
665 if(!option_file_none)
666 PrintRoute(results,nresults,OSMNodes,OSMSegments,OSMWays,profile,translation);
667
668 if(!option_quiet)
669 printf_last("Generated Result Outputs");
670
671 /* Destroy the remaining results lists and data structures */
672
673 #ifdef DEBUG_MEMORY_LEAK
674
675 for(waypoint=0;waypoint<nresults;waypoint++)
676 FreeResultsList(results[waypoint]);
677
678 DestroyNodeList(OSMNodes);
679 DestroySegmentList(OSMSegments);
680 DestroyWayList(OSMWays);
681 DestroyRelationList(OSMRelations);
682
683 FreeXMLProfiles();
684
685 FreeXMLTranslations();
686
687 #endif
688
689 if(!option_quiet)
690 printf_program_end();
691
692 exit(EXIT_SUCCESS);
693 }
694
695
696 /*++++++++++++++++++++++++++++++++++++++
697 Print out the usage information.
698
699 int detail The level of detail to use: -1 = just version number, 0 = low detail, 1 = full details.
700
701 const char *argerr The argument that gave the error (if there is one).
702
703 const char *err Other error message (if there is one).
704 ++++++++++++++++++++++++++++++++++++++*/
705
706 static void print_usage(int detail,const char *argerr,const char *err)
707 {
708 if(detail<0)
709 {
710 fprintf(stderr,
711 "Routino version " ROUTINO_VERSION " " ROUTINO_URL ".\n"
712 );
713 }
714
715 if(detail>=0)
716 {
717 fprintf(stderr,
718 "Usage: router [--version]\n"
719 " [--help | --help-profile | --help-profile-xml |\n"
720 " --help-profile-json | --help-profile-perl ]\n"
721 " [--dir=<dirname>] [--prefix=<name>]\n"
722 " [--profiles=<filename>] [--translations=<filename>]\n"
723 " [--exact-nodes-only]\n"
724 " [--quiet | [--loggable] [--logtime] [--logmemory]]\n"
725 " [--language=<lang>]\n"
726 " [--output-html]\n"
727 " [--output-gpx-track] [--output-gpx-route]\n"
728 " [--output-text] [--output-text-all]\n"
729 " [--output-none] [--output-stdout]\n"
730 " [--profile=<name>]\n"
731 " [--transport=<transport>]\n"
732 " [--shortest | --quickest]\n"
733 " --lon1=<longitude> --lat1=<latitude>\n"
734 " --lon2=<longitude> --lon2=<latitude>\n"
735 " [ ... --lon99=<longitude> --lon99=<latitude>]\n"
736 " [--reverse] [--loop]\n"
737 " [--highway-<highway>=<preference> ...]\n"
738 " [--speed-<highway>=<speed> ...]\n"
739 " [--property-<property>=<preference> ...]\n"
740 " [--oneway=(0|1)] [--turns=(0|1)]\n"
741 " [--weight=<weight>]\n"
742 " [--height=<height>] [--width=<width>] [--length=<length>]\n");
743
744 if(argerr)
745 fprintf(stderr,
746 "\n"
747 "Error with command line parameter: %s\n",argerr);
748
749 if(err)
750 fprintf(stderr,
751 "\n"
752 "Error: %s\n",err);
753 }
754
755 if(detail==1)
756 fprintf(stderr,
757 "\n"
758 "--version Print the version of Routino.\n"
759 "\n"
760 "--help Prints this information.\n"
761 "--help-profile Prints the information about the selected profile.\n"
762 "--help-profile-xml Prints all loaded profiles in XML format.\n"
763 "--help-profile-json Prints all loaded profiles in JSON format.\n"
764 "--help-profile-perl Prints all loaded profiles in Perl format.\n"
765 "\n"
766 "--dir=<dirname> The directory containing the routing database.\n"
767 "--prefix=<name> The filename prefix for the routing database.\n"
768 "--profiles=<filename> The name of the XML file containing the profiles\n"
769 " (defaults to 'profiles.xml' with '--dir' and\n"
770 " '--prefix' options or the file installed in\n"
771 " '" ROUTINO_DATADIR "').\n"
772 "--translations=<fname> The name of the XML file containing the translations\n"
773 " (defaults to 'translations.xml' with '--dir' and\n"
774 " '--prefix' options or the file installed in\n"
775 " '" ROUTINO_DATADIR "').\n"
776 "\n"
777 "--exact-nodes-only Only route between nodes (don't find closest segment).\n"
778 "\n"
779 "--quiet Don't print any screen output when running.\n"
780 "--loggable Print progress messages suitable for logging to file.\n"
781 "--logtime Print the elapsed time for each processing step.\n"
782 "--logmemory Print the max allocated/mapped memory for each step.\n"
783 "\n"
784 "--language=<lang> Use the translations for specified language.\n"
785 "--output-html Write an HTML description of the route.\n"
786 "--output-gpx-track Write a GPX track file with all route points.\n"
787 "--output-gpx-route Write a GPX route file with interesting junctions.\n"
788 "--output-text Write a plain text file with interesting junctions.\n"
789 "--output-text-all Write a plain text file with all route points.\n"
790 "--output-none Don't write any output files or read any translations.\n"
791 " (If no output option is given then all are written.)\n"
792 "--output-stdout Write to stdout instead of a file (requires exactly\n"
793 " one output format option, implies '--quiet').\n"
794 "\n"
795 "--profile=<name> Select the loaded profile with this name.\n"
796 "--transport=<transport> Select the transport to use (selects the profile\n"
797 " named after the transport if '--profile' is not used.)\n"
798 "\n"
799 "--shortest Find the shortest route between the waypoints.\n"
800 "--quickest Find the quickest route between the waypoints.\n"
801 "\n"
802 "--lon<n>=<longitude> Specify the longitude of the n'th waypoint.\n"
803 "--lat<n>=<latitude> Specify the latitude of the n'th waypoint.\n"
804 "\n"
805 "--reverse Find a route between the waypoints in reverse order.\n"
806 "--loop Find a route that returns to the first waypoint.\n"
807 "\n"
808 "--heading=<bearing> Initial compass bearing at lowest numbered waypoint.\n"
809 "\n"
810 " Routing preference options\n"
811 "--highway-<highway>=<preference> * preference for highway type (%%).\n"
812 "--speed-<highway>=<speed> * speed for highway type (km/h).\n"
813 "--property-<property>=<preference> * preference for proprty type (%%).\n"
814 "--oneway=(0|1) * oneway restrictions are to be obeyed.\n"
815 "--turns=(0|1) * turn restrictions are to be obeyed.\n"
816 "--weight=<weight> * maximum weight limit (tonnes).\n"
817 "--height=<height> * maximum height limit (metres).\n"
818 "--width=<width> * maximum width limit (metres).\n"
819 "--length=<length> * maximum length limit (metres).\n"
820 "\n"
821 "<transport> defaults to motorcar but can be set to:\n"
822 "%s"
823 "\n"
824 "<highway> can be selected from:\n"
825 "%s"
826 "\n"
827 "<property> can be selected from:\n"
828 "%s",
829 TransportList(),HighwayList(),PropertyList());
830
831 exit(!detail);
832 }

Properties

Name Value
cvs:description Router.