routino-3.4.1/ 40755 233 144 0 14450044533 6354 5 routino-3.4.1/src/ 40755 233 144 0 14450050342 7136 5 routino-3.4.1/src/planetsplitter.c 644 233 144 55254 14437671417 12444 0 /***************************************
OSM planet file splitter.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2017, 2023 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include
#include
#include "version.h"
#include "types.h"
#include "ways.h"
#include "typesx.h"
#include "nodesx.h"
#include "segmentsx.h"
#include "waysx.h"
#include "relationsx.h"
#include "superx.h"
#include "prunex.h"
#include "files.h"
#include "logging.h"
#include "errorlogx.h"
#include "functions.h"
#include "osmparser.h"
#include "tagging.h"
#include "uncompress.h"
/* Global variables */
/*+ The name of the temporary directory. +*/
char *option_tmpdirname=NULL;
/*+ The amount of RAM to use for filesorting. +*/
ssize_t option_filesort_ramsize=0;
/*+ The number of threads to use for filesorting. +*/
int option_filesort_threads=1;
/* Local functions */
static void print_usage(int detail,const char *argerr,const char *err);
/*++++++++++++++++++++++++++++++++++++++
The main program for the planetsplitter.
++++++++++++++++++++++++++++++++++++++*/
int main(int argc,char** argv)
{
NodesX *OSMNodes;
SegmentsX *OSMSegments,*SuperSegments=NULL,*MergedSegments=NULL;
WaysX *OSMWays;
RelationsX *OSMRelations;
int iteration=0,quit=0;
int max_iterations=5;
char *dirname=NULL,*prefix=NULL,*tagging=NULL,*errorlog=NULL;
int option_parse_only=0,option_process_only=0;
int option_append=0,option_keep=0,option_changes=0;
int option_filenames=0;
int option_prune_isolated=500,option_prune_short=5,option_prune_straight=3;
int arg;
printf_program_start();
/* Parse the command line arguments */
for(arg=1;arg1024*1024)
print_usage(0,NULL,"Sorting RAM size '--sort-ram-size=...' must be positive and in MB.");
else if(option_filesort_ramsize==0)
{
#if SLIM
option_filesort_ramsize=256*1024*1024;
#else
option_filesort_ramsize=1024*1024*1024;
#endif
}
else
option_filesort_ramsize*=1024*1024;
#if defined(USE_PTHREADS) && USE_PTHREADS
if(option_filesort_threads<1 || option_filesort_threads>32)
print_usage(0,NULL,"Sorting threads '--sort-threads=...' must be small positive integer.");
#endif
if(!option_tmpdirname)
{
if(!dirname)
option_tmpdirname=".";
else
option_tmpdirname=dirname;
}
if(!option_process_only)
{
if(tagging)
{
if(!ExistsFile(tagging))
{
fprintf(stderr,"Error: The '--tagging' option specifies a file '%s' that does not exist.\n",tagging);
exit(EXIT_FAILURE);
}
}
else
{
tagging=FileName(dirname,prefix,"tagging.xml");
if(!ExistsFile(tagging))
{
char *defaulttagging=FileName(ROUTINO_DATADIR,NULL,"tagging.xml");
if(!ExistsFile(defaulttagging))
{
fprintf(stderr,"Error: The '--tagging' option was not used and the files '%s' and '%s' do not exist.\n",tagging,defaulttagging);
exit(EXIT_FAILURE);
}
free(tagging);
tagging=defaulttagging;
}
}
if(ParseXMLTaggingRules(tagging))
{
fprintf(stderr,"Error: Cannot read the tagging rules in the file '%s'.\n",tagging);
exit(EXIT_FAILURE);
}
}
/* Create new node, segment, way and relation variables */
OSMNodes=NewNodeList(option_append||option_changes,option_process_only);
OSMWays=NewWayList(option_append||option_changes,option_process_only);
OSMRelations=NewRelationList(option_append||option_changes,option_process_only);
/* Create the error log file */
if(errorlog)
open_errorlog(FileName(dirname,prefix,errorlog),option_append||option_changes||option_process_only,option_keep);
/* Parse the file */
if(!option_process_only)
{
for(arg=1;arg9?"=":"");
fflush(stdout);
if(iteration==0)
{
/* Select the super-nodes */
ChooseSuperNodes(OSMNodes,OSMSegments,OSMWays);
/* Select the super-segments */
SuperSegments=CreateSuperSegments(OSMNodes,OSMSegments,OSMWays);
nsuper=OSMSegments->number;
}
else
{
SegmentsX *SuperSegments2;
/* Index the super-segments */
IndexSegments(SuperSegments,OSMNodes,OSMWays);
/* Select the super-nodes */
ChooseSuperNodes(OSMNodes,SuperSegments,OSMWays);
/* Select the super-segments */
SuperSegments2=CreateSuperSegments(OSMNodes,SuperSegments,OSMWays);
nsuper=SuperSegments->number;
FreeSegmentList(SuperSegments);
SuperSegments=SuperSegments2;
}
/* Sort the super-segments and remove duplicates */
DeduplicateSuperSegments(SuperSegments,OSMWays);
/* Check for end condition */
if(SuperSegments->number==nsuper)
quit=1;
iteration++;
if(iteration>max_iterations)
quit=1;
}
while(!quit);
/* Combine the super-segments */
printf("\nCombine Segments and Super-Segments\n===================================\n\n");
fflush(stdout);
/* Merge the super-segments */
MergedSegments=MergeSuperSegments(OSMSegments,SuperSegments);
FreeSegmentList(OSMSegments);
FreeSegmentList(SuperSegments);
OSMSegments=MergedSegments;
/* Cross reference the nodes and segments */
printf("\nCross-Reference Nodes and Segments\n==================================\n\n");
fflush(stdout);
/* Sort the nodes and segments geographically */
SortNodeListGeographically(OSMNodes);
SortSegmentListGeographically(OSMSegments,OSMNodes);
/* Re-index the segments */
IndexSegments(OSMSegments,OSMNodes,OSMWays);
/* Sort the turn relations geographically */
SortTurnRelationListGeographically(OSMRelations,OSMNodes,OSMSegments,1);
/* Output the results */
printf("\nWrite Out Database Files\n========================\n\n");
fflush(stdout);
/* Write out the nodes */
SaveNodeList(OSMNodes,FileName(dirname,prefix,"nodes.mem"),OSMSegments);
/* Write out the segments */
SaveSegmentList(OSMSegments,FileName(dirname,prefix,"segments.mem"));
/* Write out the ways */
SaveWayList(OSMWays,FileName(dirname,prefix,"ways.mem"));
/* Write out the relations */
SaveRelationList(OSMRelations,FileName(dirname,prefix,"relations.mem"));
/* Free the memory (delete the temporary files) */
FreeSegmentList(OSMSegments);
/* Close the error log file and process the data */
if(errorlog)
{
close_errorlog();
if(option_keep)
{
ErrorLogsX *OSMErrorLogs;
printf("\nCreate Error Log\n================\n\n");
fflush(stdout);
OSMErrorLogs=NewErrorLogList();
ProcessErrorLogs(OSMErrorLogs,OSMNodes,OSMWays,OSMRelations);
SortErrorLogsGeographically(OSMErrorLogs);
SaveErrorLogs(OSMErrorLogs,FileName(dirname,prefix,"errorlogs.mem"));
FreeErrorLogList(OSMErrorLogs);
}
}
/* Free the memory (delete the temporary files) */
FreeNodeList(OSMNodes,0);
FreeWayList(OSMWays,0);
FreeRelationList(OSMRelations,0);
printf("\n");
fflush(stdout);
printf_program_end();
exit(EXIT_SUCCESS);
}
/*++++++++++++++++++++++++++++++++++++++
Print out the usage information.
int detail The level of detail to use: -1 = just version number, 0 = low detail, 1 = full details.
const char *argerr The argument that gave the error (if there is one).
const char *err Other error message (if there is one).
++++++++++++++++++++++++++++++++++++++*/
static void print_usage(int detail,const char *argerr,const char *err)
{
if(detail<0)
{
fprintf(stderr,
"Routino version " ROUTINO_VERSION " " ROUTINO_URL ".\n"
);
}
if(detail>=0)
{
fprintf(stderr,
"Usage: planetsplitter [--version]\n"
" [--help]\n"
" [--dir=] [--prefix=]\n"
#if defined(USE_PTHREADS) && USE_PTHREADS
" [--sort-ram-size=] [--sort-threads=]\n"
#else
" [--sort-ram-size=]\n"
#endif
" [--tmpdir=]\n"
" [--tagging=]\n"
" [--loggable] [--logtime] [--logmemory]\n"
" [--errorlog[=]]\n"
" [--parse-only | --process-only]\n"
" [--append] [--keep] [--changes]\n"
" [--max-iterations=]\n"
" [--prune-none]\n"
" [--prune-isolated=]\n"
" [--prune-short=]\n"
" [--prune-straight=]\n"
" [ ... | ...\n"
" | ...\n"
" | ... | ..."
#if defined(USE_BZIP2) && USE_BZIP2
"\n | ..."
#endif
#if defined(USE_GZIP) && USE_GZIP
"\n | ..."
#endif
#if defined(USE_XZ) && USE_XZ
"\n | ..."
#endif
"]\n");
if(argerr)
fprintf(stderr,
"\n"
"Error with command line parameter: %s\n",argerr);
if(err)
fprintf(stderr,
"\n"
"Error: %s\n",err);
}
if(detail==1)
fprintf(stderr,
"\n"
"--version Print the version of Routino.\n"
"\n"
"--help Prints this information.\n"
"\n"
"--dir= The directory containing the routing database.\n"
"--prefix= The filename prefix for the routing database.\n"
"\n"
"--sort-ram-size= The amount of RAM (in MB) to use for data sorting\n"
#if SLIM
" (defaults to 256MB otherwise.)\n"
#else
" (defaults to 1024MB otherwise.)\n"
#endif
#if defined(USE_PTHREADS) && USE_PTHREADS
"--sort-threads= The number of threads to use for data sorting.\n"
#endif
"\n"
"--tmpdir= The directory name for temporary files.\n"
" (defaults to the '--dir' option directory.)\n"
"\n"
"--tagging= The name of the XML file containing the tagging rules\n"
" (defaults to 'tagging.xml' with '--dir' and\n"
" '--prefix' options or the file installed in\n"
" '" ROUTINO_DATADIR "').\n"
"\n"
"--loggable Print progress messages suitable for logging to file.\n"
"--logtime Print the elapsed time for each processing step.\n"
"--logmemory Print the max allocated/mapped memory for each step.\n"
"--errorlog[=] Log parsing errors to 'error.log' or the given name\n"
" (the '--dir' and '--prefix' options are applied).\n"
"\n"
"--parse-only Parse the OSM/OSC file(s) and store the results.\n"
"--process-only Process the stored results from previous option.\n"
"--append Parse the OSM file(s) and append to existing results.\n"
"--keep Keep the intermediate files after parsing & sorting.\n"
"--changes Parse the data as an OSC file and apply the changes.\n"
"\n"
"--max-iterations= The number of iterations for finding super-nodes\n"
" (defaults to 5).\n"
"\n"
"--prune-none Disable the prune options below, they are re-enabled\n"
" by adding them to the command line after this option.\n"
"--prune-isolated= Remove access from small disconnected segment groups\n"
" (defaults to removing groups under 500m).\n"
"--prune-short= Remove short segments (defaults to removing segments\n"
" up to a maximum length of 5m).\n"
"--prune-straight= Remove nodes in almost straight highways (defaults to\n"
" removing nodes up to 3m offset from a straight line).\n"
"\n"
", , , , \n"
" The name(s) of the file(s) to read and parse.\n"
" Filenames ending '.pbf' read as PBF, filenames ending\n"
" '.o5m' or '.o5c' read as O5M/O5C, others as XML.\n"
#if defined(USE_BZIP2) && USE_BZIP2
" Filenames ending '.bz2' will be bzip2 uncompressed.\n"
#endif
#if defined(USE_GZIP) && USE_GZIP
" Filenames ending '.gz' will be gzip uncompressed.\n"
#endif
#if defined(USE_XZ) && USE_XZ
" Filenames ending '.xz' will be xz uncompressed.\n"
#endif
"\n"
" defaults to all but can be set to:\n"
"%s"
"\n"
" can be selected from:\n"
"%s"
"\n"
" can be selected from:\n"
"%s",
TransportList(),HighwayList(),PropertyList());
exit(!detail);
}
routino-3.4.1/src/types.h 644 233 144 34337 13455661565 10544 0 /***************************************
Type definitions
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2014, 2019 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef TYPES_H
#define TYPES_H /*+ To stop multiple inclusions. +*/
#include
#include
#include
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/* Constants and macros for handling them */
/*+ The number of waypoints allowed to be specified. +*/
#define NWAYPOINTS 99
/*+ An undefined waypoint index. +*/
#define NO_WAYPOINT ((waypoint_t)~0)
/*+ An undefined node index. +*/
#define NO_NODE ((index_t)~0)
/*+ An undefined segment index. +*/
#define NO_SEGMENT ((index_t)~0)
/*+ An undefined way index. +*/
#define NO_WAY ((index_t)~0)
/*+ An undefined relation index. +*/
#define NO_RELATION ((index_t)~0)
/*+ An undefined location. +*/
#define NO_LATLONG ((latlong_t)0x80000000)
/*+ The lowest number allowed for a fake node. +*/
#define NODE_FAKE ((index_t)0xffff0000)
/*+ The lowest number allowed for a fake segment. +*/
#define SEGMENT_FAKE ((index_t)0xffff0000)
/*+ The latitude and longitude conversion factor from floating point (radians) to integer. +*/
#define LAT_LONG_SCALE (1024*65536)
/*+ The latitude and longitude integer range within each bin. +*/
#define LAT_LONG_BIN 65536
/*+ A flag to mark a node as a super-node. +*/
#define NODE_SUPER ((nodeflags_t)0x8000)
/*+ A flag to mark a node as suitable for a U-turn. +*/
#define NODE_UTURN ((nodeflags_t)0x4000)
/*+ A flag to mark a node as a mini-roundabout. +*/
#define NODE_MINIRNDBT ((nodeflags_t)0x2000)
/*+ A flag to mark a node as a turn relation via node. +*/
#define NODE_TURNRSTRCT ((nodeflags_t)0x1000)
/*+ A flag to mark a node as adjacent to a turn relation via node. +*/
#define NODE_TURNRSTRCT2 ((nodeflags_t)0x0800)
/*+ A flag to mark a node as deleted. +*/
#define NODE_DELETED ((nodeflags_t)0x0400)
/*+ A flag to mark a segment as being part of an area (must be the highest valued flag). +*/
#define SEGMENT_AREA ((distance_t)0x80000000)
/*+ A flag to mark a segment as one-way from node1 to node2. +*/
#define ONEWAY_1TO2 ((distance_t)0x40000000)
/*+ A flag to mark a segment as one-way from node2 to node1. +*/
#define ONEWAY_2TO1 ((distance_t)0x20000000)
/*+ A flag to mark a segment as a super-segment. +*/
#define SEGMENT_SUPER ((distance_t)0x10000000)
/*+ A flag to mark a segment as a normal segment. +*/
#define SEGMENT_NORMAL ((distance_t)0x08000000)
/*+ The real distance ignoring the other flags. +*/
#define DISTANCE(xx) ((distance_t)((xx)&(~(SEGMENT_AREA|ONEWAY_1TO2|ONEWAY_2TO1|SEGMENT_SUPER|SEGMENT_NORMAL))))
/*+ The distance flags selecting only the flags. +*/
#define DISTFLAG(xx) ((distance_t)((xx)&(SEGMENT_AREA|ONEWAY_1TO2|ONEWAY_2TO1|SEGMENT_SUPER|SEGMENT_NORMAL)))
/*+ A very large almost infinite distance. +*/
#define INF_DISTANCE DISTANCE(~0)
/*+ A very large almost infinite score. +*/
#define INF_SCORE (score_t)1E30
/*+ A flag to mark a deleted way. +*/
#define WAY_DELETED ((highway_t)~0)
/*+ A flag to mark a deleted relation. +*/
#define RELATION_DELETED ((transports_t)~0)
/* Simple Types */
/*+ A waypoint index. +*/
typedef uint16_t waypoint_t;
/*+ A node, segment, way or relation index. +*/
typedef uint32_t index_t;
/*+ A printf formatting string for an index_t type (this should match the index_t definition above). +*/
#define Pindex_t PRIu32 /* PRIu32 and PRIu64 are defined in intypes.h */
/*+ A node latitude or longitude (range: +/-pi*LAT_LONG_SCALE = +/-3.14*1024*65536 = ~29 bits). +*/
typedef int32_t latlong_t;
/*+ A node latitude or longitude bin number (range: +/-pi*LAT_LONG_SCALE/LAT_LONG_BIN = +/-3.14*1024 = ~13 bits). +*/
typedef int16_t ll_bin_t;
/*+ A node latitude and longitude bin number (range: +/-(pi*LAT_LONG_SCALE/LAT_LONG_BIN)^2 = +/-(3.14*1024)^2 = ~26 bits). +*/
typedef int32_t ll_bin2_t;
/*+ A node latitude or longitude offset (range: 0 -> LAT_LONG_BIN-1 = 0 -> 65535 = 16 bits). +*/
typedef uint16_t ll_off_t;
/*+ Conversion from a latlong (integer latitude or longitude) to a bin number. +*/
#define latlong_to_bin(xxx) (ll_bin_t)((latlong_t)((xxx)&~(LAT_LONG_BIN-1))/LAT_LONG_BIN)
/*+ Conversion from a bin number to a latlong (integer latitude or longitude). +*/
#define bin_to_latlong(xxx) ((latlong_t)(xxx)*LAT_LONG_BIN)
/*+ Conversion from a latlong (integer latitude or longitude) to a bin offset. +*/
#define latlong_to_off(xxx) (ll_off_t)((latlong_t)(xxx)&(LAT_LONG_BIN-1))
/*+ Conversion from a bin offset to a latlong (integer latitude or longitude). +*/
#define off_to_latlong(xxx) ((latlong_t)(xxx))
/*+ Conversion from a latitude or longitude in radians to a latlong (integer latitude or longitude). +*/
#define radians_to_latlong(xxx) ((latlong_t)floor((xxx)*LAT_LONG_SCALE+0.5))
/*+ Conversion from a latlong (integer latitude or longitude) to a latitude or longitude in radians. +*/
#define latlong_to_radians(xxx) ((double)(xxx)/LAT_LONG_SCALE)
/*+ Conversion from radians to degrees. +*/
#define radians_to_degrees(xxx) ((xxx)*(180.0/M_PI))
/*+ Conversion from degrees to radians. +*/
#define degrees_to_radians(xxx) ((xxx)*(M_PI/180.0))
/*+ Node flags. +*/
typedef uint16_t nodeflags_t;
/*+ A distance, measured in metres (will not overflow for any earth-based distance). +*/
typedef uint32_t distance_t;
/*+ A duration, measured in 1/10th seconds (will not overflow for 13 years). +*/
typedef uint32_t duration_t;
/*+ A routing optimisation score. +*/
typedef float score_t;
/*+ Conversion from distance_t to kilometres. +*/
#define distance_to_km(xx) ((double)(xx)/1000.0)
/*+ Conversion from kilometres to distance_t. +*/
#define km_to_distance(xx) ((distance_t)((double)(xx)*1000.0))
/*+ Conversion from duration_t to minutes. +*/
#define duration_to_minutes(xx) ((double)(xx)/600.0)
/*+ Conversion from duration_t to hours. +*/
#define duration_to_hours(xx) ((double)(xx)/36000.0)
/*+ Conversion from hours to duration_t. +*/
#define hours_to_duration(xx) ((duration_t)((double)(xx)*36000.0))
/*+ Conversion from distance_t and speed_t to duration_t. +*/
#define distance_speed_to_duration(xx,yy) ((duration_t)(((double)(xx)/(double)(yy))*(36000.0/1000.0)))
/*+ The type of a highway. +*/
typedef uint8_t highway_t;
/*+ The different types of a highway. +*/
typedef enum _Highway
{
Highway_None = 0,
Highway_Motorway = 1,
Highway_Trunk = 2,
Highway_Primary = 3,
Highway_Secondary = 4,
Highway_Tertiary = 5,
Highway_Unclassified = 6,
Highway_Residential = 7,
Highway_Service = 8,
Highway_Track = 9,
Highway_Cycleway = 10,
Highway_Path = 11,
Highway_Steps = 12,
Highway_Ferry = 13,
Highway_Count = 14, /* One more than the number of highway types. */
Highway_CycleBothWays = 16,
Highway_OneWay = 32,
Highway_Roundabout = 64,
Highway_Area = 128
}
Highway;
#define HIGHWAY(xx) ((xx)&0x0f)
/*+ A bitmask of multiple highway types. +*/
typedef uint16_t highways_t;
#define HIGHWAYS(xx) (1<<(HIGHWAY(xx)-1))
/*+ The different types of a highway as a bitmask. +*/
typedef enum _Highways
{
Highways_None = 0,
Highways_Motorway = HIGHWAYS(Highway_Motorway ),
Highways_Trunk = HIGHWAYS(Highway_Trunk ),
Highways_Primary = HIGHWAYS(Highway_Primary ),
Highways_Secondary = HIGHWAYS(Highway_Secondary ),
Highways_Tertiary = HIGHWAYS(Highway_Tertiary ),
Highways_Unclassified = HIGHWAYS(Highway_Unclassified),
Highways_Residential = HIGHWAYS(Highway_Residential ),
Highways_Service = HIGHWAYS(Highway_Service ),
Highways_Track = HIGHWAYS(Highway_Track ),
Highways_Cycleway = HIGHWAYS(Highway_Cycleway ),
Highways_Path = HIGHWAYS(Highway_Path ),
Highways_Steps = HIGHWAYS(Highway_Steps ),
Highways_Ferry = HIGHWAYS(Highway_Ferry )
}
Highways;
/*+ The type of a transport. +*/
typedef uint8_t transport_t;
/*+ The different types of transport. +*/
typedef enum _Transport
{
Transport_None = 0,
Transport_Foot = 1,
Transport_Horse = 2,
Transport_Wheelchair = 3,
Transport_Bicycle = 4,
Transport_Moped = 5,
Transport_Motorcycle = 6,
Transport_Motorcar = 7,
Transport_Goods = 8,
Transport_HGV = 9,
Transport_PSV = 10,
Transport_Count = 11 /*+ One more than the number of transport types. +*/
}
Transport;
/*+ A bitmask of multiple transport types. +*/
typedef uint16_t transports_t;
#define TRANSPORTS(xx) (1<<((xx)-1))
/*+ The different types of transport as a bitmask. +*/
typedef enum _Transports
{
Transports_None = 0,
Transports_Foot = TRANSPORTS(Transport_Foot ),
Transports_Horse = TRANSPORTS(Transport_Horse ),
Transports_Wheelchair = TRANSPORTS(Transport_Wheelchair),
Transports_Bicycle = TRANSPORTS(Transport_Bicycle ),
Transports_Moped = TRANSPORTS(Transport_Moped ),
Transports_Motorcycle = TRANSPORTS(Transport_Motorcycle),
Transports_Motorcar = TRANSPORTS(Transport_Motorcar ),
Transports_Goods = TRANSPORTS(Transport_Goods ),
Transports_HGV = TRANSPORTS(Transport_HGV ),
Transports_PSV = TRANSPORTS(Transport_PSV ),
Transports_ALL = TRANSPORTS(Transport_Count )-1
}
Transports;
/*+ The type of a property. +*/
typedef uint8_t property_t;
/*+ The different types of property. +*/
typedef enum _Property
{
Property_None = 0,
Property_Paved = 1,
Property_Multilane = 2,
Property_Bridge = 3,
Property_Tunnel = 4,
Property_FootRoute = 5,
Property_BicycleRoute = 6,
Property_Count = 7 /* One more than the number of property types. */
}
Property;
/*+ A bitmask of multiple properties. +*/
typedef uint8_t properties_t;
#define PROPERTIES(xx) (1<<((xx)-1))
/*+ The different properties as a bitmask. +*/
typedef enum _Properties
{
Properties_None = 0,
Properties_Paved = PROPERTIES(Property_Paved ),
Properties_Multilane = PROPERTIES(Property_Multilane ),
Properties_Bridge = PROPERTIES(Property_Bridge ),
Properties_Tunnel = PROPERTIES(Property_Tunnel ),
Properties_FootRoute = PROPERTIES(Property_FootRoute ),
Properties_BicycleRoute = PROPERTIES(Property_BicycleRoute ),
Properties_ALL = PROPERTIES(Property_Count )-1
}
Properties;
/*+ The speed limit of a way, measured in km/hour. +*/
typedef uint8_t speed_t;
/*+ The maximum weight of a way, measured in multiples of 0.2 tonnes. +*/
typedef uint8_t weight_t;
/*+ The maximum height of a way, measured in multiples of 0.1 metres. +*/
typedef uint8_t height_t;
/*+ The maximum width of a way, measured in multiples of 0.1 metres. +*/
typedef uint8_t width_t;
/*+ The maximum length of a way, measured in multiples of 0.1 metres. +*/
typedef uint8_t length_t;
/*+ Conversion of km/hr to speed_t - simple inline function with error checking. +*/
inline static speed_t kph_to_speed(double xxx);
inline static speed_t kph_to_speed(double xxx) { if(xxx>255) return(255); if(xxx<0) return(0); return((speed_t)xxx); }
/*+ Conversion of speed_t to km/hr. +*/
#define speed_to_kph(xxx) (int)(xxx)
/*+ Conversion of tonnes to weight_t - simple inline function with error checking. +*/
inline static weight_t tonnes_to_weight(double xxx);
inline static weight_t tonnes_to_weight(double xxx) { if(xxx>51) return(255); if(xxx<0) return(0); return((weight_t)(xxx*5)); }
/*+ Conversion of weight_t to tonnes. +*/
#define weight_to_tonnes(xxx) ((double)(xxx)/5.0)
/*+ Conversion of metres to height_t - simple inline function with error checking. +*/
inline static height_t metres_to_height(double xxx);
inline static height_t metres_to_height(double xxx) { if(xxx>25.5) return(255); if(xxx<0) return(0); return((height_t)(xxx*10)); }
/*+ Conversion of height_t to metres. +*/
#define height_to_metres(xxx) ((double)(xxx)/10.0)
/*+ Conversion of metres to width_t - simple inline function with error checking. +*/
inline static width_t metres_to_width(double xxx);
inline static width_t metres_to_width(double xxx) { if(xxx>25.5) return(255); if(xxx<0) return(0); return((width_t)(xxx*10)); }
/*+ Conversion of width_t to metres. +*/
#define width_to_metres(xxx) ((double)(xxx)/10.0)
/*+ Conversion of metres to length_t - simple inline function with error checking. +*/
inline static length_t metres_to_length(double xxx);
inline static length_t metres_to_length(double xxx) { if(xxx>25.5) return(255); if(xxx<0) return(0); return((length_t)(xxx*10)); }
/*+ Conversion of length_t to metres. +*/
#define length_to_metres(xxx) ((double)(xxx)/10.0)
/* Data structures */
typedef struct _Node Node;
typedef struct _Nodes Nodes;
typedef struct _Segment Segment;
typedef struct _Segments Segments;
typedef struct _Way Way;
typedef struct _Ways Ways;
typedef struct _TurnRelation TurnRelation;
typedef struct _Relations Relations;
/* Functions in types.c */
Highway HighwayType(const char *highway);
Transport TransportType(const char *transport);
Property PropertyType(const char *property);
const char *HighwayName(Highway highway);
const char *TransportName(Transport transport);
const char *PropertyName(Property property);
const char *HighwaysNameList(highways_t highways);
const char *TransportsNameList(transports_t transports);
const char *PropertiesNameList(properties_t properties);
const char *HighwayList(void);
const char *TransportList(void);
const char *PropertyList(void);
#endif /* TYPES_H */
routino-3.4.1/src/ways.h 644 233 144 12352 13455415301 10335 0 /***************************************
A header file for the ways.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2016, 2019 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef WAYS_H
#define WAYS_H /*+ To stop multiple inclusions. +*/
#include
#include
#include "types.h"
#include "cache.h"
#include "files.h"
/* Data structures */
/*+ A structure containing a single way (members ordered to minimise overall size). +*/
struct _Way
{
index_t name; /*+ The offset of the name of the way in the names array. +*/
transports_t allow; /*+ The type of traffic allowed on the way. +*/
highway_t type; /*+ The highway type of the way. +*/
properties_t props; /*+ The properties of the way. +*/
speed_t speed; /*+ The defined maximum speed limit of the way. +*/
weight_t weight; /*+ The defined maximum weight of traffic on the way. +*/
height_t height; /*+ The defined maximum height of traffic on the way. +*/
width_t width; /*+ The defined maximum width of traffic on the way. +*/
length_t length; /*+ The defined maximum length of traffic on the way. +*/
};
/*+ A structure containing the header from the file. +*/
typedef struct _WaysFile
{
index_t number; /*+ The number of ways. +*/
highways_t highways; /*+ The types of highways that were seen when parsing. +*/
transports_t transports; /*+ The types of traffic that were seen when parsing. +*/
properties_t properties; /*+ The properties that were seen when parsing. +*/
}
WaysFile;
/*+ A structure containing a set of ways (and pointers to mmap file). +*/
struct _Ways
{
WaysFile file; /*+ The header data from the file. +*/
#if !SLIM
char *data; /*+ The memory mapped data. +*/
Way *ways; /*+ An array of ways. +*/
char *names; /*+ An array of characters containing the names. +*/
#else
int fd; /*+ The file descriptor for the file. +*/
offset_t namesoffset; /*+ The offset of the names within the file. +*/
Way cached[3]; /*+ Two cached nodes read from the file in slim mode. +*/
char *ncached[3]; /*+ The cached way name. +*/
WayCache *cache; /*+ A RAM cache of ways read from the file. +*/
#endif
};
/* Functions in ways.c */
Ways *LoadWayList(const char *filename);
void DestroyWayList(Ways *ways);
int WaysCompare(Way *way1p,Way *way2p);
/* Macros and inline functions */
#if !SLIM
/*+ Return a Way* pointer given a set of ways and an index. +*/
#define LookupWay(xxx,yyy,zzz) (&(xxx)->ways[yyy])
/*+ Return the name of a way given the Way pointer and a set of ways. +*/
#define WayName(xxx,yyy) (&(xxx)->names[(yyy)->name])
#else
static inline Way *LookupWay(Ways *ways,index_t index,int position);
static inline char *WayName(Ways *ways,Way *wayp);
CACHE_NEWCACHE_PROTO(Way)
CACHE_DELETECACHE_PROTO(Way)
CACHE_FETCHCACHE_PROTO(Way)
CACHE_INVALIDATECACHE_PROTO(Way)
/* Data type */
CACHE_STRUCTURE(Way)
/* Inline functions */
CACHE_NEWCACHE(Way)
CACHE_DELETECACHE(Way)
CACHE_FETCHCACHE(Way)
CACHE_INVALIDATECACHE(Way)
/*++++++++++++++++++++++++++++++++++++++
Find the Way information for a particular way.
Way *LookupWay Returns a pointer to the cached way information.
Ways *ways The set of ways to use.
index_t index The index of the way.
int position The position in the cache to store the value.
++++++++++++++++++++++++++++++++++++++*/
static inline Way *LookupWay(Ways *ways,index_t index,int position)
{
ways->cached[position-1]=*FetchCachedWay(ways->cache,index,ways->fd,sizeof(WaysFile));
return(&ways->cached[position-1]);
}
/*++++++++++++++++++++++++++++++++++++++
Find the name of a way.
char *WayName Returns a pointer to the name of the way.
Ways *ways The set of ways to use.
Way *wayp The Way pointer.
++++++++++++++++++++++++++++++++++++++*/
static inline char *WayName(Ways *ways,Way *wayp)
{
int position=(int)(wayp-ways->cached);
int n=0;
if(!ways->ncached[position])
ways->ncached[position]=(char*)malloc(64);
while(!SlimFetch(ways->fd,ways->ncached[position]+n,64,ways->namesoffset+wayp->name+n))
{
int i;
for(i=n;incached[position][i]==0)
goto exitloop;
n+=64;
ways->ncached[position]=(char*)realloc((void*)ways->ncached[position],n+64);
}
exitloop:
return(ways->ncached[position]);
}
#endif
#endif /* WAYS_H */
routino-3.4.1/src/superx.c 644 233 144 37301 14242177043 10677 0 /***************************************
Super-Segment data type functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015, 2022 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include "types.h"
#include "segments.h"
#include "ways.h"
#include "typesx.h"
#include "nodesx.h"
#include "segmentsx.h"
#include "waysx.h"
#include "superx.h"
#include "files.h"
#include "logging.h"
#include "results.h"
/* Local functions */
static Results *FindSuperRoutes(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx,node_t start,Way *match);
/*++++++++++++++++++++++++++++++++++++++
Select the super-nodes from the list of nodes.
NodesX *nodesx The set of nodes to use.
SegmentsX *segmentsx The set of segments to use.
WaysX *waysx The set of ways to use.
++++++++++++++++++++++++++++++++++++++*/
void ChooseSuperNodes(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx)
{
index_t i;
index_t nnodes=0;
if(nodesx->number==0 || segmentsx->number==0 || waysx->number==0)
return;
/* Print the start message */
printf_first("Finding Super-Nodes: Nodes=0 Super-Nodes=0");
/* Allocate and set the super-node markers */
if(!nodesx->super)
{
nodesx->super=AllocBitMask(nodesx->number);
log_malloc(nodesx->super,SizeBitMask(nodesx->number));
SetAllBits(nodesx->super,nodesx->number);
}
/* Map into memory / open the files */
nodesx->fd=ReOpenFileBuffered(nodesx->filename_tmp);
#if !SLIM
segmentsx->data=MapFile(segmentsx->filename_tmp);
waysx->data=MapFile(waysx->filename_tmp);
#else
segmentsx->fd=SlimMapFile(segmentsx->filename_tmp);
waysx->fd=SlimMapFile(waysx->filename_tmp);
InvalidateSegmentXCache(segmentsx->cache);
InvalidateWayXCache(waysx->cache);
#endif
/* Find super-nodes */
for(i=0;inumber;i++)
{
NodeX nodex;
ReadFileBuffered(nodesx->fd,&nodex,sizeof(NodeX));
if(IsBitSet(nodesx->super,i))
{
int issuper=0;
if(nodex.flags&(NODE_TURNRSTRCT|NODE_TURNRSTRCT2))
issuper=1;
else
{
int count=0,j;
Way segmentway[MAX_SEG_PER_NODE];
int segmentweight[MAX_SEG_PER_NODE];
SegmentX *segmentx=FirstSegmentX(segmentsx,i,1);
while(segmentx)
{
WayX *wayx=LookupWayX(waysx,segmentx->way,1);
int nsegments;
/* Segments that are loops count twice */
logassert(countnode1==segmentx->node2)
segmentweight[count]=2;
else
segmentweight[count]=1;
segmentway[count]=wayx->way;
/* If the node allows less traffic types than any connecting way then it is super if it allows anything */
if((wayx->way.allow&nodex.allow)!=wayx->way.allow && nodex.allow!=Transports_None)
{
issuper=1;
break;
}
nsegments=segmentweight[count];
for(j=0;jway.allow & segmentway[j].allow)
{
/* If two ways are different in any attribute and there is a type of traffic that can use both then it is super */
if(WaysCompare(&segmentway[j],&wayx->way))
{
issuper=1;
break;
}
/* If there are two other segments that can be used by the same types of traffic as this one then it is super */
nsegments+=segmentweight[j];
if(nsegments>2)
{
issuper=1;
break;
}
}
if(issuper)
break;
segmentx=NextSegmentX(segmentsx,segmentx,i);
count++;
}
}
/* Mark the node as super if it is. */
if(issuper)
nnodes++;
else
ClearBit(nodesx->super,i);
}
if(!((i+1)%10000))
printf_middle("Finding Super-Nodes: Nodes=%"Pindex_t" Super-Nodes=%"Pindex_t,i+1,nnodes);
}
/* Unmap from memory / close the files */
#if !SLIM
segmentsx->data=UnmapFile(segmentsx->data);
waysx->data=UnmapFile(waysx->data);
#else
segmentsx->fd=SlimUnmapFile(segmentsx->fd);
waysx->fd=SlimUnmapFile(waysx->fd);
#endif
nodesx->fd=CloseFileBuffered(nodesx->fd);
/* Print the final message */
printf_last("Found Super-Nodes: Nodes=%"Pindex_t" Super-Nodes=%"Pindex_t,nodesx->number,nnodes);
}
/*++++++++++++++++++++++++++++++++++++++
Create the super-segments from the existing segments.
SegmentsX *CreateSuperSegments Returns the new super segments.
NodesX *nodesx The set of nodes to use.
SegmentsX *segmentsx The set of segments to use.
WaysX *waysx The set of ways to use.
++++++++++++++++++++++++++++++++++++++*/
SegmentsX *CreateSuperSegments(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx)
{
index_t i;
SegmentsX *supersegmentsx;
index_t sn=0,ss=0;
supersegmentsx=NewSegmentList();
if(segmentsx->number==0 || waysx->number==0)
{
FinishSegmentList(supersegmentsx);
return(supersegmentsx);
}
/* Print the start message */
printf_first("Creating Super-Segments: Super-Nodes=0 Super-Segments=0");
/* Map into memory / open the files */
#if !SLIM
nodesx->data=MapFile(nodesx->filename_tmp);
segmentsx->data=MapFile(segmentsx->filename_tmp);
waysx->data=MapFile(waysx->filename_tmp);
#else
nodesx->fd=SlimMapFile(nodesx->filename_tmp);
segmentsx->fd=SlimMapFile(segmentsx->filename_tmp);
waysx->fd=SlimMapFile(waysx->filename_tmp);
InvalidateNodeXCache(nodesx->cache);
InvalidateSegmentXCache(segmentsx->cache);
InvalidateWayXCache(waysx->cache);
#endif
/* Create super-segments for each super-node. */
for(i=0;inumber;i++)
{
if(IsBitSet(nodesx->super,i))
{
SegmentX *segmentx;
int count=0,match;
Way prevway[MAX_SEG_PER_NODE];
segmentx=FirstSegmentX(segmentsx,i,1);
while(segmentx)
{
WayX *wayx=LookupWayX(waysx,segmentx->way,1);
/* Check that this type of way hasn't already been routed */
match=0;
if(count>0)
{
int j;
for(j=0;jway))
{
match=1;
break;
}
}
logassert(countway;
/* Route the way and store the super-segments. */
if(!match)
{
Results *results=FindSuperRoutes(nodesx,segmentsx,waysx,i,&wayx->way);
Result *result=FirstResult(results);
while(result)
{
if(IsBitSet(nodesx->super,result->node) && result->segment!=NO_SEGMENT)
{
if(wayx->way.type&Highway_OneWay && result->node!=i)
AppendSegmentList(supersegmentsx,segmentx->way,i,result->node,DISTANCE((distance_t)result->score)|ONEWAY_1TO2);
else
AppendSegmentList(supersegmentsx,segmentx->way,i,result->node,DISTANCE((distance_t)result->score));
ss++;
}
result=NextResult(results,result);
}
}
segmentx=NextSegmentX(segmentsx,segmentx,i);
}
sn++;
if(!(sn%10000))
printf_middle("Creating Super-Segments: Super-Nodes=%"Pindex_t" Super-Segments=%"Pindex_t,sn,ss);
}
}
FinishSegmentList(supersegmentsx);
/* Unmap from memory / close the files */
#if !SLIM
nodesx->data=UnmapFile(nodesx->data);
segmentsx->data=UnmapFile(segmentsx->data);
waysx->data=UnmapFile(waysx->data);
#else
nodesx->fd=SlimUnmapFile(nodesx->fd);
segmentsx->fd=SlimUnmapFile(segmentsx->fd);
waysx->fd=SlimUnmapFile(waysx->fd);
#endif
/* Free the no-longer required memory */
if(segmentsx->firstnode)
{
log_free(segmentsx->firstnode);
free(segmentsx->firstnode);
segmentsx->firstnode=NULL;
}
/* Print the final message */
printf_last("Created Super-Segments: Super-Nodes=%"Pindex_t" Super-Segments=%"Pindex_t,sn,ss);
return(supersegmentsx);
}
/*++++++++++++++++++++++++++++++++++++++
Merge the segments and super-segments into a new segment list.
SegmentsX *MergeSuperSegments Returns a new set of merged segments.
SegmentsX *segmentsx The set of segments to use.
SegmentsX *supersegmentsx The set of super-segments to use.
++++++++++++++++++++++++++++++++++++++*/
SegmentsX *MergeSuperSegments(SegmentsX *segmentsx,SegmentsX *supersegmentsx)
{
index_t i,j,lastj;
index_t merged=0,added=0;
SegmentsX *mergedsegmentsx;
SegmentX supersegmentx;
mergedsegmentsx=NewSegmentList();
if(segmentsx->number==0)
{
FinishSegmentList(mergedsegmentsx);
return(mergedsegmentsx);
}
/* Print the start message */
printf_first("Merging Segments: Segments=0 Super=0 Merged=0 Added=0");
/* Open the files */
segmentsx->fd=ReOpenFileBuffered(segmentsx->filename_tmp);
if(supersegmentsx->number>0)
supersegmentsx->fd=ReOpenFileBuffered(supersegmentsx->filename_tmp);
/* Loop through and create a new list of combined segments */
lastj=-1;
j=0;
for(i=0;inumber;i++)
{
int super=0;
SegmentX segmentx;
ReadFileBuffered(segmentsx->fd,&segmentx,sizeof(SegmentX));
while(jnumber)
{
if(j!=lastj)
{
ReadFileBuffered(supersegmentsx->fd,&supersegmentx,sizeof(SegmentX));
lastj=j;
}
if(segmentx.node1 ==supersegmentx.node1 &&
segmentx.node2 ==supersegmentx.node2 &&
segmentx.distance==supersegmentx.distance)
{
merged++;
j++;
/* mark as super-segment and normal segment */
super=1;
break;
}
else if((segmentx.node1==supersegmentx.node1 &&
segmentx.node2==supersegmentx.node2) ||
(segmentx.node1==supersegmentx.node1 &&
segmentx.node2>supersegmentx.node2) ||
(segmentx.node1>supersegmentx.node1))
{
/* mark as super-segment */
AppendSegmentList(mergedsegmentsx,supersegmentx.way,supersegmentx.node1,supersegmentx.node2,supersegmentx.distance|SEGMENT_SUPER);
added++;
j++;
}
else
{
/* mark as normal segment */
break;
}
}
if(super)
AppendSegmentList(mergedsegmentsx,segmentx.way,segmentx.node1,segmentx.node2,segmentx.distance|SEGMENT_SUPER|SEGMENT_NORMAL);
else
AppendSegmentList(mergedsegmentsx,segmentx.way,segmentx.node1,segmentx.node2,segmentx.distance|SEGMENT_NORMAL);
if(!((i+1)%10000))
printf_middle("Merging Segments: Segments=%"Pindex_t" Super=%"Pindex_t" Merged=%"Pindex_t" Added=%"Pindex_t,i+1,j,merged,added);
}
if(jnumber)
{
if(j==lastj)
{
AppendSegmentList(mergedsegmentsx,supersegmentx.way,supersegmentx.node1,supersegmentx.node2,supersegmentx.distance|SEGMENT_SUPER);
j++;
}
while(jnumber)
{
ReadFileBuffered(supersegmentsx->fd,&supersegmentx,sizeof(SegmentX));
AppendSegmentList(mergedsegmentsx,supersegmentx.way,supersegmentx.node1,supersegmentx.node2,supersegmentx.distance|SEGMENT_SUPER);
added++;
j++;
}
}
FinishSegmentList(mergedsegmentsx);
/* Close the files */
segmentsx->fd=CloseFileBuffered(segmentsx->fd);
if(supersegmentsx->number>0)
supersegmentsx->fd=CloseFileBuffered(supersegmentsx->fd);
/* Print the final message */
printf_last("Merged Segments: Segments=%"Pindex_t" Super=%"Pindex_t" Merged=%"Pindex_t" Added=%"Pindex_t,segmentsx->number,supersegmentsx->number,merged,added);
return(mergedsegmentsx);
}
/*++++++++++++++++++++++++++++++++++++++
Find all routes from a specified super-node to any other super-node that follows a certain type of way.
Results *FindSuperRoutes Returns a set of results.
NodesX *nodesx The set of nodes to use.
SegmentsX *segmentsx The set of segments to use.
WaysX *waysx The set of ways to use.
node_t start The start node.
Way *match A template for the type of way that the route must follow.
++++++++++++++++++++++++++++++++++++++*/
static Results *FindSuperRoutes(NodesX *nodesx,SegmentsX *segmentsx,WaysX *waysx,node_t start,Way *match)
{
static Results *results=NULL; /* static allocation of return value (reset each call) */
static Queue *queue=NULL; /* static allocation of internal value (reset each call) */
Result *result1,*result2;
WayX *wayx;
/* Insert the first node into the queue */
if(!results)
results=NewResultsList(8);
else
ResetResultsList(results);
if(!queue)
queue=NewQueueList(8);
else
ResetQueueList(queue);
result1=InsertResult(results,start,NO_SEGMENT);
InsertInQueue(queue,result1,0);
/* Loop across all nodes in the queue */
while((result1=PopFromQueue(queue)))
{
index_t node1;
SegmentX *segmentx;
node1=result1->node;
segmentx=FirstSegmentX(segmentsx,node1,2); /* position 1 is already used */
while(segmentx)
{
NodeX *node2x;
index_t node2,seg2;
distance_t cumulative_distance;
/* must not be one-way against the direction of travel */
if(IsOnewayTo(segmentx,node1))
goto endloop;
seg2=IndexSegmentX(segmentsx,segmentx);
/* must not be a u-turn */
if(result1->segment==seg2)
goto endloop;
wayx=LookupWayX(waysx,segmentx->way,2); /* position 1 is already used */
/* must be the right type of way */
if(WaysCompare(&wayx->way,match))
goto endloop;
node2=OtherNode(segmentx,node1);
node2x=LookupNodeX(nodesx,node2,2); /* position 1 is already used */
/* Don't route beyond a node with no access */
if(node2x->allow==Transports_None)
goto endloop;
cumulative_distance=(distance_t)result1->score+DISTANCE(segmentx->distance);
result2=FindResult(results,node2,seg2);
if(!result2) /* New end node */
{
result2=InsertResult(results,node2,seg2);
result2->prev=result1;
result2->score=cumulative_distance;
/* don't route beyond a super-node. */
if(!IsBitSet(nodesx->super,node2))
InsertInQueue(queue,result2,cumulative_distance);
}
else if(cumulative_distancescore)
{
result2->prev=result1;
result2->score=cumulative_distance;
/* don't route beyond a super-node. */
if(!IsBitSet(nodesx->super,node2))
InsertInQueue(queue,result2,cumulative_distance);
}
endloop:
segmentx=NextSegmentX(segmentsx,segmentx,node1);
}
}
return(results);
}
routino-3.4.1/src/sorting.c 644 233 144 67714 14450050342 11042 0 /***************************************
Merge sort functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2009-2015, 2017, 2019, 2023 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include
#if defined(USE_PTHREADS) && USE_PTHREADS
#include
#endif
#include "types.h"
#include "logging.h"
#include "files.h"
#include "sorting.h"
/* Global variables */
/*+ The command line '--tmpdir' option or its default value. +*/
extern char *option_tmpdirname;
/*+ The amount of RAM to use for filesorting. +*/
extern size_t option_filesort_ramsize;
/*+ The number of filesorting threads allowed. +*/
extern int option_filesort_threads;
/* Thread data type definitions */
/*+ A data type for holding data for a thread. +*/
typedef struct _thread_data
{
#if defined(USE_PTHREADS) && USE_PTHREADS
pthread_t thread; /*+ The thread identifier. +*/
int running; /*+ A flag indicating the current state of the thread. +*/
#endif
char *data; /*+ The main data array. +*/
void **datap; /*+ An array of pointers to the data objects. +*/
size_t n; /*+ The number of pointers. +*/
int fd; /*+ The file descriptor of the file to write the results to. +*/
size_t itemsize; /*+ The size of each item. +*/
int (*compare)(const void*,const void*); /*+ The comparison function. +*/
}
thread_data;
/* Thread variables */
#if defined(USE_PTHREADS) && USE_PTHREADS
static pthread_mutex_t running_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t running_cond = PTHREAD_COND_INITIALIZER;
#endif
/* Thread helper functions */
static void *filesort_fixed_heapsort_thread(thread_data *thread);
static void *filesort_vary_heapsort_thread(thread_data *thread);
/*++++++++++++++++++++++++++++++++++++++
A function to sort the contents of a file of fixed length objects using a
limited amount of RAM.
The data is sorted using a "Merge sort" http://en.wikipedia.org/wiki/Merge_sort
and in particular an "external sort" http://en.wikipedia.org/wiki/External_sorting.
The individual sort steps and the merge step both use a "Heap sort"
http://en.wikipedia.org/wiki/Heapsort. The combination of the two should work well
if the data is already partially sorted.
index_t filesort_fixed Returns the number of objects kept.
int fd_in The file descriptor of the input file (opened for reading and at the beginning).
int fd_out The file descriptor of the output file (opened for writing and empty).
size_t itemsize The size of each item in the file that needs sorting.
int (*pre_sort_function)(void *,index_t) If non-NULL then this function is called for
each item before they have been sorted. The second parameter is the number of objects
previously read from the input file. If the function returns 1 then the object is kept
and it is sorted, otherwise it is ignored.
int (*compare_function)(const void*, const void*) The comparison function. This is identical
to qsort if the data to be sorted is an array of things not pointers.
int (*post_sort_function)(void *,index_t) If non-NULL then this function is called for
each item after they have been sorted. The second parameter is the number of objects
already written to the output file. If the function returns 1 then the object is written
to the output file., otherwise it is ignored.
++++++++++++++++++++++++++++++++++++++*/
index_t filesort_fixed(int fd_in,int fd_out,size_t itemsize,int (*pre_sort_function)(void*,index_t),
int (*compare_function)(const void*,const void*),
int (*post_sort_function)(void*,index_t))
{
int *fds=NULL,*heap=NULL;
int nfiles=0,ndata=0;
index_t count_out=0,count_in=0,total=0;
size_t nitems,item;
char *data;
void **datap;
thread_data *threads;
int i,more=1;
char *filename=(char*)malloc_logassert(strlen(option_tmpdirname)+24);
#if defined(USE_PTHREADS) && USE_PTHREADS
int nthreads=0;
#endif
/* Allocate the RAM buffer and other bits */
nitems=(size_t)SizeFileFD(fd_in)/itemsize;
if(nitems==0)
return(0);
if((nitems*(itemsize+sizeof(void*)))<(option_filesort_ramsize/option_filesort_threads))
/* use one thread */
nitems=nitems+1;
else if((nitems*(itemsize+sizeof(void*)))1)
{
/* If all threads are in use wait for an existing thread to finish */
if(nthreads==option_filesort_threads)
{
pthread_mutex_lock(&running_mutex);
while(nthreads==option_filesort_threads)
{
for(i=0;i1 && nthreads)
{
pthread_mutex_lock(&running_mutex);
pthread_cond_wait(&running_cond,&running_mutex);
for(i=0;i1)
{
int newindex;
int temp;
newindex=index/2;
if(compare_function(datap[heap[index]],datap[heap[newindex]])>=0)
break;
temp=heap[index];
heap[index]=heap[newindex];
heap[newindex]=temp;
index=newindex;
}
}
/* Repeatedly pull out the root of the heap and refill from the same file */
ndata=nfiles;
do
{
int index=1;
if(!post_sort_function || post_sort_function(datap[heap[index]],count_out))
{
WriteFileBuffered(fd_out,datap[heap[index]],itemsize);
count_out++;
}
if(ReadFileBuffered(fds[heap[index]],datap[heap[index]],itemsize))
{
heap[index]=heap[ndata];
ndata--;
}
/* Bubble down the new value */
while((2*index)=0)
newindex=newindex+1;
if(compare_function(datap[heap[index]],datap[heap[newindex]])<=0)
break;
temp=heap[newindex];
heap[newindex]=heap[index];
heap[index]=temp;
index=newindex;
}
if((2*index)==ndata)
{
int newindex;
int temp;
newindex=2*index;
if(compare_function(datap[heap[index]],datap[heap[newindex]])<=0)
; /* break */
else
{
temp=heap[newindex];
heap[newindex]=heap[index];
heap[index]=temp;
}
}
}
while(ndata>0);
/* Tidy up */
tidy_and_exit:
if(fds)
{
for(i=0;i1)
{
/* If all threads are in use wait for an existing thread to finish */
if(nthreads==option_filesort_threads)
{
pthread_mutex_lock(&running_mutex);
while(nthreads==option_filesort_threads)
{
for(i=0;ilargestitemsize)
largestitemsize=itemsize;
ramused+=itemsize;
ramused =FILESORT_VARALIGN*((ramused+FILESORT_VARALIGN-1)/FILESORT_VARALIGN);
ramused+=FILESORT_VARALIGN-FILESORT_VARSIZE;
total++;
threads[thread].n++;
}
else
ramused-=FILESORT_VARSIZE;
count_in++;
if(ReadFileBuffered(fd_in,&nextitemsize,FILESORT_VARSIZE))
{
more=0;
break;
}
}
/* No new data read in this time round */
if(threads[thread].n==0)
break;
/* Shortcut if only one file, don't write to disk */
if(more==0 && nfiles==0)
filesort_heapsort(threads[thread].datap,threads[thread].n,threads[thread].compare);
else
{
/* Create the file descriptor (not thread-safe) */
sprintf(filename,"%s/filesort.%d.tmp",option_tmpdirname,nfiles);
threads[thread].fd=OpenFileBufferedNew(filename);
if(option_filesort_threads==1)
{
filesort_vary_heapsort_thread(&threads[thread]);
CloseFileBuffered(threads[thread].fd);
}
#if defined(USE_PTHREADS) && USE_PTHREADS
else
{
pthread_mutex_lock(&running_mutex);
threads[thread].running=1;
pthread_mutex_unlock(&running_mutex);
pthread_create(&threads[thread].thread,NULL,(void* (*)(void*))filesort_vary_heapsort_thread,&threads[thread]);
nthreads++;
}
#endif
}
nfiles++;
}
while(more);
/* Wait for all of the threads to finish */
#if defined(USE_PTHREADS) && USE_PTHREADS
while(option_filesort_threads>1 && nthreads)
{
pthread_mutex_lock(&running_mutex);
pthread_cond_wait(&running_cond,&running_mutex);
for(i=0;i1)
{
int newindex;
int temp;
newindex=index/2;
if(compare_function(datap[heap[index]],datap[heap[newindex]])>=0)
break;
temp=heap[index];
heap[index]=heap[newindex];
heap[newindex]=temp;
index=newindex;
}
}
/* Repeatedly pull out the root of the heap and refill from the same file */
ndata=nfiles;
do
{
int index=1;
FILESORT_VARINT itemsize;
if(!post_sort_function || post_sort_function(datap[heap[index]],count_out))
{
itemsize=*(FILESORT_VARINT*)((char*)datap[heap[index]]-FILESORT_VARSIZE);
WriteFileBuffered(fd_out,(char*)datap[heap[index]]-FILESORT_VARSIZE,itemsize+FILESORT_VARSIZE);
count_out++;
}
if(ReadFileBuffered(fds[heap[index]],&itemsize,FILESORT_VARSIZE))
{
heap[index]=heap[ndata];
ndata--;
}
else
{
*(FILESORT_VARINT*)((char*)datap[heap[index]]-FILESORT_VARSIZE)=itemsize;
ReadFileBuffered(fds[heap[index]],datap[heap[index]],itemsize);
}
/* Bubble down the new value */
while((2*index)=0)
newindex=newindex+1;
if(compare_function(datap[heap[index]],datap[heap[newindex]])<=0)
break;
temp=heap[newindex];
heap[newindex]=heap[index];
heap[index]=temp;
index=newindex;
}
if((2*index)==ndata)
{
int newindex;
int temp;
newindex=2*index;
if(compare_function(datap[heap[index]],datap[heap[newindex]])<=0)
; /* break */
else
{
temp=heap[newindex];
heap[newindex]=heap[index];
heap[index]=temp;
}
}
}
while(ndata>0);
/* Tidy up */
tidy_and_exit:
if(fds)
{
for(i=0;idatap,thread->n,thread->compare);
/* Write the result to the given temporary file */
if(thread->fd > 0)
for(item=0;itemn;item++)
WriteFileBuffered(thread->fd,thread->datap[item],thread->itemsize);
#if defined(USE_PTHREADS) && USE_PTHREADS
if(option_filesort_threads>1)
{
pthread_mutex_lock(&running_mutex);
thread->running=2;
pthread_cond_signal(&running_cond);
pthread_mutex_unlock(&running_mutex);
}
#endif
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
A wrapper function that can be run in a thread for variable data.
void *filesort_vary_heapsort_thread Returns NULL (required to return void*).
thread_data *thread The data to be processed in this thread.
++++++++++++++++++++++++++++++++++++++*/
static void *filesort_vary_heapsort_thread(thread_data *thread)
{
size_t item;
/* Sort the data pointers using a heap sort */
filesort_heapsort(thread->datap,thread->n,thread->compare);
/* Write the result to the given temporary file */
if(thread->fd > 0)
for(item=0;itemn;item++)
{
FILESORT_VARINT itemsize=*(FILESORT_VARINT*)((char*)thread->datap[item]-FILESORT_VARSIZE);
WriteFileBuffered(thread->fd,(char*)thread->datap[item]-FILESORT_VARSIZE,itemsize+FILESORT_VARSIZE);
}
#if defined(USE_PTHREADS) && USE_PTHREADS
if(option_filesort_threads>1)
{
pthread_mutex_lock(&running_mutex);
thread->running=2;
pthread_cond_signal(&running_cond);
pthread_mutex_unlock(&running_mutex);
}
#endif
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
A function to sort an array of pointers efficiently.
The data is sorted using a "Heap sort" http://en.wikipedia.org/wiki/Heapsort,
in particular, this is good because it can operate in-place and doesn't
allocate more memory like using qsort() does.
void **datap A pointer to the array of pointers to sort.
size_t nitems The number of items of data to sort.
int (*compare_function)(const void*, const void*) The comparison function. This is identical
to qsort if the data to be sorted is an array of things not pointers.
++++++++++++++++++++++++++++++++++++++*/
void filesort_heapsort(void **datap,size_t nitems,int(*compare_function)(const void*, const void*))
{
void **datap1=&datap[-1];
size_t item;
/* Fill the heap by pretending to insert the data that is already there */
for(item=2;item<=nitems;item++)
{
size_t index=item;
/* Bubble up the new value (upside-down, put largest at top) */
while(index>1)
{
int newindex;
void *temp;
newindex=index/2;
if(compare_function(datap1[index],datap1[newindex])<=0) /* reversed comparison to filesort_fixed() above */
break;
temp=datap1[index];
datap1[index]=datap1[newindex];
datap1[newindex]=temp;
index=newindex;
}
}
/* Repeatedly pull out the root of the heap and swap with the bottom item */
for(item=nitems;item>1;item--)
{
size_t index=1;
void *temp;
temp=datap1[index];
datap1[index]=datap1[item];
datap1[item]=temp;
/* Bubble down the new value (upside-down, put largest at top) */
while((2*index)<(item-1))
{
int newindex;
void **temp;
newindex=2*index;
if(compare_function(datap1[newindex],datap1[newindex+1])<=0) /* reversed comparison to filesort_fixed() above */
newindex=newindex+1;
if(compare_function(datap1[index],datap1[newindex])>=0) /* reversed comparison to filesort_fixed() above */
break;
temp=datap1[newindex];
datap1[newindex]=datap1[index];
datap1[index]=temp;
index=newindex;
}
if((2*index)==(item-1))
{
int newindex;
void *temp;
newindex=2*index;
if(compare_function(datap1[index],datap1[newindex])>=0) /* reversed comparison to filesort_fixed() above */
; /* break */
else
{
temp=datap1[newindex];
datap1[newindex]=datap1[index];
datap1[index]=temp;
}
}
}
}
routino-3.4.1/src/waysx.h 644 233 144 12733 13547422350 10534 0 /***************************************
A header file for the extended Ways structure.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015, 2019 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef WAYSX_H
#define WAYSX_H /*+ To stop multiple inclusions. +*/
#include
#include "types.h"
#include "ways.h"
#include "typesx.h"
#include "cache.h"
#include "files.h"
/* Data structures */
/*+ An extended structure containing a single way. +*/
struct _WayX
{
way_t id; /*+ The way identifier; initially the OSM value, later the Way index. +*/
Way way; /*+ The real way data. +*/
};
/*+ A structure containing a set of ways (memory format). +*/
struct _WaysX
{
char *filename; /*+ The name of the intermediate file (for the WaysX). +*/
char *filename_tmp; /*+ The name of the temporary file (for the WaysX). +*/
int fd; /*+ The file descriptor of the open file (for the WaysX). +*/
index_t number; /*+ The number of extended ways still being considered. +*/
index_t knumber; /*+ The number of extended ways kept for next time. +*/
transports_t transports; /*+ The types of traffic that were seen when parsing. +*/
#if !SLIM
WayX *data; /*+ The extended ways data (when mapped into memory). +*/
#else
WayX cached[3]; /*+ Three cached extended ways read from the file in slim mode. +*/
index_t incache[3]; /*+ The indexes of the cached extended ways. +*/
WayXCache *cache; /*+ A RAM cache of extended ways read from the file. +*/
#endif
char *ifilename_tmp; /*+ The name of the temporary file (for the ID index). +*/
int ifd; /*+ The file descriptor of the temporary file (for the ID index). +*/
way_t *idata; /*+ The extended way IDs (sorted by ID). +*/
char *ofilename_tmp; /*+ The name of the temporary file (for the ID offset index). +*/
int ofd; /*+ The file descriptor of the temporary file (for the ID offset index). +*/
offset_t *odata; /*+ The offset of the way in the file (used for error log). +*/
index_t *cdata; /*+ The compacted way IDs (same order as sorted ways). +*/
char *nfilename_tmp; /*+ The name of the temporary file (for the WaysX names). +*/
int nfd; /*+ The file descriptor of the temporary file (for the WaysX names). +*/
uint32_t nlength; /*+ The length of the string of name entries. +*/
};
/* Functions in waysx.c */
WaysX *NewWayList(int append,int readonly);
void FreeWayList(WaysX *waysx,int keep);
void AppendWayList(WaysX *waysx,way_t id,Way *way,node_t *nodes,int nnodes,const char *name);
void FinishWayList(WaysX *waysx);
index_t IndexWayX(WaysX *waysx,way_t id);
void SortWayList(WaysX *waysx);
SegmentsX *SplitWays(WaysX *waysx,NodesX *nodesx,int keep);
void SortWayNames(WaysX *waysx);
void CompactWayList(WaysX *waysx,SegmentsX *segmentsx);
void SaveWayList(WaysX *waysx,const char *filename);
/* Macros / inline functions */
#if !SLIM
#define LookupWayX(waysx,index,position) &(waysx)->data[index]
#define PutBackWayX(waysx,wayx) while(0) { /* nop */ }
#else
/* Prototypes */
static inline WayX *LookupWayX(WaysX *waysx,index_t index,int position);
static inline void PutBackWayX(WaysX *waysx,WayX *wayx);
CACHE_NEWCACHE_PROTO(WayX)
CACHE_DELETECACHE_PROTO(WayX)
CACHE_FETCHCACHE_PROTO(WayX)
CACHE_REPLACECACHE_PROTO(WayX)
CACHE_INVALIDATECACHE_PROTO(WayX)
/* Data type */
CACHE_STRUCTURE(WayX)
/* Inline functions */
CACHE_NEWCACHE(WayX)
CACHE_DELETECACHE(WayX)
CACHE_FETCHCACHE(WayX)
CACHE_REPLACECACHE(WayX)
CACHE_INVALIDATECACHE(WayX)
/*++++++++++++++++++++++++++++++++++++++
Lookup a particular extended way with the specified id from the file on disk.
WayX *LookupWayX Returns a pointer to a cached copy of the extended way.
WaysX *waysx The set of ways to use.
index_t index The way index to look for.
int position The position in the cache to use.
++++++++++++++++++++++++++++++++++++++*/
static inline WayX *LookupWayX(WaysX *waysx,index_t index,int position)
{
waysx->cached[position-1]=*FetchCachedWayX(waysx->cache,index,waysx->fd,0);
waysx->incache[position-1]=index;
return(&waysx->cached[position-1]);
}
/*++++++++++++++++++++++++++++++++++++++
Put back an extended way's data into the file on disk.
WaysX *waysx The set of ways to use.
WayX *wayx The extended way to be put back.
++++++++++++++++++++++++++++++++++++++*/
static inline void PutBackWayX(WaysX *waysx,WayX *wayx)
{
int position1=wayx-&waysx->cached[0];
ReplaceCachedWayX(waysx->cache,wayx,waysx->incache[position1],waysx->fd,0);
}
#endif /* SLIM */
#endif /* WAYSX_H */
routino-3.4.1/src/mman-win32.h 644 233 144 5064 12531126220 11215 0 /***************************************
Windows 32 memory management functions from https://code.google.com/p/mman-win32
File header comment created by Andrew M. Bishop, all source code unchanged from original.
******************/ /******************
Copyright (c) 2010,2012 Viktor Kutuzov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
***************************************/
#ifndef _SYS_MMAN_H_
#define _SYS_MMAN_H_
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
/* All the headers include this file. */
#ifndef _MSC_VER
#include <_mingw.h>
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
#define PROT_NONE 0
#define PROT_READ 1
#define PROT_WRITE 2
#define PROT_EXEC 4
#define MAP_FILE 0
#define MAP_SHARED 1
#define MAP_PRIVATE 2
#define MAP_TYPE 0xf
#define MAP_FIXED 0x10
#define MAP_ANONYMOUS 0x20
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FAILED ((void *)-1)
/* Flags for msync. */
#define MS_ASYNC 1
#define MS_SYNC 2
#define MS_INVALIDATE 4
void* mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
int munmap(void *addr, size_t len);
int mprotect(void *addr, size_t len, int prot);
int msync(void *addr, size_t len, int flags);
int mlock(const void *addr, size_t len);
int munlock(const void *addr, size_t len);
#ifdef __cplusplus
};
#endif
#endif /* _SYS_MMAN_H_ */
routino-3.4.1/src/segments.c 644 233 144 24107 13455663676 11217 0 /***************************************
Segment data type functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015, 2019 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include "types.h"
#include "nodes.h"
#include "segments.h"
#include "ways.h"
#include "fakes.h"
#include "files.h"
#include "profiles.h"
/*++++++++++++++++++++++++++++++++++++++
Load in a segment list from a file.
Segments *LoadSegmentList Returns the segment list that has just been loaded.
const char *filename The name of the file to load.
++++++++++++++++++++++++++++++++++++++*/
Segments *LoadSegmentList(const char *filename)
{
Segments *segments;
segments=(Segments*)malloc(sizeof(Segments));
#if !SLIM
segments->data=MapFile(filename);
/* Copy the SegmentsFile structure from the loaded data */
segments->file=*((SegmentsFile*)segments->data);
/* Set the pointers in the Segments structure. */
segments->segments=(Segment*)(segments->data+sizeof(SegmentsFile));
#else
segments->fd=SlimMapFile(filename);
/* Copy the SegmentsFile header structure from the loaded data */
SlimFetch(segments->fd,&segments->file,sizeof(SegmentsFile),0);
segments->cache=NewSegmentCache();
#ifndef LIBROUTINO
log_malloc(segments->cache,sizeof(*segments->cache));
#endif
#endif
return(segments);
}
/*++++++++++++++++++++++++++++++++++++++
Destroy the segment list.
Segments *segments The segment list to destroy.
++++++++++++++++++++++++++++++++++++++*/
void DestroySegmentList(Segments *segments)
{
#if !SLIM
segments->data=UnmapFile(segments->data);
#else
segments->fd=SlimUnmapFile(segments->fd);
#ifndef LIBROUTINO
log_free(segments->cache);
#endif
DeleteSegmentCache(segments->cache);
#endif
free(segments);
}
/*++++++++++++++++++++++++++++++++++++++
Find the closest segment from a specified node heading in a particular direction and optionally profile.
index_t FindClosestSegmentHeading Returns the closest heading segment index.
Nodes *nodes The set of nodes to use.
Segments *segments The set of segments to use.
Ways *ways The set of ways to use.
index_t node1 The node to start from.
double heading The desired heading from the node.
Profile *profile The profile of the mode of transport (or NULL).
++++++++++++++++++++++++++++++++++++++*/
index_t FindClosestSegmentHeading(Nodes *nodes,Segments *segments,Ways *ways,index_t node1,double heading,Profile *profile)
{
Segment *segmentp;
index_t best_seg=NO_SEGMENT;
double best_difference=360;
if(IsFakeNode(node1))
segmentp=FirstFakeSegment(node1);
else
{
Node *nodep=LookupNode(nodes,node1,3);
segmentp=FirstSegment(segments,nodep,1);
}
while(segmentp)
{
Way *wayp;
index_t node2,seg2;
double bearing,difference;
node2=OtherNode(segmentp,node1); /* need this here because we use node2 at the end of the loop */
if(!IsNormalSegment(segmentp))
goto endloop;
if(IsFakeNode(node1) || IsFakeNode(node2))
seg2=IndexFakeSegment(segmentp);
else
seg2=IndexSegment(segments,segmentp);
wayp=LookupWay(ways,segmentp->way,1);
if(!(wayp->allow&profile->transports))
goto endloop;
if(profile->oneway && IsOnewayFrom(segmentp,node1))
{
if(profile->transports!=Transports_Bicycle)
goto endloop;
if(!(wayp->type&Highway_CycleBothWays))
goto endloop;
}
bearing=BearingAngle(nodes,segmentp,node1);
difference=(heading-bearing);
if(difference<-180) difference+=360;
if(difference> 180) difference-=360;
if(difference<0) difference=-difference;
if(differencespeed;
speed_t speed2=profile->speed[HIGHWAY(wayp->type)];
distance_t distance=DISTANCE(segmentp->distance);
if(speed1==0)
{
if(speed2==0)
return(hours_to_duration(10));
else
return distance_speed_to_duration(distance,speed2);
}
else /* if(speed1!=0) */
{
if(speed2==0)
return distance_speed_to_duration(distance,speed1);
else if(speed1<=speed2)
return distance_speed_to_duration(distance,speed1);
else
return distance_speed_to_duration(distance,speed2);
}
}
/*++++++++++++++++++++++++++++++++++++++
Calculate the angle to turn at a junction from segment1 to segment2 at node.
double TurnAngle Returns a value in the range -180 to +180 indicating the angle to turn.
Nodes *nodes The set of nodes to use.
Segment *segment1p The current segment.
Segment *segment2p The next segment.
index_t node The node at which they join.
Straight ahead is zero, turning to the right is positive (e.g. +90 degrees) and turning to the left is negative (e.g. -90 degrees).
Angles are calculated using flat Cartesian lat/long grid approximation (after scaling longitude due to latitude).
++++++++++++++++++++++++++++++++++++++*/
double TurnAngle(Nodes *nodes,Segment *segment1p,Segment *segment2p,index_t node)
{
double lat1,latm,lat2;
double lon1,lonm,lon2;
double angle1,angle2,angle;
index_t node1,node2;
node1=OtherNode(segment1p,node);
node2=OtherNode(segment2p,node);
if(IsFakeNode(node1))
GetFakeLatLong(node1,&lat1,&lon1);
else
GetLatLong(nodes,node1,NULL,&lat1,&lon1);
if(IsFakeNode(node))
GetFakeLatLong(node,&latm,&lonm);
else
GetLatLong(nodes,node,NULL,&latm,&lonm);
if(IsFakeNode(node2))
GetFakeLatLong(node2,&lat2,&lon2);
else
GetLatLong(nodes,node2,NULL,&lat2,&lon2);
angle1=atan2((lonm-lon1)*cos(latm),(latm-lat1));
angle2=atan2((lon2-lonm)*cos(latm),(lat2-latm));
angle=angle2-angle1;
angle=radians_to_degrees(angle);
if(angle<-180) angle+=360;
if(angle> 180) angle-=360;
return(angle);
}
/*++++++++++++++++++++++++++++++++++++++
Calculate the bearing of a segment when heading to the given node.
double BearingAngle Returns a value in the range 0 to 359 indicating the bearing.
Nodes *nodes The set of nodes to use.
Segment *segmentp The segment.
index_t node The node to finish.
Angles are calculated using flat Cartesian lat/long grid approximation (after scaling longitude due to latitude).
++++++++++++++++++++++++++++++++++++++*/
double BearingAngle(Nodes *nodes,Segment *segmentp,index_t node)
{
double lat1,lat2;
double lon1,lon2;
double angle;
index_t node1,node2;
node1=node;
node2=OtherNode(segmentp,node);
if(IsFakeNode(node1))
GetFakeLatLong(node1,&lat1,&lon1);
else
GetLatLong(nodes,node1,NULL,&lat1,&lon1);
if(IsFakeNode(node2))
GetFakeLatLong(node2,&lat2,&lon2);
else
GetLatLong(nodes,node2,NULL,&lat2,&lon2);
angle=atan2((lat2-lat1),(lon2-lon1)*cos(lat1));
angle=radians_to_degrees(angle);
angle=270-angle;
if(angle< 0) angle+=360;
if(angle>360) angle-=360;
return(angle);
}
routino-3.4.1/src/results.h 644 233 144 10356 13066777144 11073 0 /***************************************
A header file for the results.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015, 2017 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef RESULTS_H
#define RESULTS_H /*+ To stop multiple inclusions. +*/
#include
#include "types.h"
/* Constants */
/* A fake result pointer. */
#define NO_RESULT ((Result*)~0)
/*+ A result is not currently queued. +*/
#define NOT_QUEUED ((uint32_t)0)
/* Data structures */
typedef struct _Result Result;
/*+ The result for a node. +*/
struct _Result
{
index_t node; /*+ The node for which this result applies. +*/
index_t segment; /*+ The segmemt used to get to the node for which this result applies. +*/
Result *prev; /*+ The previous result following the best path to get to this node via the segment. +*/
Result *next; /*+ The next result following the best path from this node that was reached via the segment. +*/
score_t score; /*+ The best actual weighted distance or duration score from the start to the node. +*/
score_t sortby; /*+ The best possible weighted distance or duration score from the start to the finish. +*/
uint32_t queued; /*+ The position of this result in the queue. +*/
};
/*+ A list of results. +*/
typedef struct _Results
{
uint32_t nbins; /*+ The number of bins in the hash table. +*/
uint32_t mask; /*+ A bit mask to select the bottom log2(nbins) bits. +*/
uint32_t number; /*+ The total number of occupied results. +*/
Result **point; /*+ An array of nbins pointers to results in the data array. +*/
uint32_t ndata1; /*+ The size of the first dimension of the 'data' array. +*/
uint32_t ndata2; /*+ The size of the second dimension of the 'data' array. +*/
uint32_t nallocdata1; /*+ The amount of allocated space in the first dimension of the 'data' array. +*/
Result **data; /*+ An array of arrays containing the actual results, the first
dimension is reallocated but the second dimension is not.
Most importantly pointers into the real data don't change
as more space is allocated (since realloc is not being used). +*/
index_t start_node; /*+ The start node. +*/
index_t prev_segment; /*+ The previous segment to get to the start node (if any). +*/
index_t finish_node; /*+ The finish node. +*/
index_t last_segment; /*+ The last segment (to arrive at the finish node). +*/
waypoint_t start_waypoint; /*+ The number of the starting waypoint. +*/
waypoint_t finish_waypoint; /*+ The number of the finish waypoint. +*/
}
Results;
/* Forward definition for opaque type */
typedef struct _Queue Queue;
/* Results functions in results.c */
Results *NewResultsList(uint8_t log2bins);
void ResetResultsList(Results *results);
void FreeResultsList(Results *results);
Result *InsertResult(Results *results,index_t node,index_t segment);
Result *FindResult(Results *results,index_t node,index_t segment);
Result *FirstResult(Results *results);
Result *NextResult(Results *results,Result *result);
/* Queue functions in queue.c */
Queue *NewQueueList(uint8_t log2bins);
void ResetQueueList(Queue *queue);
void FreeQueueList(Queue *queue);
void InsertInQueue(Queue *queue,Result *result,score_t score);
Result *PopFromQueue(Queue *queue);
#endif /* RESULTS_H */
routino-3.4.1/src/errorlogx.h 644 233 144 4555 13454331526 11370 0 /***************************************
Header file for error log file data types and processing function prototypes.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2013 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef ERRORLOGX_H
#define ERRORLOGX_H /*+ To stop multiple inclusions. +*/
#include
#include "types.h"
#include "typesx.h"
/*+ A structure containing information for an error message during processing. +*/
typedef struct _ErrorLogX
{
latlong_t latitude; /*+ The error message latitude. +*/
latlong_t longitude; /*+ The error message longitude. +*/
uint32_t offset; /*+ The offset of the error message from the beginning of the text file. +*/
uint32_t length; /*+ The length of the error message in the text file. +*/
}
ErrorLogX;
/*+ A structure containing a set of error logs (memory format). +*/
typedef struct _ErrorLogsX
{
index_t number; /*+ The number of error logs. +*/
index_t latbins; /*+ The number of bins containing latitude. +*/
index_t lonbins; /*+ The number of bins containing longitude. +*/
ll_bin_t latzero; /*+ The bin number of the furthest south bin. +*/
ll_bin_t lonzero; /*+ The bin number of the furthest west bin. +*/
}
ErrorLogsX;
/* Error log processing functions in errorlogx.c */
ErrorLogsX *NewErrorLogList(void);
void FreeErrorLogList(ErrorLogsX *errorlogsx);
void ProcessErrorLogs(ErrorLogsX *errorlogsx,NodesX *nodesx,WaysX *waysx,RelationsX *relationsx);
void SortErrorLogsGeographically(ErrorLogsX *errorlogsx);
void SaveErrorLogs(ErrorLogsX *errorlogsx,char *filename);
#endif /* ERRORLOGX_H */
routino-3.4.1/src/results.c 644 233 144 16770 13517016361 11060 0 /***************************************
Result data type functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015, 2017 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include "results.h"
#include "logging.h"
#define HASH_NODE_SEGMENT(node,segment) ((node)^(segment<<4))
/*++++++++++++++++++++++++++++++++++++++
Allocate a new results list.
Results *NewResultsList Returns the results list.
uint8_t log2bins The base 2 logarithm of the initial number of bins in the results array.
++++++++++++++++++++++++++++++++++++++*/
Results *NewResultsList(uint8_t log2bins)
{
Results *results;
results=(Results*)malloc(sizeof(Results));
results->nbins=1<mask=results->nbins-1;
results->number=0;
results->point=(Result**)calloc(results->nbins,sizeof(Result*));
#ifndef LIBROUTINO
log_malloc(results->point,results->nbins*sizeof(Result*));
#endif
results->ndata1=0;
results->nallocdata1=0;
results->ndata2=results->nbins>>2;
results->data=NULL;
results->start_node=NO_NODE;
results->prev_segment=NO_SEGMENT;
results->finish_node=NO_NODE;
results->last_segment=NO_SEGMENT;
results->start_waypoint=NO_WAYPOINT;
results->finish_waypoint=NO_WAYPOINT;
return(results);
}
/*++++++++++++++++++++++++++++++++++++++
Allocate a new results list.
Results *results The results list to be reset.
++++++++++++++++++++++++++++++++++++++*/
void ResetResultsList(Results *results)
{
uint32_t i;
results->number=0;
results->ndata1=0;
for(i=0;inbins;i++)
results->point[i]=NULL;
results->start_node=NO_NODE;
results->prev_segment=NO_SEGMENT;
results->finish_node=NO_NODE;
results->last_segment=NO_SEGMENT;
}
/*++++++++++++++++++++++++++++++++++++++
Free a results list.
Results *results The results list to be destroyed.
++++++++++++++++++++++++++++++++++++++*/
void FreeResultsList(Results *results)
{
uint32_t i;
for(i=0;inallocdata1;i++)
{
#ifndef LIBROUTINO
log_free(results->data[i]);
#endif
free(results->data[i]);
}
free(results->data);
#ifndef LIBROUTINO
log_free(results->point);
#endif
free(results->point);
free(results);
}
/*++++++++++++++++++++++++++++++++++++++
Insert a single entry into the hashed list.
The data is stored in a hash table with "Linear Probing" https://en.wikipedia.org/wiki/Linear_probing
for handling collisions and this operation is adding an item to the hash table.
Results *results The results structure to insert into.
Result *result The result to insert.
index_t node The node that is to be inserted into the results.
index_t segment The segment that is to be inserted into the results.
++++++++++++++++++++++++++++++++++++++*/
static inline void insert_result(Results *results,Result *result,index_t node,index_t segment)
{
uint32_t bin=HASH_NODE_SEGMENT(node,segment)&results->mask;
while(1)
{
Result *r=results->point[bin];
if(!r)
break;
bin=(bin+1)%results->nbins;
}
results->point[bin]=result;
}
/*++++++++++++++++++++++++++++++++++++++
Insert a new result into the results data structure in the right order.
Result *InsertResult Returns the result that has been inserted.
Results *results The results structure to insert into.
index_t node The node that is to be inserted into the results.
index_t segment The segment that is to be inserted into the results.
++++++++++++++++++++++++++++++++++++++*/
Result *InsertResult(Results *results,index_t node,index_t segment)
{
Result *result;
/* Check if we have hit the limit on the number of entries */
if(results->number==(results->nbins/2))
{
uint32_t n;
#ifndef LIBROUTINO
log_free(results->point);
#endif
free(results->point);
results->nbins<<=1;
results->mask=results->nbins-1;
results->point=(Result**)calloc(results->nbins,sizeof(Result*));
#ifndef LIBROUTINO
log_malloc(results->point,results->nbins*sizeof(Result*));
#endif
for(n=0;nnumber;n++)
{
uint32_t i=n/results->ndata2;
uint32_t j=n%results->ndata2;
result=&results->data[i][j];
insert_result(results,result,result->node,result->segment);
}
}
/* Check if we need more data space allocated */
if((results->number%results->ndata2)==0)
{
results->ndata1++;
if(results->ndata1>=results->nallocdata1)
{
results->nallocdata1++;
results->data=(Result**)realloc((void*)results->data,results->nallocdata1*sizeof(Result*));
results->data[results->nallocdata1-1]=(Result*)malloc(results->ndata2*sizeof(Result));
#ifndef LIBROUTINO
log_malloc(results->data[results->nallocdata1-1],results->ndata2*sizeof(Result));
#endif
}
}
/* Insert the new entry */
result=&results->data[results->ndata1-1][results->number%results->ndata2];
insert_result(results,result,node,segment);
results->number++;
/* Initialise the result */
result->node=node;
result->segment=segment;
result->prev=NULL;
result->next=NULL;
result->score=0;
result->sortby=0;
result->queued=NOT_QUEUED;
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Find a result; search by node and segment.
The data is stored in a hash table with "Linear Probing" https://en.wikipedia.org/wiki/Linear_probing
for handling collisions and this operation is finding an item in the hash table.
Result *FindResult Returns the result that has been found.
Results *results The results structure to search.
index_t node The node that is to be found.
index_t segment The segment that was used to reach this node.
++++++++++++++++++++++++++++++++++++++*/
Result *FindResult(Results *results,index_t node,index_t segment)
{
uint32_t bin=HASH_NODE_SEGMENT(node,segment)&results->mask;
while(1)
{
Result *r=results->point[bin];
if(!r)
break;
if(r->segment==segment && r->node==node)
return(r);
bin=(bin+1)%results->nbins;
}
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
Find the first result from a set of results.
Result *FirstResult Returns the first result.
Results *results The set of results.
++++++++++++++++++++++++++++++++++++++*/
Result *FirstResult(Results *results)
{
return(&results->data[0][0]);
}
/*++++++++++++++++++++++++++++++++++++++
Find the next result from a set of results.
Result *NextResult Returns the next result.
Results *results The set of results.
Result *result The previous result.
++++++++++++++++++++++++++++++++++++++*/
Result *NextResult(Results *results,Result *result)
{
uint32_t i;
size_t j=0;
for(i=0;indata1;i++)
if(result>=results->data[i])
{
j=result-results->data[i];
if(jndata2)
break;
}
if(++j>=results->ndata2)
{i++;j=0;}
if((i*results->ndata2+j)>=results->number)
return(NULL);
return(&results->data[i][j]);
}
routino-3.4.1/src/tagging.c 644 233 144 66152 14375733225 11006 0 /***************************************
Load the tagging rules from a file and the functions for handling them.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2010-2015 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include
#include
#include
#include "files.h"
#include "tagging.h"
#include "xmlparse.h"
#include "logging.h"
/* Constants */
#define TAGACTION_IF 1
#define TAGACTION_IFNOT 2
#define TAGACTION_INHERIT 3 /* Not a real action, just a marker */
#define TAGACTION_SET 4
#define TAGACTION_UNSET 5
#define TAGACTION_OUTPUT 6
#define TAGACTION_LOGERROR 7
static const char* const default_logerror_message="ignoring it";
/* Local variable (intialised before each use) */
static int64_t current_id;
/* Local parsing variables (re-initialised by DeleteXMLTaggingRules() function) */
static TaggingRuleList NodeRules={NULL,0};
static TaggingRuleList WayRules={NULL,0};
static TaggingRuleList RelationRules={NULL,0};
static int current_list_stack_depth=0;
static TaggingRuleList **current_list_stack=NULL;
static TaggingRuleList *current_list=NULL;
/* Local parsing functions */
static TaggingRuleList *AppendTaggingRule(TaggingRuleList *rules,const char *k,const char *v,int action);
static void AppendTaggingAction(TaggingRuleList *rules,const char *k,const char *v,int action,const char *message);
static void DeleteTaggingRuleList(TaggingRuleList *rules);
static void ApplyRules(TaggingRuleList *rules,TagList *input,TagList *output,const char *match_k,const char *match_v);
/* The XML tag processing function prototypes */
//static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding);
//static int RoutinoTaggingType_function(const char *_tag_,int _type_);
static int NodeType_function(const char *_tag_,int _type_);
static int WayType_function(const char *_tag_,int _type_);
static int RelationType_function(const char *_tag_,int _type_);
static int IfType_function(const char *_tag_,int _type_,const char *k,const char *v);
static int IfNotType_function(const char *_tag_,int _type_,const char *k,const char *v);
static int SetType_function(const char *_tag_,int _type_,const char *k,const char *v);
static int UnsetType_function(const char *_tag_,int _type_,const char *k);
static int OutputType_function(const char *_tag_,int _type_,const char *k,const char *v);
static int LogErrorType_function(const char *_tag_,int _type_,const char *k,const char *v,const char *message);
/* The XML tag definitions (forward declarations) */
static const xmltag xmlDeclaration_tag;
static const xmltag RoutinoTaggingType_tag;
static const xmltag NodeType_tag;
static const xmltag WayType_tag;
static const xmltag RelationType_tag;
static const xmltag IfType_tag;
static const xmltag IfNotType_tag;
static const xmltag SetType_tag;
static const xmltag UnsetType_tag;
static const xmltag OutputType_tag;
static const xmltag LogErrorType_tag;
/* The XML tag definition values */
/*+ The complete set of tags at the top level. +*/
static const xmltag * const xml_toplevel_tags[]={&xmlDeclaration_tag,&RoutinoTaggingType_tag,NULL};
/*+ The xmlDeclaration type tag. +*/
static const xmltag xmlDeclaration_tag=
{"xml",
2, {"version","encoding"},
NULL,
{NULL}};
/*+ The RoutinoTaggingType type tag. +*/
static const xmltag RoutinoTaggingType_tag=
{"routino-tagging",
0, {NULL},
NULL,
{&NodeType_tag,&WayType_tag,&RelationType_tag,NULL}};
/*+ The NodeType type tag. +*/
static const xmltag NodeType_tag=
{"node",
0, {NULL},
NodeType_function,
{&IfType_tag,&IfNotType_tag,NULL}};
/*+ The WayType type tag. +*/
static const xmltag WayType_tag=
{"way",
0, {NULL},
WayType_function,
{&IfType_tag,&IfNotType_tag,NULL}};
/*+ The RelationType type tag. +*/
static const xmltag RelationType_tag=
{"relation",
0, {NULL},
RelationType_function,
{&IfType_tag,&IfNotType_tag,NULL}};
/*+ The IfType type tag. +*/
static const xmltag IfType_tag=
{"if",
2, {"k","v"},
IfType_function,
{&IfType_tag,&IfNotType_tag,&SetType_tag,&UnsetType_tag,&OutputType_tag,&LogErrorType_tag,NULL}};
/*+ The IfNotType type tag. +*/
static const xmltag IfNotType_tag=
{"ifnot",
2, {"k","v"},
IfNotType_function,
{&IfType_tag,&IfNotType_tag,&SetType_tag,&UnsetType_tag,&OutputType_tag,&LogErrorType_tag,NULL}};
/*+ The SetType type tag. +*/
static const xmltag SetType_tag=
{"set",
2, {"k","v"},
SetType_function,
{NULL}};
/*+ The UnsetType type tag. +*/
static const xmltag UnsetType_tag=
{"unset",
1, {"k"},
UnsetType_function,
{NULL}};
/*+ The OutputType type tag. +*/
static const xmltag OutputType_tag=
{"output",
2, {"k","v"},
OutputType_function,
{NULL}};
/*+ The LogErrorType type tag. +*/
static const xmltag LogErrorType_tag=
{"logerror",
3, {"k","v","message"},
LogErrorType_function,
{NULL}};
/* The XML tag processing functions */
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the XML declaration is seen
int xmlDeclaration_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
const char *version The contents of the 'version' attribute (or NULL if not defined).
const char *encoding The contents of the 'encoding' attribute (or NULL if not defined).
++++++++++++++++++++++++++++++++++++++*/
//static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding)
//{
// return(0);
//}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the RoutinoTaggingType XSD type is seen
int RoutinoTaggingType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
++++++++++++++++++++++++++++++++++++++*/
//static int RoutinoTaggingType_function(const char *_tag_,int _type_)
//{
// return(0);
//}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the NodeType XSD type is seen
int NodeType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
++++++++++++++++++++++++++++++++++++++*/
static int NodeType_function(const char *_tag_,int _type_)
{
if(_type_&XMLPARSE_TAG_START)
{
current_list_stack_depth=0;
current_list=&NodeRules;
}
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the WayType XSD type is seen
int WayType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
++++++++++++++++++++++++++++++++++++++*/
static int WayType_function(const char *_tag_,int _type_)
{
if(_type_&XMLPARSE_TAG_START)
{
current_list_stack_depth=0;
current_list=&WayRules;
}
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the RelationType XSD type is seen
int RelationType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
++++++++++++++++++++++++++++++++++++++*/
static int RelationType_function(const char *_tag_,int _type_)
{
if(_type_&XMLPARSE_TAG_START)
{
current_list_stack_depth=0;
current_list=&RelationRules;
}
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the IfType XSD type is seen
int IfType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
const char *k The contents of the 'k' attribute (or NULL if not defined).
const char *v The contents of the 'v' attribute (or NULL if not defined).
++++++++++++++++++++++++++++++++++++++*/
static int IfType_function(const char *_tag_,int _type_,const char *k,const char *v)
{
if(_type_&XMLPARSE_TAG_START)
{
if(!current_list_stack || (current_list_stack_depth%8)==7)
current_list_stack=(TaggingRuleList**)realloc((void*)current_list_stack,(current_list_stack_depth+8)*sizeof(TaggingRuleList*));
current_list_stack[current_list_stack_depth++]=current_list;
current_list=AppendTaggingRule(current_list,k,v,TAGACTION_IF);
}
if(_type_&XMLPARSE_TAG_END)
current_list=current_list_stack[--current_list_stack_depth];
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the IfNotType XSD type is seen
int IfNotType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
const char *k The contents of the 'k' attribute (or NULL if not defined).
const char *v The contents of the 'v' attribute (or NULL if not defined).
++++++++++++++++++++++++++++++++++++++*/
static int IfNotType_function(const char *_tag_,int _type_,const char *k,const char *v)
{
if(_type_&XMLPARSE_TAG_START)
{
if(!current_list_stack || (current_list_stack_depth%8)==7)
current_list_stack=(TaggingRuleList**)realloc((void*)current_list_stack,(current_list_stack_depth+8)*sizeof(TaggingRuleList*));
current_list_stack[current_list_stack_depth++]=current_list;
current_list=AppendTaggingRule(current_list,k,v,TAGACTION_IFNOT);
}
if(_type_&XMLPARSE_TAG_END)
current_list=current_list_stack[--current_list_stack_depth];
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the SetType XSD type is seen
int SetType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
const char *k The contents of the 'k' attribute (or NULL if not defined).
const char *v The contents of the 'v' attribute (or NULL if not defined).
++++++++++++++++++++++++++++++++++++++*/
static int SetType_function(const char *_tag_,int _type_,const char *k,const char *v)
{
if(_type_&XMLPARSE_TAG_START)
AppendTaggingAction(current_list,k,v,TAGACTION_SET,NULL);
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the UnsetType XSD type is seen
int UnsetType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
const char *k The contents of the 'k' attribute (or NULL if not defined).
++++++++++++++++++++++++++++++++++++++*/
static int UnsetType_function(const char *_tag_,int _type_,const char *k)
{
if(_type_&XMLPARSE_TAG_START)
AppendTaggingAction(current_list,k,NULL,TAGACTION_UNSET,NULL);
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the OutputType XSD type is seen
int OutputType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
const char *k The contents of the 'k' attribute (or NULL if not defined).
const char *v The contents of the 'v' attribute (or NULL if not defined).
++++++++++++++++++++++++++++++++++++++*/
static int OutputType_function(const char *_tag_,int _type_,const char *k,const char *v)
{
if(_type_&XMLPARSE_TAG_START)
AppendTaggingAction(current_list,k,v,TAGACTION_OUTPUT,NULL);
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The function that is called when the LogErrorType XSD type is seen
int LogErrorType_function Returns 0 if no error occured or something else otherwise.
const char *_tag_ Set to the name of the element tag that triggered this function call.
int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
const char *k The contents of the 'k' attribute (or NULL if not defined).
const char *v The contents of the 'v' attribute (or NULL if not defined).
const char *message The contents of the 'message' attribute (or NULL if not defined).
++++++++++++++++++++++++++++++++++++++*/
static int LogErrorType_function(const char *_tag_,int _type_,const char *k,const char *v,const char *message)
{
if(_type_&XMLPARSE_TAG_START)
AppendTaggingAction(current_list,k,v,TAGACTION_LOGERROR,message);
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
The XML tagging rules parser.
int ParseXMLTaggingRules Returns 0 if OK or something else in case of an error.
const char *filename The name of the file to read.
++++++++++++++++++++++++++++++++++++++*/
int ParseXMLTaggingRules(const char *filename)
{
int fd;
int retval;
if(!ExistsFile(filename))
{
fprintf(stderr,"Error: Specified tagging rules file '%s' does not exist.\n",filename);
return(1);
}
fd=OpenFile(filename);
/* Initialise variables used for parsing */
retval=ParseXML(fd,xml_toplevel_tags,XMLPARSE_UNKNOWN_ATTR_ERRNONAME);
CloseFile(fd);
if(current_list_stack)
free(current_list_stack);
if(retval)
return(1);
return(0);
}
/*++++++++++++++++++++++++++++++++++++++
Delete the tagging rules loaded from the XML file.
++++++++++++++++++++++++++++++++++++++*/
void DeleteXMLTaggingRules(void)
{
current_list_stack_depth=0;
current_list_stack=NULL;
current_list=NULL;
DeleteTaggingRuleList(&NodeRules);
DeleteTaggingRuleList(&WayRules);
DeleteTaggingRuleList(&RelationRules);
}
/*++++++++++++++++++++++++++++++++++++++
Append a tagging rule to the list of rules.
TaggingRuleList *AppendTaggingRule Returns the new TaggingRuleList inside the new TaggingRule.
TaggingRuleList *rules The list of rules to add to.
const char *k The tag key.
const char *v The tag value.
int action Set to the type of action.
++++++++++++++++++++++++++++++++++++++*/
TaggingRuleList *AppendTaggingRule(TaggingRuleList *rules,const char *k,const char *v,int action)
{
if((rules->nrules%16)==0)
rules->rules=(TaggingRule*)realloc((void*)rules->rules,(rules->nrules+16)*sizeof(TaggingRule));
rules->nrules++;
rules->rules[rules->nrules-1].action=action;
if(k)
rules->rules[rules->nrules-1].k=strcpy(malloc(strlen(k)+1),k);
else
rules->rules[rules->nrules-1].k=NULL;
if(v)
rules->rules[rules->nrules-1].v=strcpy(malloc(strlen(v)+1),v);
else
rules->rules[rules->nrules-1].v=NULL;
rules->rules[rules->nrules-1].message=NULL;
rules->rules[rules->nrules-1].rulelist=(TaggingRuleList*)calloc(sizeof(TaggingRuleList),1);
return(rules->rules[rules->nrules-1].rulelist);
}
/*++++++++++++++++++++++++++++++++++++++
Append a tagging action to the list of rules.
TaggingRuleList *rules The list of rules to add to.
const char *k The tag key.
const char *v The tag value.
int action Set to the type of action.
const char *message The message to use for the logerror action.
++++++++++++++++++++++++++++++++++++++*/
static void AppendTaggingAction(TaggingRuleList *rules,const char *k,const char *v,int action,const char *message)
{
if((rules->nrules%16)==0)
rules->rules=(TaggingRule*)realloc((void*)rules->rules,(rules->nrules+16)*sizeof(TaggingRule));
rules->nrules++;
rules->rules[rules->nrules-1].action=action;
if(k)
rules->rules[rules->nrules-1].k=strcpy(malloc(strlen(k)+1),k);
else
rules->rules[rules->nrules-1].k=NULL;
if(v)
rules->rules[rules->nrules-1].v=strcpy(malloc(strlen(v)+1),v);
else
rules->rules[rules->nrules-1].v=NULL;
if(message)
rules->rules[rules->nrules-1].message=strcpy(malloc(strlen(message)+1),message);
else
rules->rules[rules->nrules-1].message=(char*)default_logerror_message;
rules->rules[rules->nrules-1].rulelist=NULL;
}
/*++++++++++++++++++++++++++++++++++++++
Delete a tagging rule.
TaggingRuleList *rules The list of rules to be deleted.
++++++++++++++++++++++++++++++++++++++*/
void DeleteTaggingRuleList(TaggingRuleList *rules)
{
int i;
for(i=0;inrules;i++)
{
if(rules->rules[i].k)
free(rules->rules[i].k);
if(rules->rules[i].v)
free(rules->rules[i].v);
if(rules->rules[i].message && rules->rules[i].message!=default_logerror_message)
free(rules->rules[i].message);
if(rules->rules[i].rulelist)
{
DeleteTaggingRuleList(rules->rules[i].rulelist);
free(rules->rules[i].rulelist);
}
}
if(rules->rules)
free(rules->rules);
rules->rules=NULL;
rules->nrules=0;
}
/*++++++++++++++++++++++++++++++++++++++
Create a new TagList structure.
TagList *NewTagList Returns the new allocated TagList.
++++++++++++++++++++++++++++++++++++++*/
TagList *NewTagList(void)
{
return((TagList*)calloc(sizeof(TagList),1));
}
/*++++++++++++++++++++++++++++++++++++++
Delete a tag list and the contents.
TagList *tags The list of tags to delete.
++++++++++++++++++++++++++++++++++++++*/
void DeleteTagList(TagList *tags)
{
int i;
for(i=0;intags;i++)
{
if(tags->k[i]) free(tags->k[i]);
if(tags->v[i]) free(tags->v[i]);
}
if(tags->k) free(tags->k);
if(tags->v) free(tags->v);
free(tags);
}
/*++++++++++++++++++++++++++++++++++++++
Append a tag to the list of tags.
TagList *tags The list of tags to add to.
const char *k The tag key.
const char *v The tag value.
++++++++++++++++++++++++++++++++++++++*/
void AppendTag(TagList *tags,const char *k,const char *v)
{
if((tags->ntags%8)==0)
{
int i;
tags->k=(char**)realloc((void*)tags->k,(tags->ntags+8)*sizeof(char*));
tags->v=(char**)realloc((void*)tags->v,(tags->ntags+8)*sizeof(char*));
for(i=tags->ntags;i<(tags->ntags+8);i++)
tags->k[i]=tags->v[i]=NULL;
}
tags->k[tags->ntags]=strcpy(realloc(tags->k[tags->ntags],strlen(k)+1),k);
tags->v[tags->ntags]=strcpy(realloc(tags->v[tags->ntags],strlen(v)+1),v);
tags->ntags++;
}
/*++++++++++++++++++++++++++++++++++++++
Modify an existing tag or append a new tag to the list of tags.
TagList *tags The list of tags to modify.
const char *k The tag key.
const char *v The tag value.
++++++++++++++++++++++++++++++++++++++*/
void ModifyTag(TagList *tags,const char *k,const char *v)
{
int i;
for(i=0;intags;i++)
if(!strcmp(tags->k[i],k))
{
tags->v[i]=strcpy(realloc(tags->v[i],strlen(v)+1),v);
return;
}
AppendTag(tags,k,v);
}
/*++++++++++++++++++++++++++++++++++++++
Delete an existing tag from the list of tags.
TagList *tags The list of tags to modify.
const char *k The tag key.
++++++++++++++++++++++++++++++++++++++*/
void DeleteTag(TagList *tags,const char *k)
{
int i,j;
for(i=0;intags;i++)
if(!strcmp(tags->k[i],k))
{
if(tags->k[i]) free(tags->k[i]);
if(tags->v[i]) free(tags->v[i]);
for(j=i+1;jntags;j++)
{
tags->k[j-1]=tags->k[j];
tags->v[j-1]=tags->v[j];
}
tags->ntags--;
tags->k[tags->ntags]=NULL;
tags->v[tags->ntags]=NULL;
return;
}
}
/*++++++++++++++++++++++++++++++++++++++
Create a string containing all of the tags formatted as if HTML.
char *StringifyTag Returns a static pointer to the created string.
TagList *tags The list of tags to convert.
++++++++++++++++++++++++++++++++++++++*/
char *StringifyTag(TagList *tags)
{
static char *string=NULL; /* static allocation of return value */
int i,length=0,used=0;
for(i=0;intags;i++)
{
length+=strlen(tags->k[i]);
length+=strlen(tags->v[i]);
length+=16;
}
string=realloc((char*)string,length);
for(i=0;intags;i++)
used+=sprintf(string+used,"",tags->k[i],tags->v[i]);
return(string);
}
/*++++++++++++++++++++++++++++++++++++++
Apply a set of tagging rules to a set of node tags.
TagList *ApplyNodeTaggingRules Returns the list of output tags after modification.
TagList *tags The tags to be modified.
int64_t id The ID of the node.
++++++++++++++++++++++++++++++++++++++*/
TagList *ApplyNodeTaggingRules(TagList *tags,int64_t id)
{
TagList *result=NewTagList();
current_id=id;
current_list=&NodeRules;
ApplyRules(current_list,tags,result,NULL,NULL);
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Apply a set of tagging rules to a set of way tags.
TagList *ApplyWayTaggingRules Returns the list of output tags after modification.
TagList *tags The tags to be modified.
int64_t id The ID of the way.
++++++++++++++++++++++++++++++++++++++*/
TagList *ApplyWayTaggingRules(TagList *tags,int64_t id)
{
TagList *result=NewTagList();
current_id=id;
current_list=&WayRules;
ApplyRules(current_list,tags,result,NULL,NULL);
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Apply a set of tagging rules to a set of relation tags.
TagList *ApplyRelationTaggingRules Returns the list of output tags after modification.
TagList *tags The tags to be modified.
int64_t id The ID of the relation.
++++++++++++++++++++++++++++++++++++++*/
TagList *ApplyRelationTaggingRules(TagList *tags,int64_t id)
{
TagList *result=NewTagList();
current_id=id;
current_list=&RelationRules;
ApplyRules(current_list,tags,result,NULL,NULL);
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Apply a set of rules to a matching tag.
TaggingRuleList *rules The rules that are to be matched.
TagList *input The input tags.
TagList *output The output tags.
const char *match_k The key matched at the higher level rule.
const char *match_v The value matched at the higher level rule.
++++++++++++++++++++++++++++++++++++++*/
static void ApplyRules(TaggingRuleList *rules,TagList *input,TagList *output,const char *match_k,const char *match_v)
{
int i,j;
char *match_k_copy=NULL,*match_v_copy=NULL;
if(match_k)
match_k_copy=strcpy(malloc(strlen(match_k)+1),match_k);
if(match_v)
match_v_copy=strcpy(malloc(strlen(match_v)+1),match_v);
for(i=0;inrules;i++)
{
const char *k,*v;
k=rules->rules[i].k;
if(!k && rules->rules[i].action >= TAGACTION_INHERIT)
k=match_k_copy;
v=rules->rules[i].v;
if(!v && rules->rules[i].action >= TAGACTION_INHERIT)
v=match_v_copy;
switch(rules->rules[i].action)
{
case TAGACTION_IF:
if(k && v)
{
for(j=0;jntags;j++)
if(!strcmp(input->k[j],k) && !strcmp(input->v[j],v))
ApplyRules(rules->rules[i].rulelist,input,output,input->k[j],input->v[j]);
}
else if(k && !v)
{
for(j=0;jntags;j++)
if(!strcmp(input->k[j],k))
ApplyRules(rules->rules[i].rulelist,input,output,input->k[j],input->v[j]);
}
else if(!k && v)
{
for(j=0;jntags;j++)
if(!strcmp(input->v[j],v))
ApplyRules(rules->rules[i].rulelist,input,output,input->k[j],input->v[j]);
}
else /* if(!k && !v) */
{
if(!input->ntags)
ApplyRules(rules->rules[i].rulelist,input,output,"","");
else
for(j=0;jntags;j++)
ApplyRules(rules->rules[i].rulelist,input,output,input->k[j],input->v[j]);
}
break;
case TAGACTION_IFNOT:
if(k && v)
{
for(j=0;jntags;j++)
if(!strcmp(input->k[j],k) && !strcmp(input->v[j],v))
break;
if(j!=input->ntags)
break;
}
else if(k && !v)
{
for(j=0;jntags;j++)
if(!strcmp(input->k[j],k))
break;
if(j!=input->ntags)
break;
}
else if(!k && v)
{
for(j=0;jntags;j++)
if(!strcmp(input->v[j],v))
break;
if(j!=input->ntags)
break;
}
else /* if(!k && !v) */
{
break;
}
ApplyRules(rules->rules[i].rulelist,input,output,k,v);
break;
case TAGACTION_SET:
ModifyTag(input,k,v);
break;
case TAGACTION_UNSET:
DeleteTag(input,k);
break;
case TAGACTION_OUTPUT:
ModifyTag(output,k,v);
break;
case TAGACTION_LOGERROR:
if(rules->rules[i].k && !rules->rules[i].v)
for(j=0;jntags;j++)
if(!strcmp(input->k[j],rules->rules[i].k))
{
v=input->v[j];
break;
}
if(current_list==&NodeRules)
logerror("Node %"Pnode_t" has an unrecognised tag '%s' = '%s' (in tagging rules); %s.\n",logerror_node(current_id),k,v,rules->rules[i].message);
if(current_list==&WayRules)
logerror("Way %"Pway_t" has an unrecognised tag '%s' = '%s' (in tagging rules); %s.\n",logerror_way(current_id),k,v,rules->rules[i].message);
if(current_list==&RelationRules)
logerror("Relation %"Prelation_t" has an unrecognised tag '%s' = '%s' (in tagging rules); %s.\n",logerror_relation(current_id),k,v,rules->rules[i].message);
}
}
if(match_k_copy) free(match_k_copy);
if(match_v_copy) free(match_v_copy);
}
routino-3.4.1/src/osmparser.h 644 233 144 4264 14450041353 11346 0 /***************************************
Header file for OSM parser function prototype.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2014 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#ifndef OSMPARSER_H
#define OSMPARSER_H /*+ To stop multiple inclusions. +*/
#include
#include "typesx.h"
#include "xmlparse.h"
#include "tagging.h"
/* Constants */
#define MODE_NORMAL 3
#define MODE_CREATE 2
#define MODE_MODIFY 1
#define MODE_DELETE -1
/* Functions in osmxmlparse.c */
int ParseOSMFile(int fd,NodesX *OSMNodes,WaysX *OSMWays,RelationsX *OSMRelations);
int ParseOSCFile(int fd,NodesX *OSMNodes,WaysX *OSMWays,RelationsX *OSMRelations);
/* Functions in osmpbfparse.c */
int ParsePBFFile(int fd,NodesX *OSMNodes,WaysX *OSMWays,RelationsX *OSMRelations);
/* Functions in osmo5mparse.c */
int ParseO5MFile(int fd,NodesX *OSMNodes,WaysX *OSMWays,RelationsX *OSMRelations);
int ParseO5CFile(int fd,NodesX *OSMNodes,WaysX *OSMWays,RelationsX *OSMRelations);
/* Functions in osmparser.c */
void InitialiseParser(NodesX *OSMNodes,WaysX *OSMWays,RelationsX *OSMRelations);
void CleanupParser(void);
void AddWayRefs(int64_t node_id);
void AddRelationRefs(int64_t node_id,int64_t way_id,int64_t relation_id,const char *role);
void ProcessNodeTags(TagList *tags,int64_t node_id,double latitude,double longitude,int mode);
void ProcessWayTags(TagList *tags,int64_t way_id, int mode);
void ProcessRelationTags(TagList *tags,int64_t relation_id,int mode);
#endif /* OSMPARSER_H */
routino-3.4.1/src/routino.c 644 233 144 53525 13716543132 11057 0 /***************************************
Routino library functions file.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2015-2017, 2019, 2020 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include "routino.h"
#include "types.h"
#include "nodes.h"
#include "segments.h"
#include "ways.h"
#include "relations.h"
#include "fakes.h"
#include "results.h"
#include "functions.h"
#include "profiles.h"
#include "translations.h"
#include "version.h"
/* Global variables */
/*+ Contains the libroutino API version number. +*/
DLL_PUBLIC const int Routino_APIVersion=ROUTINO_API_VERSION;
/*+ Contains the Routino version number. +*/
DLL_PUBLIC const char *Routino_Version=ROUTINO_VERSION;
/*+ Contains the error number of the most recent Routino function (one of the ROUTINO_ERROR_* values). +*/
DLL_PUBLIC int Routino_errno=ROUTINO_ERROR_NONE;
/*+ The function to be called to report on the routing progress. +*/
Routino_ProgressFunc progress_func=NULL;
/*+ The current state of the routing progress. +*/
double progress_value=0;
/*+ Set when the progress callback returns false in the routing function. +*/
int progress_abort=0;
/*+ The option to calculate the quickest route insted of the shortest. +*/
extern int option_quickest;
/*+ The options to select the format of the file output. +*/
extern int option_file_html,option_file_gpx_track,option_file_gpx_route,option_file_text,option_file_text_all,option_file_stdout;
/*+ The options to select the format of the linked list output. +*/
extern int option_list_html,option_list_html_all,option_list_text,option_list_text_all;
/* Static variables */
static distance_t distmax=km_to_distance(1);
/* Local types */
struct _Routino_Database
{
Nodes *nodes;
Segments *segments;
Ways *ways;
Relations *relations;
};
struct _Routino_Waypoint
{
index_t segment;
index_t node1,node2;
distance_t dist1,dist2;
};
/*++++++++++++++++++++++++++++++++++++++
Check the version of the library used by the caller against the library version
int Routino_Check_API_Version Returns ROUTINO_ERROR_NONE if OK or ROUTINO_ERROR_WRONG_VERSION if there is an error.
int caller_version The version of the API used in the caller.
This function should not be called directly, use the macro Routino_CheckAPIVersion() which takes no arguments.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC int Routino_Check_API_Version(int caller_version)
{
if(caller_version==Routino_APIVersion)
return(ROUTINO_ERROR_NONE);
else
return(ROUTINO_ERROR_WRONG_API_VERSION);
}
/*++++++++++++++++++++++++++++++++++++++
Load a database of files for Routino to use for routing.
Routino_Database *Routino_LoadDatabase Returns a pointer to the database.
const char *dirname The pathname of the directory containing the database files.
const char *prefix The prefix of the database files.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC Routino_Database *Routino_LoadDatabase(const char *dirname,const char *prefix)
{
char *nodes_filename;
char *segments_filename;
char *ways_filename;
char *relations_filename;
Routino_Database *database=NULL;
nodes_filename =FileName(dirname,prefix,"nodes.mem");
segments_filename =FileName(dirname,prefix,"segments.mem");
ways_filename =FileName(dirname,prefix,"ways.mem");
relations_filename=FileName(dirname,prefix,"relations.mem");
if(!ExistsFile(nodes_filename) || !ExistsFile(segments_filename) || !ExistsFile(ways_filename) || !ExistsFile(relations_filename))
{
Routino_errno=ROUTINO_ERROR_NO_DATABASE_FILES;
return(NULL);
}
else
{
database=calloc(sizeof(Routino_Database),1);
database->nodes =LoadNodeList (nodes_filename);
database->segments =LoadSegmentList (segments_filename);
database->ways =LoadWayList (ways_filename);
database->relations=LoadRelationList(relations_filename);
}
free(nodes_filename);
free(segments_filename);
free(ways_filename);
free(relations_filename);
if(!database->nodes || !database->segments || !database->ways || !database->relations)
{
Routino_UnloadDatabase(database);
database=NULL;
Routino_errno=ROUTINO_ERROR_BAD_DATABASE_FILES;
}
if(database)
{
Routino_errno=ROUTINO_ERROR_NONE;
return(database);
}
else
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
Close the database files that were opened by a call to Routino_LoadDatabase().
Routino_Database *database The database to close.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC void Routino_UnloadDatabase(Routino_Database *database)
{
if(!database)
Routino_errno=ROUTINO_ERROR_NO_DATABASE;
else
{
if(database->nodes) DestroyNodeList (database->nodes);
if(database->segments) DestroySegmentList (database->segments);
if(database->ways) DestroyWayList (database->ways);
if(database->relations) DestroyRelationList(database->relations);
free(database);
Routino_errno=ROUTINO_ERROR_NONE;
}
}
/*++++++++++++++++++++++++++++++++++++++
Parse a Routino XML file containing profiles, must be called before selecting a profile.
int Routino_ParseXMLProfiles Returns non-zero in case of an error or zero if there was no error.
const char *filename The full pathname of the file to read.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC int Routino_ParseXMLProfiles(const char *filename)
{
int retval;
retval=ParseXMLProfiles(filename,NULL,1);
if(retval==1)
retval=ROUTINO_ERROR_NO_PROFILES_XML;
else if(retval==2)
retval=ROUTINO_ERROR_BAD_PROFILES_XML;
Routino_errno=retval;
return(retval);
}
/*++++++++++++++++++++++++++++++++++++++
Return a list of the profile names that have been loaded from the XML file.
char **Routino_GetProfileNames Returns a NULL terminated list of strings - all allocated.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC char **Routino_GetProfileNames(void)
{
Routino_errno=ROUTINO_ERROR_NONE;
return(GetProfileNames());
}
/*++++++++++++++++++++++++++++++++++++++
Select a specific routing profile from the set of Routino profiles that have been loaded from the XML file or NULL in case of an error.
Routino_Profile *Routino_GetProfile Returns a pointer to an internal data structure - do not free.
const char *name The name of the profile to select.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC Routino_Profile *Routino_GetProfile(const char *name)
{
Profile *profile=GetProfile(name);
if(profile)
Routino_errno=ROUTINO_ERROR_NONE;
else
Routino_errno=ROUTINO_ERROR_NO_SUCH_PROFILE;
return(profile);
}
/*++++++++++++++++++++++++++++++++++++++
Free the internal memory that was allocated for the Routino profiles loaded from the XML file.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC void Routino_FreeXMLProfiles(void)
{
Routino_errno=ROUTINO_ERROR_NONE;
FreeXMLProfiles();
}
/*++++++++++++++++++++++++++++++++++++++
Parse a Routino XML file containing translations, must be called before selecting a translation.
int Routino_ParseXMLTranslations Returns non-zero in case of an error or zero if there was no error.
const char *filename The full pathname of the file to read.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC int Routino_ParseXMLTranslations(const char *filename)
{
int retval;
retval=ParseXMLTranslations(filename,NULL,1);
if(retval==1)
retval=ROUTINO_ERROR_NO_TRANSLATIONS_XML;
else if(retval==2)
retval=ROUTINO_ERROR_BAD_TRANSLATIONS_XML;
Routino_errno=retval;
return(retval);
}
/*++++++++++++++++++++++++++++++++++++++
Return a list of the translation languages that have been loaded from the XML file.
char **Routino_GetTranslationLanguages Returns a NULL terminated list of strings - all allocated.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC char **Routino_GetTranslationLanguages(void)
{
Routino_errno=ROUTINO_ERROR_NONE;
return(GetTranslationLanguages());
}
/*++++++++++++++++++++++++++++++++++++++
Return a list of the full names of the translation languages that have been loaded from the XML file.
char **Routino_GetTranslationLanguageFullNames Returns a NULL terminated list of strings - all allocated.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC char **Routino_GetTranslationLanguageFullNames(void)
{
Routino_errno=ROUTINO_ERROR_NONE;
return(GetTranslationLanguageFullNames());
}
/*++++++++++++++++++++++++++++++++++++++
Select a specific translation from the set of Routino translations that have been loaded from the XML file or NULL in case of an error.
Routino_Translation *Routino_GetTranslation Returns a pointer to an internal data structure - do not free.
const char *language The language to select (as a country code, e.g. 'en', 'de') or an empty string for the first in the file or NULL for the built-in English version.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC Routino_Translation *Routino_GetTranslation(const char *language)
{
Translation *translation=GetTranslation(language);
if(translation)
Routino_errno=ROUTINO_ERROR_NONE;
else
Routino_errno=ROUTINO_ERROR_NO_SUCH_TRANSLATION;
return(translation);
}
/*++++++++++++++++++++++++++++++++++++++
Free the internal memory that was allocated for the Routino translations loaded from the XML file.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC void Routino_FreeXMLTranslations(void)
{
Routino_errno=ROUTINO_ERROR_NONE;
FreeXMLTranslations();
}
/*++++++++++++++++++++++++++++++++++++++
Create a fully formed Routino Profile from a Routino User Profile.
Routino_Profile *Routino_CreateProfileFromUserProfile Returns an allocated Routino Profile.
Routino_UserProfile *profile The user specified profile to convert (not modified by this).
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC Routino_Profile *Routino_CreateProfileFromUserProfile(Routino_UserProfile *profile)
{
Routino_Profile *rprofile=calloc(1,sizeof(Routino_Profile));
int i;
Routino_errno=ROUTINO_ERROR_NONE;
if(!profile)
{
Routino_errno=ROUTINO_ERROR_NO_PROFILE;
free(rprofile);
return(NULL);
}
if(profile->transport<=0 || profile->transport>=Transport_Count)
Routino_errno=ROUTINO_ERROR_BAD_USER_PROFILE;
else
rprofile->transport=profile->transport;
for(i=1;ihighway[i]<0 || profile->highway[i]>1)
Routino_errno=ROUTINO_ERROR_BAD_USER_PROFILE;
else
rprofile->highway[i]=profile->highway[i];
if(profile->speed[i]<=0)
Routino_errno=ROUTINO_ERROR_BAD_USER_PROFILE;
else
rprofile->speed[i]=kph_to_speed(profile->speed[i]);
}
for(i=1;iprops[i]<0 || profile->props[i]>1)
Routino_errno=ROUTINO_ERROR_BAD_USER_PROFILE;
else
rprofile->props[i]=profile->props[i];
}
if(profile->weight<=0)
Routino_errno=ROUTINO_ERROR_BAD_USER_PROFILE;
else
rprofile->weight=tonnes_to_weight(profile->weight);
if(profile->height<=0)
Routino_errno=ROUTINO_ERROR_BAD_USER_PROFILE;
else
rprofile->height=metres_to_height(profile->height);
if(profile->width<=0)
Routino_errno=ROUTINO_ERROR_BAD_USER_PROFILE;
else
rprofile->width=metres_to_width(profile->width);
if(profile->length<=0)
Routino_errno=ROUTINO_ERROR_BAD_USER_PROFILE;
else
rprofile->length=metres_to_length(profile->length);
if(Routino_errno==ROUTINO_ERROR_NONE)
return(rprofile);
free(rprofile);
return(NULL);
}
/*++++++++++++++++++++++++++++++++++++++
Create a Routino User Profile from a Routino Profile loaded from an XML file.
Routino_UserProfile *Routino_CreateUserProfileFromProfile Returns an allocated Routino User Profile.
Routino_Profile *profile The Routino Profile to convert (not modified by this).
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC Routino_UserProfile *Routino_CreateUserProfileFromProfile(Routino_Profile *profile)
{
Routino_UserProfile *uprofile=calloc(1,sizeof(Routino_UserProfile));
int i;
Routino_errno=ROUTINO_ERROR_NONE;
if(!profile)
{
Routino_errno=ROUTINO_ERROR_NO_PROFILE;
free(uprofile);
return(NULL);
}
uprofile->transport=profile->transport;
for(i=1;ihighway[i]=profile->highway[i];
uprofile->speed[i]=speed_to_kph(profile->speed[i]);
}
for(i=1;iprops[i]=profile->props[i];
uprofile->weight=weight_to_tonnes(profile->weight);
uprofile->height=height_to_metres(profile->height);
uprofile->width=width_to_metres(profile->width);
uprofile->length=length_to_metres(profile->length);
return(uprofile);
}
/*++++++++++++++++++++++++++++++++++++++
Validates that a selected routing profile is valid for use with the selected routing database.
int Routino_ValidateProfile Returns zero if OK or something else in case of an error.
Routino_Database *database The Routino database to use.
Routino_Profile *profile The Routino profile to validate.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC int Routino_ValidateProfile(Routino_Database *database,Routino_Profile *profile)
{
Routino_errno=ROUTINO_ERROR_NONE;
if(!database)
{
Routino_errno=ROUTINO_ERROR_NO_DATABASE;
return Routino_errno;
}
if(!profile)
{
Routino_errno=ROUTINO_ERROR_NO_PROFILE;
return Routino_errno;
}
if(UpdateProfile(profile,database->ways))
Routino_errno=ROUTINO_ERROR_PROFILE_DATABASE_ERR;
return(Routino_errno);
}
/*++++++++++++++++++++++++++++++++++++++
Finds the nearest point in the database to the specified latitude and longitude.
Routino_Waypoint *Routino_FindWaypoint Returns a pointer to a newly allocated Routino waypoint or NULL if none could be found.
Routino_Database *database The Routino database to use.
Routino_Profile *profile The Routino profile to use.
double latitude The latitude in degrees of the point.
double longitude The longitude in degrees of the point.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC Routino_Waypoint *Routino_FindWaypoint(Routino_Database *database,Routino_Profile *profile,double latitude,double longitude)
{
distance_t dist;
Routino_Waypoint *waypoint;
if(!database)
{
Routino_errno=ROUTINO_ERROR_NO_DATABASE;
return(NULL);
}
if(!profile)
{
Routino_errno=ROUTINO_ERROR_NO_PROFILE;
return(NULL);
}
if(!profile->transports)
{
Routino_errno=ROUTINO_ERROR_NOTVALID_PROFILE;
return(NULL);
}
waypoint=calloc(sizeof(Routino_Waypoint),1);
waypoint->segment=FindClosestSegment(database->nodes,database->segments,database->ways,
degrees_to_radians(latitude),degrees_to_radians(longitude),distmax,profile,
&dist,&waypoint->node1,&waypoint->node2,&waypoint->dist1,&waypoint->dist2);
if(waypoint->segment==NO_SEGMENT)
{
free(waypoint);
Routino_errno=ROUTINO_ERROR_NO_NEARBY_HIGHWAY;
return(NULL);
}
Routino_errno=ROUTINO_ERROR_NONE;
return(waypoint);
}
/*++++++++++++++++++++++++++++++++++++++
Calculate a route using a loaded database, chosen profile, chosen translation and set of waypoints.
Routino_Output *Routino_CalculateRoute Returns the head of a linked list of route data (if requested) or NULL.
Routino_Database *database The loaded database to use.
Routino_Profile *profile The chosen routing profile to use.
Routino_Translation *translation The chosen translation information to use.
Routino_Waypoint **waypoints The set of waypoints.
int nwaypoints The number of waypoints.
int options The set of routing options (ROUTINO_ROUTE_*) ORed together.
Routino_ProgressFunc progress A function to be called occasionally to report progress or NULL.
++++++++++++++++++++++++++++++++++++++*/
DLL_PUBLIC Routino_Output *Routino_CalculateRoute(Routino_Database *database,Routino_Profile *profile,Routino_Translation *translation,
Routino_Waypoint **waypoints,int nwaypoints,int options,Routino_ProgressFunc progress)
{
int first_waypoint,last_waypoint,this_waypoint,nwaypoints_routed,inc_dec_waypoint,start_waypoint,finish_waypoint=-1;
index_t start_node,finish_node=NO_NODE;
index_t join_segment=NO_SEGMENT;
Results **results;
Routino_Output *output=NULL;
/* Check the input data */
if(!database)
{
Routino_errno=ROUTINO_ERROR_NO_DATABASE;
return(NULL);
}
if(!profile)
{
Routino_errno=ROUTINO_ERROR_NO_PROFILE;
return(NULL);
}
if(!profile->transports)
{
Routino_errno=ROUTINO_ERROR_NOTVALID_PROFILE;
return(NULL);
}
if(!translation)
{
Routino_errno=ROUTINO_ERROR_NO_TRANSLATION;
return(NULL);
}
/* Extract the options */
if(options&ROUTINO_ROUTE_QUICKEST) option_quickest=1; else option_quickest=0;
if(options&ROUTINO_ROUTE_FILE_HTML) option_file_html=1; else option_file_html=0;
if(options&ROUTINO_ROUTE_FILE_GPX_TRACK) option_file_gpx_track=1; else option_file_gpx_track=0;
if(options&ROUTINO_ROUTE_FILE_GPX_ROUTE) option_file_gpx_route=1; else option_file_gpx_route=0;
if(options&ROUTINO_ROUTE_FILE_TEXT) option_file_text=1; else option_file_text=0;
if(options&ROUTINO_ROUTE_FILE_TEXT_ALL) option_file_text_all=1; else option_file_text_all=0;
if(options&ROUTINO_ROUTE_FILE_STDOUT) option_file_stdout=1; else option_file_stdout=0;
if(option_file_stdout && (option_file_html+option_file_gpx_track+option_file_gpx_route+option_file_text+option_file_text_all)!=1)
{
Routino_errno=ROUTINO_ERROR_BAD_OPTIONS;
return(NULL);
}
if(options&ROUTINO_ROUTE_LIST_HTML) option_list_html=1; else option_list_html=0;
if(options&ROUTINO_ROUTE_LIST_HTML_ALL) option_list_html_all=1; else option_list_html_all=0;
if(options&ROUTINO_ROUTE_LIST_TEXT) option_list_text=1; else option_list_text=0;
if(options&ROUTINO_ROUTE_LIST_TEXT_ALL) option_list_text_all=1; else option_list_text_all=0;
if((option_list_html+option_list_html_all+option_list_text+option_list_text_all)>1)
{
Routino_errno=ROUTINO_ERROR_BAD_OPTIONS;
return(NULL);
}
/* Set up the progress callback */
progress_func=progress;
progress_value=0.0;
progress_abort=0;
/* Check for loop and reverse options */
if(options&ROUTINO_ROUTE_LOOP)
nwaypoints_routed=nwaypoints+1;
else
nwaypoints_routed=nwaypoints;
if(options&ROUTINO_ROUTE_REVERSE)
{
first_waypoint=nwaypoints_routed-1;
last_waypoint=0;
inc_dec_waypoint=-1;
}
else
{
first_waypoint=0;
last_waypoint=nwaypoints_routed-1;
inc_dec_waypoint=1;
}
/* Loop through all pairs of waypoints */
results=calloc(sizeof(Results*),nwaypoints);
for(this_waypoint=first_waypoint;this_waypoint!=(last_waypoint+inc_dec_waypoint);this_waypoint+=inc_dec_waypoint)
{
int waypoint=this_waypoint%nwaypoints;
int waypoint_count=(this_waypoint-first_waypoint)*inc_dec_waypoint;
if(progress_func)
{
progress_value=(double)waypoint_count/(double)(nwaypoints_routed+1);
if(!progress_func(progress_value))
{
Routino_errno=ROUTINO_ERROR_PROGRESS_ABORTED;
goto tidy_and_exit;
}
}
start_waypoint=finish_waypoint;
start_node=finish_node;
finish_waypoint=waypoint+1;
finish_node=CreateFakes(database->nodes,database->segments,finish_waypoint,
LookupSegment(database->segments,waypoints[waypoint]->segment,1),
waypoints[waypoint]->node1,waypoints[waypoint]->node2,waypoints[waypoint]->dist1,waypoints[waypoint]->dist2);
if(waypoint_count==0)
continue;
results[waypoint_count-1]=CalculateRoute(database->nodes,database->segments,database->ways,database->relations,
profile,start_node,join_segment,finish_node,start_waypoint,finish_waypoint);
if(!results[waypoint_count-1])
{
if(progress_func && progress_abort)
Routino_errno=ROUTINO_ERROR_PROGRESS_ABORTED;
else
Routino_errno=ROUTINO_ERROR_NO_ROUTE_1-1+start_waypoint;
goto tidy_and_exit;
}
join_segment=results[waypoint_count-1]->last_segment;
}
if(progress_func)
{
progress_value=(double)this_waypoint/(double)(nwaypoints_routed+1);
if(!progress_func(progress_value))
{
Routino_errno=ROUTINO_ERROR_PROGRESS_ABORTED;
goto tidy_and_exit;
}
}
/* Print the route */
output=PrintRoute(results,nwaypoints_routed-1,database->nodes,database->segments,database->ways,database->relations,profile,translation);
if(progress_func && !progress_func(1.0))
{
Routino_errno=ROUTINO_ERROR_PROGRESS_ABORTED;
goto tidy_and_exit;
}
/* Tidy up and exit */
tidy_and_exit:
DeleteFakeNodes();
for(this_waypoint=0;this_waypointnext;
if(output->name)
free(output->name);
if(output->desc1)
free(output->desc1);
if(output->desc2)
free(output->desc2);
if(output->desc3)
free(output->desc3);
free(output);
output=next;
}
}
routino-3.4.1/src/test/ 40755 233 144 0 14441357437 10134 5 routino-3.4.1/src/test/oneway-loop.sh 777 233 144 0 12064636362 15773 2start-1-finish.sh routino-3.4.1/src/test/loop-and-reverse.osm 644 233 144 7304 12606772336 14056 0
routino-3.4.1/src/test/coincident-waypoint.sh 777 233 144 0 12333356554 16041 2a-b-c-d.sh routino-3.4.1/src/test/a-b-c.sh 755 233 144 1103 13364652274 11361 0 #!/bin/sh
# Run planetsplitter
run_planetsplitter
# Run filedumper
run_filedumper
# Waypoints
waypoints=`run_waypoints $osm list`
# Run the router for each waypoint
for waypoint in $waypoints; do
case $waypoint in
*a) waypoint=`echo $waypoint | sed -e 's%a$%%'` ;;
*) continue ;;
esac
echo "Running router : $waypoint"
waypoint_a=`run_waypoints $osm ${waypoint}a 1`
waypoint_b=`run_waypoints $osm ${waypoint}b 2`
waypoint_c=`run_waypoints $osm ${waypoint}c 3`
run_router $waypoint $waypoint_a $waypoint_b $waypoint_c
done
routino-3.4.1/src/test/loop-and-reverse.sh 755 233 144 1302 13364652316 13662 0 #!/bin/sh
# Run planetsplitter
run_planetsplitter
# Run filedumper
run_filedumper
# Waypoints
waypoints=`run_waypoints $osm list`
waypoint_start=`run_waypoints $osm WPstart 1`
waypoint_middle=`run_waypoints $osm WPmiddle 2`
waypoint_finish=`run_waypoints $osm WPfinish 3`
# Run the router for each loop and reverse option
for waypoint in WP WP-L WP-R WP-LR; do
echo "Running router : $waypoint"
option_loop=""
option_reverse=""
case $waypoint in
*L*) option_loop="--loop" ;;
esac
case $waypoint in
*R*) option_reverse="--reverse" ;;
esac
run_router $waypoint $option_loop $option_reverse $waypoint_start $waypoint_middle $waypoint_finish
done
routino-3.4.1/src/test/node-restrictions.sh 777 233 144 0 12064636362 17175 2start-1-finish.sh routino-3.4.1/src/test/dead-ends.osm 644 233 144 16570 12326256227 12540 0
routino-3.4.1/src/test/loops.sh 777 233 144 0 12064636362 14656 2start-1-finish.sh routino-3.4.1/src/test/roundabout-waypoints.osm 644 233 144 10276 12327506431 15122 0
routino-3.4.1/src/test/no-super.osm 644 233 144 11616 12064636362 12461 0
routino-3.4.1/src/test/prune-short.sh 777 233 144 0 12114364765 15352 2only-split.sh routino-3.4.1/src/test/turns.sh 777 233 144 0 12064636362 14675 2start-1-finish.sh routino-3.4.1/src/test/is-fast-math.c 644 233 144 450 12154147145 12560 0 #include
int main(int argc,char **argv)
{
#ifdef __FAST_MATH__
if(argc>1)
printf("Compiled with -ffast-math => results may differ slightly.\n");
return 0;
#else
if(argc>1)
printf("Not compiled with -ffast-math => results should match exactly.\n");
return 1;
#endif
}
routino-3.4.1/src/test/a-b-c-d.sh 755 233 144 1202 13364652253 11577 0 #!/bin/sh
# Run planetsplitter
run_planetsplitter
# Run filedumper
run_filedumper
# Waypoints
waypoints=`run_waypoints $osm list`
# Run the router for each waypoint
for waypoint in $waypoints; do
case $waypoint in
*a) waypoint=`echo $waypoint | sed -e 's%a$%%'` ;;
*) continue ;;
esac
echo "Running router : $waypoint"
waypoint_a=`run_waypoints $osm ${waypoint}a 1`
waypoint_b=`run_waypoints $osm ${waypoint}b 2`
waypoint_c=`run_waypoints $osm ${waypoint}c 3`
waypoint_d=`run_waypoints $osm ${waypoint}d 4`
run_router $waypoint $waypoint_a $waypoint_b $waypoint_c $waypoint_d
done
routino-3.4.1/src/test/run-one-test.sh 755 233 144 5077 13452410701 13041 0 #!/bin/sh
# Exit on error
set -e
# Test name
name=`basename $1 .sh`
shift
# Use suppressions file in case compiled with sanitizer
LSAN_OPTIONS=suppressions=sanitizer-suppressions.txt
export LSAN_OPTIONS
# Slim or non-slim
if [ "$1" = "slim" ]; then
slim="-slim"
dir="slim"
else
slim=""
dir="fat"
fi
# Libroutino or not libroutino
LD_LIBRARY_PATH=$PWD/..:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if [ "$2" = "lib" ]; then
lib="+lib"
else
lib=""
fi
# Pruned or non-pruned
if [ "$2" = "prune" ]; then
prune=""
pruned="-pruned"
else
prune="--prune-none"
pruned=""
fi
# Create the output directory
dir=$dir$lib$pruned
[ -d $dir ] || mkdir $dir
# Run the programs under a run-time debugger
debugger=${TEST_DEBUGGER:-}
# Name related options
osm=$name.osm
log=$name$lib$slim$pruned.log
option_prefix="--prefix=$name"
option_dir="--dir=$dir"
# Generic program options
option_planetsplitter="--loggable --tagging=../../xml/routino-tagging.xml --errorlog $prune"
option_filedumper="--dump-osm"
option_router="--profile=motorcar --profiles=../../xml/routino-profiles.xml --translations=copyright.xml"
if [ ! "$2" = "lib" ]; then
option_router="$option_router --loggable"
fi
# Run waypoints program
run_waypoints()
{
perl waypoints.pl $@
}
# Run planetsplitter
run_planetsplitter()
{
echo "Running planetsplitter"
echo ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $@ $osm > $log
$debugger ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $@ $osm >> $log
}
# Run filedumper
run_filedumper()
{
echo "Running filedumper"
echo ../filedumper$slim $option_dir $option_prefix $option_filedumper $@ >> $log
$debugger ../filedumper$slim $option_dir $option_prefix $option_filedumper $@ > $dir/$osm
}
# Run the router
run_router()
{
waypoint=$1
shift
[ -d $dir/$name-$waypoint ] || mkdir $dir/$name-$waypoint
echo ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $@ >> $log
$debugger ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $@ >> $log
mv shortest* $dir/$name-$waypoint
echo diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
if ./is-fast-math; then
diff -U 0 expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt | 2>&1 egrep '^[-+] ' || true
else
diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
fi
}
# Run the specific test script
. ./$name.sh
# Finish
exit 0
routino-3.4.1/src/test/super-or-not.sh 777 233 144 0 12064636362 13762 2a-b.sh routino-3.4.1/src/test/expected/ 40755 233 144 0 12725336336 11733 5 routino-3.4.1/src/test/expected/roundabout-waypoints-WP06.txt 644 233 144 1577 12601522406 17415 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220171 -0.520685 -2 Waypt#2 0.020 0.01 0.22 0.1 96 241 roundabout
-0.220268 -0.520863 8* Junct 0.022 0.01 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt#3 0.143 0.09 0.38 0.2 96 182 main 2
routino-3.4.1/src/test/expected/loops-WP09.txt 644 233 144 3465 12601522413 14333 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.219013 -0.517333 -2 Waypt#2 0.039 0.05 0.68 0.8 48 44 loop 2
-0.218805 -0.517131 25 Inter 0.032 0.04 0.71 0.8 48 44 loop 2
-0.218417 -0.517462 23* Junct- 0.056 0.07 0.77 0.9 48 319 loop 2
-0.218794 -0.517763 20 Inter 0.053 0.07 0.82 0.9 48 218 loop 2
-0.219266 -0.517579 21* Junct 0.056 0.07 0.88 1.0 48 158 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/node-restrictions-WP05.txt 644 233 144 3416 12601522410 16637 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.220140 -0.519342 14 Inter 0.063 0.08 0.34 0.3 48 14 nopass road
-0.220170 -0.518653 -2 Waypt#2 0.075 0.09 0.41 0.4 48 92 nopass road
-0.220140 -0.519342 14 Inter 0.075 0.09 0.49 0.5 48 272 nopass road
-0.220695 -0.519489 12* Junct 0.063 0.08 0.55 0.6 48 194 nopass road
-0.220694 -0.519227 15 Inter 0.029 0.04 0.58 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.62 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.69 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.75 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.82 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.87 1.0 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.91 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.94 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.14 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.27 1.3 96 2 main 2
routino-3.4.1/src/test/expected/dead-ends-WP01.txt 644 233 144 2307 12601522417 15011 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220263 -0.519309 13* Waypt#2 0.052 0.07 0.35 0.4 48 21 dead-end 1
-0.220702 -0.519478 12* Junct 0.052 0.07 0.41 0.4 48 201 dead-end 1
-0.220739 -0.517804 18* Junct 0.186 0.23 0.59 0.7 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.78 0.9 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.01 1.2 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.06 1.2 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.15 1.3 96 2 main 2
routino-3.4.1/src/test/expected/turns-WP13.txt 644 233 144 6657 12725336245 14370 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.218619 -0.517921 32* Inter 0.067 0.08 0.72 0.8 48 330 loop 5
-0.218431 -0.518243 28 Inter 0.041 0.05 0.76 0.9 48 300 loop 5
-0.218600 -0.518557 25* Inter 0.039 0.05 0.80 0.9 48 241 loop 5
-0.218691 -0.518602 -2 Waypt#2 0.011 0.01 0.81 1.0 48 206 loop 5
-0.219135 -0.518823 23* Inter 0.054 0.07 0.86 1.0 48 206 loop 5
-0.219145 -0.517626 33* Inter 0.133 0.17 1.00 1.2 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 1.04 1.2 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 1.05 1.3 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 1.07 1.3 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 1.09 1.3 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 1.11 1.3 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 1.13 1.3 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 1.15 1.4 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 1.16 1.4 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 1.18 1.4 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 1.22 1.5 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 1.35 1.6 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 1.42 1.7 48 270 top road
-0.219123 -0.520207 12* Junct 0.086 0.11 1.51 1.8 48 270 top road
-0.219107 -0.520828 6* Junct 0.069 0.09 1.58 1.9 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.75 2.0 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.82 2.0 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.85 2.1 96 181 main 1
routino-3.4.1/src/test/expected/node-restrictions-WP06.txt 644 233 144 3416 12601522410 16640 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.220694 -0.519227 15 Inter 0.029 0.04 0.31 0.3 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.34 0.3 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.41 0.4 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.48 0.5 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.54 0.5 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.60 0.6 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.64 0.7 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.66 0.7 48 88 long road
-0.220212 -0.517903 25 Inter 0.059 0.07 0.72 0.8 48 349 nopass road
-0.220176 -0.518543 -2 Waypt#2 0.070 0.09 0.79 0.9 48 273 nopass road
-0.220212 -0.517903 25 Inter 0.070 0.09 0.86 0.9 48 93 nopass road
-0.220739 -0.517801 26* Junct 0.059 0.07 0.92 1.0 48 169 nopass road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.12 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.25 1.3 96 2 main 2
routino-3.4.1/src/test/expected/dead-ends-WP06.txt 644 233 144 2557 12601522416 15024 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220296 -0.517634 20* Junct- 0.052 0.07 0.54 0.6 48 21 dead-end 2
-0.219991 -0.517512 21 Waypt#2 0.036 0.04 0.57 0.6 48 21 dead-end 2
-0.220296 -0.517634 20* Junct- 0.036 0.04 0.61 0.7 48 201 dead-end 2
-0.220739 -0.517804 18* Junct 0.052 0.07 0.66 0.7 48 201 dead-end 2
-0.220782 -0.516137 24* Junct 0.185 0.23 0.85 1.0 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.08 1.3 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.13 1.3 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.22 1.4 96 2 main 2
routino-3.4.1/src/test/expected/coincident-waypoint-WP04.txt 644 233 144 1202 12601522420 17142 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217286 -0.520780 7 Waypt#1 0.000 0.00 0.00 0.0
-0.217286 -0.520780 7 Waypt#2 0.000 0.00 0.00 0.0 96 270 main 1
-0.218523 -0.520806 6 Waypt#3 0.137 0.09 0.14 0.1 96 181 main 1
-0.218523 -0.520806 6 Waypt#4 0.000 0.00 0.14 0.1 96 270 main 1
routino-3.4.1/src/test/expected/no-super-WP02.txt 644 233 144 1057 12601522412 14732 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216472 -0.519026 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.216671 -0.515660 -2 Waypt#2 0.374 0.47 0.37 0.5 48 93 road2
-0.216579 -0.517212 -3 Waypt#3 0.172 0.21 0.55 0.7 48 273 road2
routino-3.4.1/src/test/expected/turns-WP06.txt 644 233 144 3650 12725335772 14364 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Inter 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220708 -0.518842 22* Inter 0.069 0.09 0.47 0.4 48 91 high street
-0.220724 -0.518071 31* Junct 0.085 0.10 0.56 0.5 48 91 high street
-0.220143 -0.518162 30 Inter 0.065 0.08 0.62 0.6 48 351 loop 2
-0.219850 -0.518416 27 Waypt#2 0.043 0.05 0.67 0.7 48 319 loop 2
-0.220100 -0.518718 24* Inter 0.043 0.05 0.71 0.7 48 230 loop 2
-0.220708 -0.518842 22* Inter 0.069 0.09 0.78 0.8 48 191 loop 2
-0.220724 -0.518071 31* Junct 0.085 0.10 0.86 0.9 48 91 high street
-0.220739 -0.517425 34* Inter 0.071 0.09 0.93 1.0 48 91 high street
-0.220760 -0.516647 48* Inter 0.086 0.11 1.02 1.1 48 91 high street
-0.220784 -0.516035 54* Junct 0.068 0.09 1.09 1.2 48 92 high street
-0.221431 -0.516056 53* Junct 0.072 0.04 1.16 1.2 96 181 main 2
-0.221376 -0.518235 29* Junct 0.242 0.30 1.40 1.5 48 271 bottom road
-0.221360 -0.518860 21* Junct 0.069 0.09 1.47 1.6 48 271 bottom road
-0.221308 -0.520914 4* Junct 0.228 0.28 1.70 1.9 48 271 bottom road
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.73 1.9 96 181 main 1
routino-3.4.1/src/test/expected/turns-WP04.txt 644 233 144 3767 12725335624 14367 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Inter 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220708 -0.518842 22* Inter 0.069 0.09 0.47 0.4 48 91 high street
-0.220724 -0.518071 31* Junct 0.085 0.10 0.56 0.5 48 91 high street
-0.220143 -0.518162 30 Inter 0.065 0.08 0.62 0.6 48 351 loop 2
-0.219850 -0.518416 27 Inter 0.043 0.05 0.67 0.7 48 319 loop 2
-0.220100 -0.518718 24* Inter 0.043 0.05 0.71 0.7 48 230 loop 2
-0.220206 -0.518739 -2 Waypt#2 0.012 0.01 0.72 0.7 48 191 loop 2
-0.220708 -0.518842 22* Inter 0.057 0.07 0.78 0.8 48 191 loop 2
-0.220724 -0.518071 31* Junct 0.085 0.10 0.86 0.9 48 91 high street
-0.220739 -0.517425 34* Inter 0.071 0.09 0.93 1.0 48 91 high street
-0.220760 -0.516647 48* Inter 0.086 0.11 1.02 1.1 48 91 high street
-0.220784 -0.516035 54* Junct 0.068 0.09 1.09 1.2 48 92 high street
-0.221431 -0.516056 53* Junct 0.072 0.04 1.16 1.2 96 181 main 2
-0.221376 -0.518235 29* Junct 0.242 0.30 1.40 1.5 48 271 bottom road
-0.221360 -0.518860 21* Junct 0.069 0.09 1.47 1.6 48 271 bottom road
-0.221308 -0.520914 4* Junct 0.228 0.28 1.70 1.9 48 271 bottom road
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.73 1.9 96 181 main 1
routino-3.4.1/src/test/expected/turns-WP01.txt 644 233 144 2530 12725335423 14344 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Inter 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220111 -0.519553 17 Inter 0.065 0.08 0.47 0.4 48 351 loop 1
-0.219817 -0.519807 15 Inter 0.043 0.05 0.51 0.5 48 319 loop 1
-0.220067 -0.520109 13* Inter 0.043 0.05 0.55 0.5 48 230 loop 1
-0.220191 -0.520132 -2 Waypt#2 0.014 0.02 0.57 0.6 48 190 loop 1
-0.220671 -0.520223 11* Junct 0.054 0.07 0.62 0.6 48 190 loop 1
-0.220666 -0.520893 5* Junct 0.074 0.09 0.70 0.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 0.77 0.8 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 0.79 0.8 96 181 main 1
routino-3.4.1/src/test/expected/turns-WP08.txt 644 233 144 4467 12725336077 14374 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct 0.018 0.02 0.54 0.6 48 27 roundabout
-0.219184 -0.515968 55* Junct 0.095 0.12 0.63 0.7 48 92 top road
-0.220784 -0.516035 54* Junct 0.178 0.11 0.81 0.8 96 182 main 2
-0.220760 -0.516647 48* Junct 0.068 0.09 0.88 0.9 48 272 high street
-0.220097 -0.516762 47* Inter 0.074 0.09 0.95 1.0 48 350 loop 3
-0.219872 -0.517009 43 Inter 0.037 0.04 0.99 1.1 48 312 loop 3
-0.220089 -0.517279 35* Waypt#2 0.038 0.05 1.03 1.1 48 231 loop 3
-0.220739 -0.517425 34* Junct 0.074 0.09 1.10 1.2 48 192 loop 3
-0.220724 -0.518071 31* Junct 0.071 0.09 1.17 1.3 48 271 high street
-0.220708 -0.518842 22* Junct 0.085 0.10 1.26 1.4 48 271 high street
-0.220691 -0.519461 19* Junct 0.069 0.09 1.33 1.5 48 271 high street
-0.220671 -0.520223 11* Junct 0.084 0.10 1.41 1.6 48 271 high street
-0.220666 -0.520893 5* Junct 0.074 0.09 1.48 1.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.55 1.7 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.58 1.7 96 181 main 1
routino-3.4.1/src/test/expected/dead-ends-WP03.txt 644 233 144 3025 12601522417 15011 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220263 -0.519309 13* Junct- 0.052 0.07 0.35 0.4 48 21 dead-end 1
-0.219924 -0.519179 14 Inter 0.040 0.05 0.39 0.4 48 20 dead-end 1
-0.219567 -0.519373 -2 Waypt#2 0.045 0.06 0.44 0.5 48 331 dead-end 1
-0.219924 -0.519179 14 Inter 0.045 0.06 0.48 0.5 48 151 dead-end 1
-0.220263 -0.519309 13* Junct- 0.040 0.05 0.52 0.6 48 200 dead-end 1
-0.220702 -0.519478 12* Junct 0.052 0.07 0.57 0.6 48 201 dead-end 1
-0.220739 -0.517804 18* Junct 0.186 0.23 0.76 0.9 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.95 1.1 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.18 1.4 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.23 1.4 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.32 1.5 96 2 main 2
routino-3.4.1/src/test/expected/loops-WP05.txt 644 233 144 3345 12601522414 14325 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Junct- 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Inter 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219237 -0.519286 13* Junct 0.077 0.10 0.45 0.5 48 345 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.51 0.6 48 338 loop 1
-0.218380 -0.519134 16 Waypt#2 0.056 0.07 0.56 0.6 48 41 loop 1
-0.218776 -0.518838 18 Inter 0.055 0.07 0.62 0.7 48 143 loop 1
-0.219237 -0.519286 13* Junct 0.071 0.09 0.69 0.8 48 224 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/turns-WP02.txt 644 233 144 2411 12725335500 14337 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Inter 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220111 -0.519553 17 Inter 0.065 0.08 0.47 0.4 48 351 loop 1
-0.219817 -0.519807 15 Inter 0.043 0.05 0.51 0.5 48 319 loop 1
-0.220067 -0.520109 13* Waypt#2 0.043 0.05 0.55 0.5 48 230 loop 1
-0.220671 -0.520223 11* Junct 0.068 0.09 0.62 0.6 48 190 loop 1
-0.220666 -0.520893 5* Junct 0.074 0.09 0.70 0.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 0.77 0.8 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 0.79 0.8 96 181 main 1
routino-3.4.1/src/test/expected/cycle-both-ways-WP02.txt 644 233 144 2203 12601522417 16173 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.221402 -0.520913 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220268 -0.520863 8* Junct 0.125 0.38 0.12 0.4 20 2 main 2
-0.220062 -0.521204 2 Inter 0.044 0.13 0.17 0.5 20 301 roundabout
-0.219665 -0.521190 3 Junct- 0.044 0.13 0.21 0.6 20 1 roundabout
-0.219482 -0.520837 9* Junct- 0.044 0.13 0.26 0.8 20 62 roundabout
-0.219692 -0.520509 15* Junct- 0.043 0.13 0.30 0.9 20 122 roundabout
-0.220082 -0.520522 14* Junct 0.043 0.13 0.34 1.0 20 181 roundabout
-0.220768 -0.519742 16 Inter 0.115 0.34 0.46 1.4 20 131 residential road
-0.220811 -0.518939 19* Junct 0.089 0.27 0.55 1.6 20 93 residential road
-0.221319 -0.518949 -2 Waypt#2 0.056 0.17 0.60 1.8 20 181 main 3
routino-3.4.1/src/test/expected/turns-WP14.txt 644 233 144 6540 12725336307 14357 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.218619 -0.517921 32* Inter 0.067 0.08 0.72 0.8 48 330 loop 5
-0.218431 -0.518243 28 Inter 0.041 0.05 0.76 0.9 48 300 loop 5
-0.218600 -0.518557 25* Waypt#2 0.039 0.05 0.80 0.9 48 241 loop 5
-0.219135 -0.518823 23* Inter 0.066 0.08 0.86 1.0 48 206 loop 5
-0.219145 -0.517626 33* Inter 0.133 0.17 1.00 1.2 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 1.04 1.2 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 1.06 1.3 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 1.07 1.3 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 1.09 1.3 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 1.11 1.3 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 1.13 1.3 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 1.15 1.4 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 1.17 1.4 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 1.18 1.4 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 1.22 1.5 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 1.36 1.6 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 1.42 1.7 48 270 top road
-0.219123 -0.520207 12* Junct 0.086 0.11 1.51 1.8 48 270 top road
-0.219107 -0.520828 6* Junct 0.069 0.09 1.58 1.9 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.75 2.0 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.82 2.0 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.85 2.1 96 181 main 1
routino-3.4.1/src/test/expected/loops-WP04.txt 644 233 144 3464 12601522414 14326 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Junct- 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Inter 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219237 -0.519286 13* Junct 0.077 0.10 0.45 0.5 48 345 loop 1
-0.218997 -0.519053 -2 Waypt#2 0.037 0.04 0.49 0.5 48 44 loop 1
-0.218776 -0.518838 18 Inter 0.034 0.04 0.52 0.6 48 44 loop 1
-0.218380 -0.519134 16 Inter 0.055 0.07 0.58 0.6 48 323 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.63 0.7 48 221 loop 1
-0.219237 -0.519286 13* Junct 0.056 0.07 0.69 0.8 48 158 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/super-or-not-WP04.txt 644 233 144 1602 12635017000 15531 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217183 -0.527270 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.217197 -0.525552 5* Junct- 0.190 0.12 0.19 0.1 96 90 Main road
-0.217216 -0.523210 8* Junct- 0.260 0.16 0.45 0.3 96 90 Main road
-0.217245 -0.519637 11* Junct- 0.397 0.25 0.85 0.5 96 90 Main road
-0.217248 -0.515206 19* Junct 0.493 0.31 1.34 0.8 96 90 Main road
-0.215941 -0.515611 18 Inter 0.152 0.19 1.49 1.0 48 342 Local road
-0.216087 -0.515786 -2 Waypt#2 0.025 0.03 1.52 1.1 48 230 Local road
routino-3.4.1/src/test/expected/loop-and-reverse-WP-R.txt 644 233 144 1327 12606772160 16415 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219540 -0.514010 -3 Waypt#3 0.000 0.00 0.00 0.0
-0.220817 -0.514062 14* Junct 0.141 0.09 0.14 0.1 96 182 main 2
-0.220749 -0.517228 -2 Waypt#2 0.352 0.44 0.49 0.5 48 271 low street
-0.220666 -0.521060 4* Junct 0.426 0.53 0.92 1.1 48 271 low street
-0.219526 -0.521010 -1 Waypt#1 0.126 0.08 1.04 1.1 96 2 main 1
routino-3.4.1/src/test/expected/dead-ends-WP02.txt 644 233 144 2557 12601522417 15021 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220263 -0.519309 13* Junct- 0.052 0.07 0.35 0.4 48 21 dead-end 1
-0.219924 -0.519179 14 Waypt#2 0.040 0.05 0.39 0.4 48 20 dead-end 1
-0.220263 -0.519309 13* Junct- 0.040 0.05 0.43 0.5 48 200 dead-end 1
-0.220702 -0.519478 12* Junct 0.052 0.07 0.48 0.5 48 201 dead-end 1
-0.220739 -0.517804 18* Junct 0.186 0.23 0.67 0.8 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.86 1.0 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.09 1.3 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.14 1.3 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.23 1.4 96 2 main 2
routino-3.4.1/src/test/expected/node-restrictions-WP02.txt 644 233 144 3426 12601522411 16636 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.221123 -0.519360 13 Inter 0.049 0.06 0.33 0.3 48 163 somepass road
-0.221154 -0.518671 -2 Waypt#2 0.075 0.09 0.40 0.4 48 92 somepass road
-0.221123 -0.519360 13 Inter 0.075 0.09 0.48 0.5 48 272 somepass road
-0.220695 -0.519489 12* Junct 0.049 0.06 0.53 0.5 48 343 somepass road
-0.220694 -0.519227 15 Inter 0.029 0.04 0.55 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.59 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.66 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.73 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.79 0.8 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.85 0.9 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.88 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.91 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.11 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.24 1.3 96 2 main 2
routino-3.4.1/src/test/expected/super-or-not-WP01.txt 644 233 144 1603 12635016647 15547 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216158 -0.518809 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.216435 -0.518515 13 Inter 0.044 0.06 0.04 0.1 48 133 Local road
-0.215866 -0.517931 14 Inter 0.090 0.11 0.13 0.2 48 45 Local road
-0.216470 -0.517412 15 Inter 0.088 0.11 0.22 0.3 48 139 Local road
-0.215930 -0.516823 16 Inter 0.088 0.11 0.31 0.4 48 47 Local road
-0.216451 -0.516221 17 Inter 0.088 0.11 0.40 0.5 48 130 Local road
-0.216158 -0.515870 -2 Waypt#2 0.050 0.06 0.45 0.6 48 50 Local road
routino-3.4.1/src/test/expected/coincident-waypoint-WP03.txt 644 233 144 1442 12601522420 17147 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217022 -0.520773 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.217022 -0.520773 -2 Waypt#2 0.000 0.00 0.00 0.0 96 270 main 1
-0.217286 -0.520780 7 Junct- 0.029 0.02 0.03 0.0 96 181 main 1
-0.218523 -0.520806 6 Junct- 0.137 0.09 0.17 0.1 96 181 main 1
-0.219153 -0.520826 -3 Waypt#3 0.069 0.04 0.23 0.1 96 181 main 1
-0.219153 -0.520826 -4 Waypt#4 0.000 0.00 0.23 0.1 96 270 main 1
routino-3.4.1/src/test/expected/no-super-WP01.txt 644 233 144 2121 12601522412 14722 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.215814 -0.519419 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.215737 -0.519035 7 Inter 0.043 0.05 0.04 0.1 48 78 road1
-0.215935 -0.518253 10 Inter 0.089 0.11 0.13 0.2 48 104 road1
-0.215772 -0.517713 13 Inter 0.062 0.08 0.19 0.2 48 73 road1
-0.215952 -0.516838 15 Inter 0.099 0.12 0.29 0.4 48 101 road1
-0.215755 -0.515945 19 Inter 0.101 0.12 0.39 0.5 48 77 road1
-0.215897 -0.515462 -2 Waypt#2 0.055 0.07 0.45 0.6 48 106 road1
-0.215755 -0.515945 19 Inter 0.055 0.07 0.50 0.6 48 286 road1
-0.215952 -0.516838 15 Inter 0.101 0.12 0.60 0.8 48 257 road1
-0.215868 -0.517244 -3 Waypt#3 0.046 0.06 0.65 0.8 48 281 road1
routino-3.4.1/src/test/expected/loop-and-reverse-WP.txt 644 233 144 1327 12606772160 16216 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219526 -0.521010 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.521060 4* Junct 0.126 0.08 0.13 0.1 96 182 main 1
-0.220749 -0.517228 -2 Waypt#2 0.426 0.53 0.55 0.6 48 91 low street
-0.220817 -0.514062 14* Junct 0.352 0.44 0.90 1.1 48 91 low street
-0.219540 -0.514010 -3 Waypt#3 0.141 0.09 1.04 1.1 96 2 main 2
routino-3.4.1/src/test/expected/oneway-loop-WP01.txt 644 233 144 2325 12601522410 15427 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220695 -0.519489 9* Inter 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 12* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220405 -0.517799 13 Inter 0.037 0.04 0.50 0.5 48 0 reverse loop
-0.220210 -0.518605 11 Waypt#2 0.092 0.12 0.59 0.7 48 283 reverse loop
-0.220333 -0.519485 10 Inter 0.098 0.12 0.69 0.8 48 262 reverse loop
-0.220695 -0.519489 9* Inter 0.040 0.05 0.73 0.8 48 180 reverse loop
-0.220739 -0.517801 12* Junct 0.187 0.23 0.92 1.1 48 91 high street
-0.220784 -0.516035 18* Junct 0.196 0.24 1.11 1.3 48 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.25 1.4 96 2 main 2
routino-3.4.1/src/test/expected/dead-ends-WP10.txt 644 233 144 3025 12601522415 15005 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.67 0.8 48 91 high street
-0.220361 -0.515961 25* Junct- 0.050 0.06 0.72 0.8 48 22 dead-end 3
-0.220019 -0.515847 26 Inter 0.040 0.05 0.76 0.9 48 18 dead-end 3
-0.219672 -0.516031 -2 Waypt#2 0.043 0.05 0.81 0.9 48 332 dead-end 3
-0.220019 -0.515847 26 Inter 0.043 0.05 0.85 1.0 48 152 dead-end 3
-0.220361 -0.515961 25* Junct- 0.040 0.05 0.89 1.0 48 198 dead-end 3
-0.220782 -0.516137 24* Junct 0.050 0.06 0.94 1.1 48 202 dead-end 3
-0.220817 -0.514062 32* Junct 0.230 0.29 1.17 1.4 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.22 1.4 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.31 1.5 96 2 main 2
routino-3.4.1/src/test/expected/turns-WP12.txt 644 233 144 4601 12725336204 14345 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 0.79 0.9 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 0.85 1.0 48 270 top road
-0.218482 -0.519542 18* Inter 0.073 0.09 0.93 1.1 48 349 loop 4
-0.218258 -0.519789 16 Waypt#2 0.037 0.04 0.96 1.1 48 312 loop 4
-0.218474 -0.520060 14* Inter 0.038 0.05 1.00 1.2 48 231 loop 4
-0.219123 -0.520207 12* Junct 0.074 0.09 1.07 1.3 48 192 loop 4
-0.219107 -0.520828 6* Junct 0.069 0.09 1.14 1.4 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.32 1.5 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.39 1.5 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.41 1.5 96 181 main 1
routino-3.4.1/src/test/expected/fake-node-with-loop-WP01.txt 644 233 144 2546 12601522415 16741 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216904 -0.520770 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.217286 -0.520780 10 Junct- 0.042 0.03 0.04 0.0 96 181 main 1
-0.218086 -0.520797 -2 Waypt#2 0.088 0.06 0.13 0.1 96 181 main 1
-0.218523 -0.520806 9 Junct- 0.048 0.03 0.18 0.1 96 181 main 1
-0.219482 -0.520837 8* Junct 0.106 0.07 0.28 0.2 96 181 main 1
-0.219692 -0.520509 14 Junct- 0.043 0.03 0.33 0.2 96 122 roundabout
-0.220082 -0.520522 13 Junct- 0.043 0.03 0.37 0.2 96 181 roundabout
-0.220268 -0.520863 7 Inter 0.043 0.03 0.41 0.3 96 241 roundabout
-0.220062 -0.521204 4 Junct- 0.044 0.03 0.46 0.3 96 301 roundabout
-0.219665 -0.521190 5 Junct- 0.044 0.03 0.50 0.3 96 1 roundabout
-0.219482 -0.520837 8* Junct 0.044 0.03 0.55 0.3 96 62 roundabout
-0.218523 -0.520806 9 Junct- 0.106 0.07 0.65 0.4 96 1 main 1
-0.217741 -0.520789 -3 Waypt#3 0.086 0.05 0.74 0.5 96 1 main 1
routino-3.4.1/src/test/expected/node-restrictions-WP08.txt 644 233 144 3152 12601522410 16637 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.219009 -0.520075 10* Waypt#2 0.186 0.17 0.39 0.3 64 2 dead end road
-0.220682 -0.520141 9* Junct 0.186 0.17 0.58 0.5 64 182 dead end road
-0.220695 -0.519489 12* Change 0.072 0.07 0.65 0.6 64 91 high street
-0.220694 -0.519227 15 Inter 0.029 0.04 0.68 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.72 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.78 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.85 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.91 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.97 1.0 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 1.01 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 1.04 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.23 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.36 1.3 96 2 main 2
routino-3.4.1/src/test/expected/dead-ends-WP09.txt 644 233 144 2557 12601522415 15026 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.67 0.8 48 91 high street
-0.220361 -0.515961 25* Junct- 0.050 0.06 0.72 0.8 48 22 dead-end 3
-0.220019 -0.515847 26 Waypt#2 0.040 0.05 0.76 0.9 48 18 dead-end 3
-0.220361 -0.515961 25* Junct- 0.040 0.05 0.80 0.9 48 198 dead-end 3
-0.220782 -0.516137 24* Junct 0.050 0.06 0.85 1.0 48 202 dead-end 3
-0.220817 -0.514062 32* Junct 0.230 0.29 1.08 1.3 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.13 1.3 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.22 1.4 96 2 main 2
routino-3.4.1/src/test/expected/turns-WP11.txt 644 233 144 4601 12725336173 14351 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 0.79 0.9 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 0.85 1.0 48 270 top road
-0.218482 -0.519542 18* Inter 0.073 0.09 0.93 1.1 48 349 loop 4
-0.218258 -0.519789 16 Inter 0.037 0.04 0.96 1.1 48 312 loop 4
-0.218474 -0.520060 14* Waypt#2 0.038 0.05 1.00 1.2 48 231 loop 4
-0.219123 -0.520207 12* Junct 0.074 0.09 1.07 1.3 48 192 loop 4
-0.219107 -0.520828 6* Junct 0.069 0.09 1.14 1.4 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.32 1.5 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.39 1.5 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.41 1.5 96 181 main 1
routino-3.4.1/src/test/expected/loop-and-reverse-WP-L.txt 644 233 144 1713 12606772160 16406 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219526 -0.521010 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.521060 4* Junct 0.126 0.08 0.13 0.1 96 182 main 1
-0.220749 -0.517228 -2 Waypt#2 0.426 0.53 0.55 0.6 48 91 low street
-0.220817 -0.514062 14* Junct 0.352 0.44 0.90 1.1 48 91 low street
-0.219540 -0.514010 -3 Waypt#3 0.141 0.09 1.04 1.1 96 2 main 2
-0.218970 -0.513986 15* Junct 0.063 0.04 1.11 1.2 96 2 main 2
-0.218820 -0.520980 5* Junct 0.778 0.97 1.89 2.1 48 271 high street
-0.219526 -0.521010 -1 Waypt#1 0.078 0.05 1.96 2.2 96 182 main 1
routino-3.4.1/src/test/expected/loops-WP08.txt 644 233 144 3465 12601522413 14332 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219597 -0.517490 -2 Waypt#2 0.040 0.05 0.60 0.7 48 345 loop 2
-0.219266 -0.517579 21* Junct 0.038 0.05 0.64 0.7 48 345 loop 2
-0.218794 -0.517763 20 Inter 0.056 0.07 0.70 0.8 48 338 loop 2
-0.218417 -0.517462 23* Junct- 0.053 0.07 0.75 0.9 48 38 loop 2
-0.218805 -0.517131 25 Inter 0.056 0.07 0.81 0.9 48 139 loop 2
-0.219266 -0.517579 21* Junct 0.071 0.09 0.88 1.0 48 224 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/roundabout-waypoints-WP04.txt 644 233 144 1577 12601522407 17414 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.219878 -0.520515 -2 Waypt#2 0.020 0.01 0.18 0.1 96 181 roundabout
-0.220082 -0.520522 14 Junct- 0.022 0.01 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt#3 0.143 0.09 0.38 0.2 96 182 main 2
routino-3.4.1/src/test/expected/loops-WP07.txt 644 233 144 3346 12601522413 14327 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Waypt#2 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.218794 -0.517763 20 Inter 0.056 0.07 0.70 0.8 48 338 loop 2
-0.218417 -0.517462 23* Junct- 0.053 0.07 0.75 0.9 48 38 loop 2
-0.218805 -0.517131 25 Inter 0.056 0.07 0.81 0.9 48 139 loop 2
-0.219266 -0.517579 21* Junct 0.071 0.09 0.88 1.0 48 224 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/turns-WP03.txt 644 233 144 2411 12725335533 14346 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Inter 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220111 -0.519553 17 Inter 0.065 0.08 0.47 0.4 48 351 loop 1
-0.219817 -0.519807 15 Waypt#2 0.043 0.05 0.51 0.5 48 319 loop 1
-0.220067 -0.520109 13* Inter 0.043 0.05 0.55 0.5 48 230 loop 1
-0.220671 -0.520223 11* Junct 0.068 0.09 0.62 0.6 48 190 loop 1
-0.220666 -0.520893 5* Junct 0.074 0.09 0.70 0.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 0.77 0.8 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 0.79 0.8 96 181 main 1
routino-3.4.1/src/test/expected/roundabout-waypoints-WP05.txt 644 233 144 1453 12601522407 17406 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Waypt#2 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt#3 0.143 0.09 0.39 0.2 96 182 main 2
routino-3.4.1/src/test/expected/turns-WP15.txt 644 233 144 6540 12725336336 14362 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.218619 -0.517921 32* Inter 0.067 0.08 0.72 0.8 48 330 loop 5
-0.218431 -0.518243 28 Waypt#2 0.041 0.05 0.76 0.9 48 300 loop 5
-0.218600 -0.518557 25* Inter 0.039 0.05 0.80 0.9 48 241 loop 5
-0.219135 -0.518823 23* Inter 0.066 0.08 0.86 1.0 48 206 loop 5
-0.219145 -0.517626 33* Inter 0.133 0.17 1.00 1.2 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 1.04 1.2 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 1.06 1.3 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 1.07 1.3 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 1.09 1.3 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 1.11 1.3 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 1.13 1.3 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 1.15 1.4 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 1.17 1.4 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 1.18 1.4 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 1.22 1.5 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 1.36 1.6 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 1.42 1.7 48 270 top road
-0.219123 -0.520207 12* Junct 0.086 0.11 1.51 1.8 48 270 top road
-0.219107 -0.520828 6* Junct 0.069 0.09 1.58 1.9 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.75 2.0 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.82 2.0 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.85 2.1 96 181 main 1
routino-3.4.1/src/test/expected/loops-WP01.txt 644 233 144 3344 12601522414 14320 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Waypt#2 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Inter 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219237 -0.519286 13* Junct 0.077 0.10 0.45 0.5 48 345 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.51 0.6 48 338 loop 1
-0.218380 -0.519134 16 Inter 0.056 0.07 0.56 0.6 48 41 loop 1
-0.218776 -0.518838 18 Inter 0.055 0.07 0.62 0.7 48 143 loop 1
-0.219237 -0.519286 13* Junct 0.071 0.09 0.69 0.8 48 224 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/coincident-waypoint-WP02.txt 644 233 144 1322 12601522420 17143 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216959 -0.520771 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.217286 -0.520780 7 Junct- 0.036 0.02 0.04 0.0 96 181 main 1
-0.218523 -0.520806 6 Waypt#2 0.137 0.09 0.17 0.1 96 181 main 1
-0.218523 -0.520806 6 Waypt#3 0.000 0.00 0.17 0.1 96 270 main 1
-0.219117 -0.520825 -4 Waypt#4 0.065 0.04 0.24 0.1 96 181 main 1
routino-3.4.1/src/test/expected/turns-WP09.txt 644 233 144 4467 12725336134 14367 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct 0.018 0.02 0.54 0.6 48 27 roundabout
-0.219184 -0.515968 55* Junct 0.095 0.12 0.63 0.7 48 92 top road
-0.220784 -0.516035 54* Junct 0.178 0.11 0.81 0.8 96 182 main 2
-0.220760 -0.516647 48* Junct 0.068 0.09 0.88 0.9 48 272 high street
-0.220097 -0.516762 47* Inter 0.074 0.09 0.95 1.0 48 350 loop 3
-0.219872 -0.517009 43 Waypt#2 0.037 0.04 0.99 1.1 48 312 loop 3
-0.220089 -0.517279 35* Inter 0.038 0.05 1.03 1.1 48 231 loop 3
-0.220739 -0.517425 34* Junct 0.074 0.09 1.10 1.2 48 192 loop 3
-0.220724 -0.518071 31* Junct 0.071 0.09 1.17 1.3 48 271 high street
-0.220708 -0.518842 22* Junct 0.085 0.10 1.26 1.4 48 271 high street
-0.220691 -0.519461 19* Junct 0.069 0.09 1.33 1.5 48 271 high street
-0.220671 -0.520223 11* Junct 0.084 0.10 1.41 1.6 48 271 high street
-0.220666 -0.520893 5* Junct 0.074 0.09 1.48 1.7 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.55 1.7 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.58 1.7 96 181 main 1
routino-3.4.1/src/test/expected/node-restrictions-WP07.txt 644 233 144 3152 12601522410 16636 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.219009 -0.520075 10* Waypt#2 0.186 0.17 0.39 0.3 64 2 dead end road
-0.220682 -0.520141 9* Junct 0.186 0.17 0.58 0.5 64 182 dead end road
-0.220695 -0.519489 12* Change 0.072 0.07 0.65 0.6 64 91 high street
-0.220694 -0.519227 15 Inter 0.029 0.04 0.68 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.72 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.78 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.85 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.91 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.97 1.0 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 1.01 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 1.04 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.23 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.36 1.3 96 2 main 2
routino-3.4.1/src/test/expected/no-super-WP04.txt 644 233 144 2237 12601522412 14735 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217903 -0.519035 6 Waypt#1 0.000 0.00 0.00 0.0
-0.218100 -0.518253 9 Inter 0.089 0.11 0.09 0.1 48 104 road4
-0.217937 -0.517713 12 Inter 0.062 0.08 0.15 0.2 48 73 road4
-0.218117 -0.516837 16 Inter 0.099 0.12 0.25 0.3 48 101 road4
-0.217920 -0.515945 18 Inter 0.101 0.12 0.35 0.4 48 77 road4
-0.218143 -0.515189 21 Inter 0.087 0.11 0.44 0.5 48 106 road4
-0.217911 -0.514640 26 Waypt#2 0.066 0.08 0.50 0.6 48 67 road4
-0.218143 -0.515189 21 Inter 0.066 0.08 0.57 0.7 48 247 road4
-0.217920 -0.515945 18 Inter 0.087 0.11 0.66 0.8 48 286 road4
-0.218117 -0.516837 16 Inter 0.101 0.12 0.76 0.9 48 257 road4
-0.217937 -0.517713 12 Waypt#3 0.099 0.12 0.86 1.1 48 281 road4
routino-3.4.1/src/test/expected/turns-WP05.txt 644 233 144 3650 12725335745 14363 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct 0.173 0.11 0.24 0.2 96 182 main 1
-0.220671 -0.520223 11* Inter 0.074 0.09 0.32 0.2 48 90 high street
-0.220691 -0.519461 19* Junct 0.084 0.10 0.40 0.3 48 91 high street
-0.220708 -0.518842 22* Inter 0.069 0.09 0.47 0.4 48 91 high street
-0.220724 -0.518071 31* Junct 0.085 0.10 0.56 0.5 48 91 high street
-0.220143 -0.518162 30 Inter 0.065 0.08 0.62 0.6 48 351 loop 2
-0.219850 -0.518416 27 Inter 0.043 0.05 0.67 0.7 48 319 loop 2
-0.220100 -0.518718 24* Waypt#2 0.043 0.05 0.71 0.7 48 230 loop 2
-0.220708 -0.518842 22* Inter 0.069 0.09 0.78 0.8 48 191 loop 2
-0.220724 -0.518071 31* Junct 0.085 0.10 0.86 0.9 48 91 high street
-0.220739 -0.517425 34* Inter 0.071 0.09 0.93 1.0 48 91 high street
-0.220760 -0.516647 48* Inter 0.086 0.11 1.02 1.1 48 91 high street
-0.220784 -0.516035 54* Junct 0.068 0.09 1.09 1.2 48 92 high street
-0.221431 -0.516056 53* Junct 0.072 0.04 1.16 1.2 96 181 main 2
-0.221376 -0.518235 29* Junct 0.242 0.30 1.40 1.5 48 271 bottom road
-0.221360 -0.518860 21* Junct 0.069 0.09 1.47 1.6 48 271 bottom road
-0.221308 -0.520914 4* Junct 0.228 0.28 1.70 1.9 48 271 bottom road
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.73 1.9 96 181 main 1
routino-3.4.1/src/test/expected/node-restrictions-WP03.txt 644 233 144 3426 12601522411 16637 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.220694 -0.519227 15 Inter 0.029 0.04 0.31 0.3 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.34 0.3 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.41 0.4 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.48 0.5 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.54 0.5 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.60 0.6 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.64 0.7 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.66 0.7 48 88 long road
-0.221166 -0.517916 24 Inter 0.049 0.06 0.71 0.8 48 195 somepass road
-0.221157 -0.518560 -2 Waypt#2 0.070 0.09 0.78 0.8 48 270 somepass road
-0.221166 -0.517916 24 Inter 0.070 0.09 0.85 0.9 48 90 somepass road
-0.220739 -0.517801 26* Junct 0.049 0.06 0.90 1.0 48 15 somepass road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.10 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.23 1.3 96 2 main 2
routino-3.4.1/src/test/expected/loops-WP03.txt 644 233 144 3464 12601522541 14326 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Junct- 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Inter 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219578 -0.519198 -2 Waypt#2 0.038 0.05 0.41 0.4 48 345 loop 1
-0.219237 -0.519286 13* Junct 0.039 0.05 0.45 0.5 48 345 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.51 0.6 48 338 loop 1
-0.218380 -0.519134 16 Inter 0.056 0.07 0.56 0.6 48 41 loop 1
-0.218776 -0.518838 18 Inter 0.055 0.07 0.62 0.7 48 143 loop 1
-0.219237 -0.519286 13* Junct 0.071 0.09 0.69 0.8 48 224 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/node-restrictions-WP01.txt 644 233 144 3426 12601522411 16635 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.221123 -0.519360 13 Inter 0.049 0.06 0.33 0.3 48 163 somepass road
-0.221156 -0.518615 19* Waypt#2 0.082 0.10 0.41 0.4 48 92 somepass road
-0.221123 -0.519360 13 Inter 0.082 0.10 0.49 0.5 48 272 somepass road
-0.220695 -0.519489 12* Junct 0.049 0.06 0.54 0.5 48 343 somepass road
-0.220694 -0.519227 15 Inter 0.029 0.04 0.57 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.61 0.6 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.67 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.74 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.80 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.86 0.9 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.90 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.93 1.0 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.12 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.25 1.3 96 2 main 2
routino-3.4.1/src/test/expected/loops-WP11.txt 644 233 144 3345 12601522564 14330 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.218794 -0.517763 20 Inter 0.056 0.07 0.70 0.8 48 338 loop 2
-0.218417 -0.517462 23* Waypt#2 0.053 0.07 0.75 0.9 48 38 loop 2
-0.218805 -0.517131 25 Inter 0.056 0.07 0.81 0.9 48 139 loop 2
-0.219266 -0.517579 21* Junct 0.071 0.09 0.88 1.0 48 224 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/super-or-not-WP05.txt 644 233 144 1602 12635017465 15551 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216144 -0.515853 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.215941 -0.515611 18 Inter 0.035 0.04 0.04 0.0 48 50 Local road
-0.217248 -0.515206 19* Junct 0.152 0.19 0.19 0.2 48 162 Local road
-0.217245 -0.519637 11* Junct- 0.493 0.31 0.68 0.5 96 270 Main road
-0.217216 -0.523210 8* Junct- 0.397 0.25 1.08 0.8 96 270 Main road
-0.217197 -0.525552 5* Junct- 0.260 0.16 1.34 0.9 96 270 Main road
-0.217182 -0.527397 -2 Waypt#2 0.204 0.13 1.54 1.1 96 270 Main road
routino-3.4.1/src/test/expected/roundabout-waypoints-WP02.txt 644 233 144 1577 12601522407 17412 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219577 -0.520689 -2 Waypt#2 0.019 0.01 0.13 0.1 96 122 roundabout
-0.219692 -0.520509 15 Junct- 0.023 0.01 0.15 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt#3 0.143 0.09 0.38 0.2 96 182 main 2
routino-3.4.1/src/test/expected/turns-WP07.txt 644 233 144 5056 12725336032 14355 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct 0.018 0.02 0.54 0.6 48 27 roundabout
-0.219184 -0.515968 55* Junct 0.095 0.12 0.63 0.7 48 92 top road
-0.220784 -0.516035 54* Junct 0.178 0.11 0.81 0.8 96 182 main 2
-0.220760 -0.516647 48* Junct 0.068 0.09 0.88 0.9 48 272 high street
-0.220739 -0.517425 34* Junct 0.086 0.11 0.96 1.0 48 271 high street
-0.220238 -0.517313 -2 Waypt#2 0.057 0.07 1.02 1.1 48 12 loop 3
-0.220089 -0.517279 35* Inter 0.017 0.02 1.04 1.1 48 12 loop 3
-0.219872 -0.517009 43 Inter 0.038 0.05 1.08 1.2 48 51 loop 3
-0.220097 -0.516762 47* Inter 0.037 0.04 1.11 1.2 48 132 loop 3
-0.220760 -0.516647 48* Junct 0.074 0.09 1.19 1.3 48 170 loop 3
-0.220739 -0.517425 34* Junct 0.086 0.11 1.27 1.4 48 271 high street
-0.220724 -0.518071 31* Junct 0.071 0.09 1.34 1.5 48 271 high street
-0.220708 -0.518842 22* Junct 0.085 0.10 1.43 1.6 48 271 high street
-0.220691 -0.519461 19* Junct 0.069 0.09 1.50 1.7 48 271 high street
-0.220671 -0.520223 11* Junct 0.084 0.10 1.58 1.8 48 271 high street
-0.220666 -0.520893 5* Junct 0.074 0.09 1.66 1.9 48 270 high street
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.73 1.9 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.75 2.0 96 181 main 1
routino-3.4.1/src/test/expected/loops-WP10.txt 644 233 144 3346 12601522413 14321 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Junct- 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.218805 -0.517131 25 Waypt#2 0.071 0.09 0.71 0.8 48 44 loop 2
-0.218417 -0.517462 23* Junct- 0.056 0.07 0.77 0.9 48 319 loop 2
-0.218794 -0.517763 20 Inter 0.053 0.07 0.82 0.9 48 218 loop 2
-0.219266 -0.517579 21* Junct 0.056 0.07 0.88 1.0 48 158 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/turns-WP16.txt 644 233 144 2153 12601522402 14337 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct- 0.072 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 5* Junct- 0.173 0.11 0.24 0.2 96 182 main 1
-0.221308 -0.520914 4* Junct 0.071 0.04 0.32 0.2 96 181 main 1
-0.221360 -0.518860 21* Junct 0.228 0.28 0.54 0.5 48 91 bottom road
-0.221711 -0.518511 26* Waypt#2 0.055 0.07 0.60 0.5 48 135 loop 6
-0.221376 -0.518235 29* Junct 0.048 0.06 0.65 0.6 48 39 loop 6
-0.221360 -0.518860 21* Junct 0.069 0.09 0.72 0.7 48 271 bottom road
-0.221308 -0.520914 4* Junct 0.228 0.28 0.94 1.0 48 271 bottom road
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 0.97 1.0 96 181 main 1
routino-3.4.1/src/test/expected/cycle-both-ways-WP01.txt 644 233 144 2176 12601522420 16175 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.221402 -0.520913 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220268 -0.520863 8* Junct 0.125 0.08 0.12 0.1 96 2 main 2
-0.220062 -0.521204 2 Inter 0.044 0.03 0.17 0.1 96 301 roundabout
-0.219665 -0.521190 3 Inter 0.044 0.03 0.21 0.1 96 1 roundabout
-0.219482 -0.520837 9* Junct- 0.044 0.03 0.26 0.2 96 62 roundabout
-0.219692 -0.520509 15* Junct 0.043 0.03 0.30 0.2 96 122 roundabout
-0.219271 -0.519532 17 Inter 0.118 0.15 0.42 0.3 48 66 residential road
-0.219302 -0.518908 20* Junct 0.069 0.09 0.49 0.4 48 92 residential road
-0.220811 -0.518939 19* Junct- 0.167 0.10 0.65 0.5 96 181 main 3
-0.221319 -0.518949 -2 Waypt#2 0.056 0.04 0.71 0.6 96 181 main 3
routino-3.4.1/src/test/expected/dead-ends-WP08.txt 644 233 144 2307 12601522416 15017 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.67 0.8 48 91 high street
-0.220361 -0.515961 25* Waypt#2 0.050 0.06 0.72 0.8 48 22 dead-end 3
-0.220782 -0.516137 24* Junct 0.050 0.06 0.77 0.9 48 202 dead-end 3
-0.220817 -0.514062 32* Junct 0.230 0.29 1.00 1.2 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.05 1.2 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.14 1.3 96 2 main 2
routino-3.4.1/src/test/expected/turns-WP10.txt 644 233 144 5162 12725336146 14353 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218453 -0.520799 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219107 -0.520828 6* Junct 0.072 0.04 0.07 0.0 96 182 main 1
-0.219123 -0.520207 12* Inter 0.069 0.09 0.14 0.1 48 91 top road
-0.219131 -0.519426 20* Inter 0.086 0.11 0.23 0.2 48 90 top road
-0.219135 -0.518823 23* Inter 0.067 0.08 0.29 0.3 48 90 top road
-0.219145 -0.517626 33* Inter 0.133 0.17 0.43 0.5 48 90 top road
-0.219144 -0.517257 36* Junct 0.041 0.05 0.47 0.5 48 89 top road
-0.219291 -0.517193 38 Inter 0.017 0.02 0.48 0.6 48 156 roundabout
-0.219352 -0.517060 42 Junct- 0.016 0.02 0.50 0.6 48 114 roundabout
-0.219304 -0.516904 45 Inter 0.018 0.02 0.52 0.6 48 72 roundabout
-0.219153 -0.516826 46* Junct- 0.018 0.02 0.54 0.6 48 27 roundabout
-0.218966 -0.516910 44 Inter 0.022 0.03 0.56 0.6 48 335 roundabout
-0.218923 -0.517072 39 Junct- 0.018 0.02 0.58 0.7 48 284 roundabout
-0.218998 -0.517207 37 Inter 0.017 0.02 0.59 0.7 48 240 roundabout
-0.219144 -0.517257 36* Junct 0.017 0.02 0.61 0.7 48 199 roundabout
-0.219145 -0.517626 33* Junct 0.041 0.05 0.65 0.8 48 269 top road
-0.219135 -0.518823 23* Junct 0.133 0.17 0.79 0.9 48 270 top road
-0.219131 -0.519426 20* Junct 0.067 0.08 0.85 1.0 48 270 top road
-0.219123 -0.520207 12* Junct 0.086 0.11 0.94 1.1 48 270 top road
-0.218605 -0.520090 -2 Waypt#2 0.059 0.07 1.00 1.2 48 12 loop 4
-0.218474 -0.520060 14* Inter 0.015 0.02 1.01 1.2 48 12 loop 4
-0.218258 -0.519789 16 Inter 0.038 0.05 1.05 1.2 48 51 loop 4
-0.218482 -0.519542 18* Inter 0.037 0.04 1.09 1.3 48 132 loop 4
-0.219131 -0.519426 20* Junct 0.073 0.09 1.16 1.4 48 169 loop 4
-0.219123 -0.520207 12* Junct 0.086 0.11 1.25 1.5 48 270 top road
-0.219107 -0.520828 6* Junct 0.069 0.09 1.31 1.6 48 271 top road
-0.220666 -0.520893 5* Junct- 0.173 0.11 1.49 1.7 96 182 main 1
-0.221308 -0.520914 4* Junct- 0.071 0.04 1.56 1.7 96 181 main 1
-0.221561 -0.520922 -3 Waypt#3 0.027 0.02 1.59 1.7 96 181 main 1
routino-3.4.1/src/test/expected/super-or-not-WP02.txt 644 233 144 1211 12635016670 15537 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216828 -0.519457 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.217245 -0.519637 11* Junct 0.050 0.06 0.05 0.1 48 203 Local road
-0.217248 -0.515206 19* Junct 0.493 0.31 0.54 0.4 96 90 Main road
-0.216919 -0.515308 -2 Waypt#2 0.038 0.05 0.58 0.4 48 342 Local road
routino-3.4.1/src/test/expected/dead-ends-WP07.txt 644 233 144 3025 12601522416 15014 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220296 -0.517634 20* Junct- 0.052 0.07 0.54 0.6 48 21 dead-end 2
-0.219991 -0.517512 21 Inter 0.036 0.04 0.57 0.6 48 21 dead-end 2
-0.219635 -0.517707 -2 Waypt#2 0.045 0.06 0.62 0.7 48 331 dead-end 2
-0.219991 -0.517512 21 Inter 0.045 0.06 0.67 0.7 48 151 dead-end 2
-0.220296 -0.517634 20* Junct- 0.036 0.04 0.70 0.8 48 201 dead-end 2
-0.220739 -0.517804 18* Junct 0.052 0.07 0.75 0.9 48 201 dead-end 2
-0.220782 -0.516137 24* Junct 0.185 0.23 0.94 1.1 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.17 1.4 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.22 1.4 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.31 1.5 96 2 main 2
routino-3.4.1/src/test/expected/dead-ends-WP11.txt 644 233 144 3273 12601522415 15013 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 0.67 0.8 48 91 high street
-0.220361 -0.515961 25* Junct- 0.050 0.06 0.72 0.8 48 22 dead-end 3
-0.220019 -0.515847 26 Inter 0.040 0.05 0.76 0.9 48 18 dead-end 3
-0.219341 -0.516206 23 Inter 0.085 0.10 0.85 1.0 48 332 dead-end 3
-0.218493 -0.515789 27* Waypt#2 0.105 0.13 0.95 1.1 48 26 dead-end 3
-0.219341 -0.516206 23 Inter 0.105 0.13 1.06 1.2 48 206 dead-end 3
-0.220019 -0.515847 26 Inter 0.085 0.10 1.14 1.3 48 152 dead-end 3
-0.220361 -0.515961 25* Junct- 0.040 0.05 1.18 1.4 48 198 dead-end 3
-0.220782 -0.516137 24* Junct 0.050 0.06 1.23 1.5 48 202 dead-end 3
-0.220817 -0.514062 32* Junct 0.230 0.29 1.46 1.7 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.51 1.8 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.60 1.8 96 2 main 2
routino-3.4.1/src/test/expected/roundabout-waypoints-WP07.txt 644 233 144 1454 12601522406 17410 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Waypt#2 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt#3 0.143 0.09 0.39 0.2 96 182 main 2
routino-3.4.1/src/test/expected/no-super-WP03.txt 644 233 144 1547 12601522412 14737 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217185 -0.519054 5 Waypt#1 0.000 0.00 0.00 0.0
-0.217382 -0.518273 8 Inter 0.089 0.11 0.09 0.1 48 104 road3
-0.217219 -0.517733 11 Inter 0.062 0.08 0.15 0.2 48 73 road3
-0.217399 -0.516857 14 Inter 0.099 0.12 0.25 0.3 48 101 road3
-0.217202 -0.515964 17 Waypt#2 0.101 0.12 0.35 0.4 48 77 road3
-0.217399 -0.516857 14 Inter 0.101 0.12 0.45 0.6 48 257 road3
-0.217219 -0.517733 11 Waypt#3 0.099 0.12 0.55 0.7 48 281 road3
routino-3.4.1/src/test/expected/coincident-waypoint-WP01.txt 644 233 144 1442 12601522420 17145 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216904 -0.520770 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.217286 -0.520780 7 Junct- 0.042 0.03 0.04 0.0 96 181 main 1
-0.217741 -0.520789 -2 Waypt#2 0.050 0.03 0.09 0.1 96 181 main 1
-0.217741 -0.520789 -3 Waypt#3 0.000 0.00 0.09 0.1 96 270 main 1
-0.218523 -0.520806 6 Junct- 0.086 0.05 0.18 0.1 96 181 main 1
-0.219080 -0.520824 -4 Waypt#4 0.061 0.04 0.24 0.1 96 181 main 1
routino-3.4.1/src/test/expected/loop-and-reverse-WP-LR.txt 644 233 144 1713 12606772160 16530 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219526 -0.521010 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.218820 -0.520980 5* Junct 0.078 0.05 0.08 0.0 96 2 main 1
-0.218970 -0.513986 15* Junct 0.778 0.97 0.86 1.0 48 91 high street
-0.219540 -0.514010 -3 Waypt#3 0.063 0.04 0.92 1.1 96 182 main 2
-0.220817 -0.514062 14* Junct 0.141 0.09 1.06 1.1 96 182 main 2
-0.220749 -0.517228 -2 Waypt#2 0.352 0.44 1.41 1.6 48 271 low street
-0.220666 -0.521060 4* Junct 0.426 0.53 1.84 2.1 48 271 low street
-0.219526 -0.521010 -1 Waypt#1 0.126 0.08 1.96 2.2 96 2 main 1
routino-3.4.1/src/test/expected/roundabout-waypoints-WP01.txt 644 233 144 1454 12601522407 17403 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Waypt#2 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Junct- 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt#3 0.143 0.09 0.39 0.2 96 182 main 2
routino-3.4.1/src/test/expected/dead-ends-WP04.txt 644 233 144 3273 12601522416 15016 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220263 -0.519309 13* Junct- 0.052 0.07 0.35 0.4 48 21 dead-end 1
-0.219924 -0.519179 14 Inter 0.040 0.05 0.39 0.4 48 20 dead-end 1
-0.219235 -0.519555 11 Inter 0.087 0.11 0.48 0.5 48 331 dead-end 1
-0.218387 -0.519137 15 Waypt#2 0.105 0.13 0.58 0.7 48 26 dead-end 1
-0.219235 -0.519555 11 Inter 0.105 0.13 0.69 0.8 48 206 dead-end 1
-0.219924 -0.519179 14 Inter 0.087 0.11 0.78 0.9 48 151 dead-end 1
-0.220263 -0.519309 13* Junct- 0.040 0.05 0.82 0.9 48 200 dead-end 1
-0.220702 -0.519478 12* Junct 0.052 0.07 0.87 1.0 48 201 dead-end 1
-0.220739 -0.517804 18* Junct 0.186 0.23 1.05 1.2 48 91 high street
-0.220782 -0.516137 24* Junct 0.185 0.23 1.24 1.5 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.47 1.8 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.52 1.8 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.61 1.8 96 2 main 2
routino-3.4.1/src/test/expected/dead-ends-WP05.txt 644 233 144 2307 12601522416 15014 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219535 -0.521016 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.521052 5* Junct- 0.076 0.05 0.08 0.0 96 182 main 1
-0.220666 -0.521060 4* Junct 0.049 0.03 0.12 0.1 96 180 main 1
-0.220702 -0.519478 12* Junct 0.176 0.22 0.30 0.3 48 91 high street
-0.220739 -0.517804 18* Junct 0.186 0.23 0.49 0.5 48 91 high street
-0.220296 -0.517634 20* Waypt#2 0.052 0.07 0.54 0.6 48 21 dead-end 2
-0.220739 -0.517804 18* Junct 0.052 0.07 0.59 0.7 48 201 dead-end 2
-0.220782 -0.516137 24* Junct 0.185 0.23 0.78 0.9 48 91 high street
-0.220817 -0.514062 32* Junct 0.230 0.29 1.01 1.2 48 90 high street
-0.220344 -0.514042 33* Junct- 0.052 0.03 1.06 1.2 96 2 main 2
-0.219539 -0.514007 -3 Waypt#3 0.089 0.06 1.15 1.3 96 2 main 2
routino-3.4.1/src/test/expected/node-restrictions-WP04.txt 644 233 144 3416 12601522522 16642 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219564 -0.520846 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220666 -0.520893 4* Junct 0.122 0.07 0.12 0.1 96 182 main 1
-0.220682 -0.520141 9* Junct 0.083 0.08 0.20 0.2 64 91 high street
-0.220695 -0.519489 12* Change 0.072 0.07 0.28 0.2 64 91 high street
-0.220140 -0.519342 14 Inter 0.063 0.08 0.34 0.3 48 14 nopass road
-0.220173 -0.518597 20 Waypt#2 0.082 0.10 0.42 0.4 48 92 nopass road
-0.220140 -0.519342 14 Inter 0.082 0.10 0.50 0.5 48 272 nopass road
-0.220695 -0.519489 12* Junct 0.063 0.08 0.57 0.6 48 194 nopass road
-0.220694 -0.519227 15 Inter 0.029 0.04 0.60 0.6 48 89 long road
-0.220386 -0.519076 16 Inter 0.038 0.05 0.63 0.7 48 26 long road
-0.220961 -0.518928 17 Inter 0.066 0.08 0.70 0.7 48 165 long road
-0.220427 -0.518622 18 Inter 0.068 0.09 0.77 0.8 48 29 long road
-0.220949 -0.518422 21 Inter 0.062 0.08 0.83 0.9 48 159 long road
-0.220455 -0.518238 22 Inter 0.058 0.07 0.89 1.0 48 20 long road
-0.220746 -0.518070 23 Inter 0.037 0.04 0.93 1.0 48 149 long road
-0.220739 -0.517801 26* Junct 0.029 0.04 0.95 1.1 48 88 long road
-0.220784 -0.516035 31* Junct 0.196 0.18 1.15 1.2 64 91 high street
-0.219593 -0.515985 -3 Waypt#3 0.132 0.08 1.28 1.3 96 2 main 2
routino-3.4.1/src/test/expected/roundabout-waypoints-WP03.txt 644 233 144 1453 12601522407 17404 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.218454 -0.520798 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.219482 -0.520837 9* Junct 0.113 0.07 0.11 0.1 96 182 main 1
-0.219692 -0.520509 15 Waypt#2 0.043 0.03 0.16 0.1 96 122 roundabout
-0.220082 -0.520522 14 Junct- 0.043 0.03 0.20 0.1 96 181 roundabout
-0.220268 -0.520863 8* Junct 0.043 0.03 0.24 0.1 96 241 roundabout
-0.221566 -0.520921 -3 Waypt#3 0.143 0.09 0.39 0.2 96 182 main 2
routino-3.4.1/src/test/expected/loops-WP02.txt 644 233 144 3345 12601522414 14322 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220280 -0.519256 15* Junct- 0.052 0.07 0.33 0.3 48 29 loop 1
-0.219910 -0.519112 17 Waypt#2 0.044 0.06 0.37 0.4 48 21 loop 1
-0.219237 -0.519286 13* Junct 0.077 0.10 0.45 0.5 48 345 loop 1
-0.218764 -0.519471 12 Inter 0.056 0.07 0.51 0.6 48 338 loop 1
-0.218380 -0.519134 16 Inter 0.056 0.07 0.56 0.6 48 41 loop 1
-0.218776 -0.518838 18 Inter 0.055 0.07 0.62 0.7 48 143 loop 1
-0.219237 -0.519286 13* Junct 0.071 0.09 0.69 0.8 48 224 loop 1
-0.219910 -0.519112 17 Inter 0.077 0.10 0.77 0.9 48 165 loop 1
-0.220280 -0.519256 15* Junct- 0.044 0.06 0.81 0.9 48 201 loop 1
-0.220695 -0.519489 11* Junct 0.052 0.07 0.86 1.0 48 209 loop 1
-0.220739 -0.517801 19* Junct 0.187 0.23 1.05 1.2 48 91 high street
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/fake-node-with-loop-WP02.txt 644 233 144 2426 12601522415 16737 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.216959 -0.520771 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.217286 -0.520780 10 Junct- 0.036 0.02 0.04 0.0 96 181 main 1
-0.218523 -0.520806 9 Junct- 0.137 0.09 0.17 0.1 96 181 main 1
-0.219171 -0.520827 -2 Waypt#2 0.071 0.04 0.24 0.1 96 181 main 1
-0.219482 -0.520837 8* Junct 0.034 0.02 0.28 0.2 96 181 main 1
-0.219692 -0.520509 14 Junct- 0.043 0.03 0.32 0.2 96 122 roundabout
-0.220082 -0.520522 13 Junct- 0.043 0.03 0.36 0.2 96 181 roundabout
-0.220268 -0.520863 7 Inter 0.043 0.03 0.41 0.2 96 241 roundabout
-0.220062 -0.521204 4 Junct- 0.044 0.03 0.45 0.3 96 301 roundabout
-0.219665 -0.521190 5 Junct- 0.044 0.03 0.49 0.3 96 1 roundabout
-0.219482 -0.520837 8* Junct 0.044 0.03 0.54 0.3 96 62 roundabout
-0.218842 -0.520816 -3 Waypt#3 0.070 0.04 0.61 0.4 96 1 main 1
routino-3.4.1/src/test/expected/loops-WP06.txt 644 233 144 3345 12601522413 14325 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.219562 -0.520851 -1 Waypt#1 0.000 0.00 0.00 0.0
-0.220223 -0.520885 5* Junct- 0.073 0.04 0.07 0.0 96 182 main 1
-0.220666 -0.520893 4* Junct 0.049 0.03 0.12 0.1 96 181 main 1
-0.220695 -0.519489 11* Junct 0.156 0.20 0.28 0.3 48 91 high street
-0.220739 -0.517801 19* Junct 0.187 0.23 0.47 0.5 48 91 high street
-0.220301 -0.517576 22* Waypt#2 0.054 0.07 0.52 0.6 48 27 loop 2
-0.219946 -0.517397 24 Inter 0.044 0.06 0.56 0.6 48 26 loop 2
-0.219266 -0.517579 21* Junct 0.078 0.10 0.64 0.7 48 345 loop 2
-0.218794 -0.517763 20 Inter 0.056 0.07 0.70 0.8 48 338 loop 2
-0.218417 -0.517462 23* Junct- 0.053 0.07 0.75 0.9 48 38 loop 2
-0.218805 -0.517131 25 Inter 0.056 0.07 0.81 0.9 48 139 loop 2
-0.219266 -0.517579 21* Junct 0.071 0.09 0.88 1.0 48 224 loop 2
-0.219946 -0.517397 24 Inter 0.078 0.10 0.95 1.1 48 165 loop 2
-0.220301 -0.517576 22* Junct- 0.044 0.06 1.00 1.2 48 206 loop 2
-0.220739 -0.517801 19* Junct 0.054 0.07 1.05 1.2 48 207 loop 2
-0.220784 -0.516035 30* Junct 0.196 0.24 1.25 1.5 48 91 high street
-0.220311 -0.516015 31* Junct- 0.052 0.03 1.30 1.5 96 2 main 2
-0.219596 -0.515984 -3 Waypt#3 0.079 0.05 1.38 1.6 96 2 main 2
routino-3.4.1/src/test/expected/super-or-not-WP03.txt 644 233 144 1212 12635016730 15536 0 # Creator : Routino - http://www.routino.org/
# Source : Routino test cases - (c) Andrew M. Bishop
# License : GNU Affero General Public License v3 or later
#
#Latitude Longitude Node Type Segment Segment Total Total Speed Bearing Highway
# Dist Durat'n Dist Durat'n
-0.217245 -0.519637 11* Waypt#1 0.000 0.00 0.00 0.0
-0.215919 -0.519064 12 Inter 0.160 0.20 0.16 0.2 48 23 Local road
-0.216435 -0.518515 13 Inter 0.083 0.10 0.24 0.3 48 133 Local road
-0.215866 -0.517931 14 Waypt#2 0.090 0.11 0.33 0.4 48 45 Local road
routino-3.4.1/src/test/oneway-loop.osm 644 233 144 10263 12114366272 13153 0
routino-3.4.1/src/test/no-super.sh 777 233 144 0 12064636362 13400 2a-b-c.sh routino-3.4.1/src/test/prune-short.osm 644 233 144 65656 12114416166 13206 0
routino-3.4.1/src/test/invalid-turn-relations.osm 644 233 144 22476 12105426741 15323 0
routino-3.4.1/src/test/sanitizer-suppressions.txt 644 233 144 16 13452410542 15415 0 leak:FileName
routino-3.4.1/src/test/prune-straight.sh 777 233 144 0 12114436047 16031 2only-split.sh routino-3.4.1/src/test/dead-ends.sh 777 233 144 0 12064636362 15346 2start-1-finish.sh routino-3.4.1/src/test/loops.osm 644 233 144 16247 12064636362 12052 0
routino-3.4.1/src/test/only-split.sh 755 233 144 752 13364652324 12601 0 #!/bin/sh
# Pruned or non-pruned - special case
if [ "$2" = "prune" ]; then
case $name in
prune-isolated) prune="--prune-none --prune-isolated=100";;
prune-short) prune="--prune-none --prune-short=5";;
prune-straight) prune="--prune-none --prune-straight=5";;
*) prune="";;
esac
pruned="-pruned"
else
prune="--prune-none"
pruned=""
fi
# Run planetsplitter
run_planetsplitter $prune
# Run filedumper
run_filedumper
routino-3.4.1/src/test/roundabout-waypoints.sh 777 233 144 0 12317323573 17735 2start-1-finish.sh routino-3.4.1/src/test/fake-node-with-loop.osm 644 233 144 10546 12327506445 14463 0
routino-3.4.1/src/test/fake-node-with-loop.sh 777 233 144 0 12326742550 15377 2a-b-c.sh routino-3.4.1/src/test/prune-straight.osm 644 233 144 20500 12327506436 13655 0
routino-3.4.1/src/test/a-b.sh 755 233 144 1004 13364652304 11133 0 #!/bin/sh
# Run planetsplitter
run_planetsplitter
# Run filedumper
run_filedumper
# Waypoints
waypoints=`run_waypoints $osm list`
# Run the router for each waypoint
for waypoint in $waypoints; do
case $waypoint in
*a) waypoint=`echo $waypoint | sed -e 's%a$%%'` ;;
*) continue ;;
esac
echo "Running router : $waypoint"
waypoint_a=`run_waypoints $osm ${waypoint}a 1`
waypoint_b=`run_waypoints $osm ${waypoint}b 2`
run_router $waypoint $waypoint_a $waypoint_b
done
routino-3.4.1/src/test/cycle-both-ways.osm 644 233 144 10655 12327513605 13721 0
routino-3.4.1/src/test/coincident-waypoint.osm 644 233 144 10700 12333376606 14672 0
routino-3.4.1/src/test/Makefile 644 233 144 2723 13454404165 11606 0 # Test cases Makefile
#
# Part of the Routino routing software.
#
# This file Copyright 2011-2015, 2018 Andrew M. Bishop
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
#
# All configuration is in the top-level Makefile.conf
include ../../Makefile.conf
# Executables
EXE=is-fast-math$(.EXE)
########
all :
########
test : test-exe $(EXE)
@./run-all-tests.sh
########
test-exe :
cd .. && $(MAKE) all-exe all-lib
is-fast-math$(.EXE) : is-fast-math.o
$(LD) $< -o $@ $(LDFLAGS)
is-fast-math.o : is-fast-math.c
$(CC) -c $(CFLAGS) $< -o $@
########
install:
########
clean:
rm -rf fat
rm -rf slim
rm -rf fat+lib
rm -rf slim+lib
rm -rf fat-pruned
rm -rf slim-pruned
rm -f *.log
rm -f *~
rm -f *.o
rm -f $(EXE)
rm -f core
rm -f *.gcda *.gcno *.gcov gmon.out
########
distclean: clean
########
.PHONY:: all test install clean distclean
.PHONY:: test-exe
routino-3.4.1/src/test/start-1-finish.sh 755 233 144 1061 13364652340 13250 0 #!/bin/sh
# Run planetsplitter
run_planetsplitter
# Run filedumper
run_filedumper
# Waypoints
waypoints=`run_waypoints $osm list`
waypoint_start=`run_waypoints $osm WPstart 1`
waypoint_finish=`run_waypoints $osm WPfinish 3`
# Run the router for each waypoint
for waypoint in $waypoints; do
[ ! $waypoint = "WPstart" ] || continue
[ ! $waypoint = "WPfinish" ] || continue
echo "Running router : $waypoint"
waypoint_test=`run_waypoints $osm $waypoint 2`
run_router $waypoint $waypoint_start $waypoint_test $waypoint_finish
done
routino-3.4.1/src/test/run-all-tests.sh 755 233 144 3656 13364652727 13236 0 #!/bin/sh
# Run with a debugger or not?
debugger=valgrind
debugger=
TEST_DEBUGGER=$debugger
export TEST_DEBUGGER
# Overall status
status=true
# Functions for running tests
run_a_test ()
{
script=$1
shift
if ./run-one-test.sh $script $@ ; then
echo "... passed"
else
echo "... FAILED"
status=false
fi
}
compare_results ()
{
if diff -q -r $1 $2; then
echo "... matched"
else
echo "... match FAILED"
status=false
fi
}
# Initial informational message
echo ""
./is-fast-math message
# Get the list of tests
scripts=`echo *.osm | sed -e s/.osm/.sh/g`
# Loop round the different test types
for type in 1 2 3; do
case $type in
1)
suffix=""
arg=""
description=""
;;
2)
suffix="+lib"
arg="lib"
description="libroutino"
;;
3)
suffix="-pruned"
arg="prune"
description="pruned"
;;
esac
# Run the script (non-slim mode)
for script in $scripts; do
echo ""
echo "Testing: $script (non-slim, $description) ... "
run_a_test $script fat $arg
done
# Run the script (slim mode)
for script in $scripts; do
echo ""
echo "Testing: $script (slim, $description) ... "
run_a_test $script slim $arg
done
# Check results
if $status; then
echo "Success: all tests passed"
else
echo "Warning: Some tests FAILED"
exit 1
fi
# Compare normal/slim results
echo ""
echo "Comparing: slim and non-slim results ($description) ... "
compare_results fat$suffix slim$suffix
# Check comparison
if $status; then
echo "Success: slim and non-slim results match"
else
echo "Warning: slim and non-slim results are different"
exit 1
fi
done
# Finish
exit 0
routino-3.4.1/src/test/super-or-not.osm 644 233 144 7676 12635017361 13252 0
routino-3.4.1/src/test/turns.osm 644 233 144 43517 12064636362 12071 0
routino-3.4.1/src/test/waypoints.pl 755 233 144 3443 12306670127 12541 0 #!/usr/bin/perl
#
# Routing test case generator tool.
#
# Part of the Routino routing software.
#
# This file Copyright 2011-2014 Andrew M. Bishop
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
#
use strict;
# Command line
if($#ARGV<1 || $ARGV>2 || ! -f $ARGV[0])
{
die "Usage: waypoints.pl list\n".
" waypoints.pl \n";
}
# Parse the file
open(FILE,"<$ARGV[0]") || die "Cannot open '$ARGV[0]'\n";
my %waypoints=();
my @waypoints=();
my @waypoint_lat=();
my @waypoint_lon=();
my $innode=0;
while()
{
if($innode)
{
if(m%%);
}
elsif(m%%)
{
$innode=1;
push(@waypoint_lat,$1);
push(@waypoint_lon,$2);
}
}
close(FILE);
# Perform the action
if($ARGV[1] eq "list")
{
print join(" ",sort @waypoints)."\n";
exit 0;
}
if($waypoints{$ARGV[1]} ne "")
{
print "--lat$ARGV[2]=$waypoint_lat[$waypoints{$ARGV[1]}] --lon$ARGV[2]=$waypoint_lon[$waypoints{$ARGV[1]}]\n";
exit 0;
}
exit 1;
routino-3.4.1/src/test/cycle-drive.sh 755 233 144 1052 13364652311 12703 0 #!/bin/sh
# Run planetsplitter
run_planetsplitter
# Run filedumper
run_filedumper
# Waypoints
waypoints=`run_waypoints $osm list`
waypoint_start=`run_waypoints $osm WPstart 1`
waypoint_finish=`run_waypoints $osm WPfinish 2`
# Run the router for each profile type
profiles="motorcar bicycle"
for profile in $profiles; do
case $profile in
motorcar) waypoint=WP01 ;;
*) waypoint=WP02 ;;
esac
echo "Running router : $waypoint"
run_router $waypoint --profile=$profile $waypoint_start $waypoint_finish
done
routino-3.4.1/src/test/cycle-both-ways.sh 777 233 144 0 12327512664 16171 2cycle-drive.sh routino-3.4.1/src/test/node-restrictions.osm 644 233 144 16636 12114366273 14370 0
routino-3.4.1/src/test/copyright.xml 644 233 144 2406 12563645242 12701 0
routino-3.4.1/src/test/invalid-turn-relations.sh 777 233 144 0 12064636362 17475 2only-split.sh routino-3.4.1/src/filedumper.c 644 233 144 133644 13713767721 11546 0 /***************************************
Memory file dumper.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015, 2018, 2019, 2020 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include
#include
#include
#include
#include "version.h"
#include "types.h"
#include "nodes.h"
#include "segments.h"
#include "ways.h"
#include "relations.h"
#include "errorlog.h"
#include "files.h"
#include "visualiser.h"
#include "xmlparse.h"
/* Local functions */
static void print_node(Nodes *nodes,index_t item);
static void print_segment(Segments *segments,index_t item);
static void print_way(Ways *ways,index_t item);
static void print_turn_relation(Relations *relations,index_t item,Segments *segments,Nodes *nodes);
static void print_errorlog(ErrorLogs *errorlogs,index_t item);
static void print_head_osm(int coordcount,double latmin,double latmax,double lonmin,double lonmax);
static void print_region_osm(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,
double latmin,double latmax,double lonmin,double lonmax,int option_no_super);
static void print_node_osm(Nodes *nodes,index_t item);
static void print_segment_osm(Segments *segments,index_t item,Ways *ways);
static void print_turn_relation_osm(Relations *relations,index_t item,Segments *segments,Nodes *nodes);
static void print_tail_osm(void);
static void print_node_visualiser(Nodes *nodes,index_t item);
static void print_segment_visualiser(Segments *segments,index_t item,Ways *ways);
static void print_turn_relation_visualiser(Relations *relations,index_t item,Segments *segments,Nodes *nodes);
static void print_errorlog_visualiser(ErrorLogs *errorlogs,index_t item);
static char *RFC822Date(time_t t);
static void print_usage(int detail,const char *argerr,const char *err);
/*++++++++++++++++++++++++++++++++++++++
The main program for the file dumper.
++++++++++++++++++++++++++++++++++++++*/
int main(int argc,char** argv)
{
Nodes *OSMNodes;
Segments *OSMSegments;
Ways *OSMWays;
Relations*OSMRelations;
ErrorLogs*OSMErrorLogs=NULL;
int arg;
char *dirname=NULL,*prefix=NULL;
char *nodes_filename,*segments_filename,*ways_filename,*relations_filename,*errorlogs_filename;
int option_statistics=0;
int option_visualiser=0,coordcount=0;
double latmin=0,latmax=0,lonmin=0,lonmax=0;
char *option_data=NULL;
int option_dump=0;
int option_dump_osm=0,option_no_super=0;
int option_dump_visualiser=0;
/* Parse the command line arguments */
for(arg=1;argfile.number);
printf("Number(super)=%9"Pindex_t"\n",OSMNodes->file.snumber);
printf("\n");
printf("Lat bins= %4d\n",(int)OSMNodes->file.latbins);
printf("Lon bins= %4d\n",(int)OSMNodes->file.lonbins);
printf("\n");
printf("Lat zero=%5d (%8.4f deg)\n",(int)OSMNodes->file.latzero,radians_to_degrees(latlong_to_radians(bin_to_latlong(OSMNodes->file.latzero))));
printf("Lon zero=%5d (%8.4f deg)\n",(int)OSMNodes->file.lonzero,radians_to_degrees(latlong_to_radians(bin_to_latlong(OSMNodes->file.lonzero))));
/* Examine the segments */
printf("\n");
printf("Segments\n");
printf("--------\n");
printf("\n");
printf("sizeof(Segment)=%9zu Bytes\n",sizeof(Segment));
printf("Number(total) =%9"Pindex_t"\n",OSMSegments->file.number);
printf("Number(super) =%9"Pindex_t"\n",OSMSegments->file.snumber);
printf("Number(normal) =%9"Pindex_t"\n",OSMSegments->file.nnumber);
/* Examine the ways */
printf("\n");
printf("Ways\n");
printf("----\n");
printf("\n");
printf("sizeof(Way)=%9zu Bytes\n",sizeof(Way));
printf("Number =%9"Pindex_t"\n",OSMWays->file.number);
printf("\n");
stat(ways_filename,&buf);
printf("Total names=%9zu Bytes\n",(size_t)buf.st_size-sizeof(Ways)-OSMWays->file.number*sizeof(Way));
printf("\n");
printf("Included highways : %s\n",HighwaysNameList(OSMWays->file.highways));
printf("Included transports: %s\n",TransportsNameList(OSMWays->file.transports));
printf("Included properties: %s\n",PropertiesNameList(OSMWays->file.properties));
/* Examine the relations */
printf("\n");
printf("Relations\n");
printf("---------\n");
printf("\n");
printf("sizeof(TurnRelation)=%9zu Bytes\n",sizeof(TurnRelation));
printf("Number =%9"Pindex_t"\n",OSMRelations->file.trnumber);
if(errorlogs_filename)
{
printf("\n");
printf("Error Logs\n");
printf("----------\n");
printf("\n");
printf("Number(total) =%9"Pindex_t"\n",OSMErrorLogs->file.number);
printf("Number(geographical) =%9"Pindex_t"\n",OSMErrorLogs->file.number_geo);
printf("Number(non-geographical)=%9"Pindex_t"\n",OSMErrorLogs->file.number_nongeo);
printf("\n");
stat(errorlogs_filename,&buf);
#if !SLIM
printf("Total strings=%9zu Bytes\n",(size_t)buf.st_size-(OSMErrorLogs->strings-(char*)OSMErrorLogs->data));
#else
printf("Total strings=%9zu Bytes\n",(size_t)buf.st_size-(size_t)OSMErrorLogs->stringsoffset);
#endif
}
}
/* Print out internal data (in plain text format) */
if(option_dump)
{
index_t item;
for(arg=1;argfile.number;item++)
print_node(OSMNodes,item);
}
else if(!strncmp(argv[arg],"--node=",7))
{
item=atoi(&argv[arg][7]);
if(itemfile.number)
print_node(OSMNodes,item);
else
printf("Invalid node number; minimum=0, maximum=%"Pindex_t".\n",OSMNodes->file.number-1);
}
else if(!strcmp(argv[arg],"--segment=all"))
{
for(item=0;itemfile.number;item++)
print_segment(OSMSegments,item);
}
else if(!strncmp(argv[arg],"--segment=",10))
{
item=atoi(&argv[arg][10]);
if(itemfile.number)
print_segment(OSMSegments,item);
else
printf("Invalid segment number; minimum=0, maximum=%"Pindex_t".\n",OSMSegments->file.number-1);
}
else if(!strcmp(argv[arg],"--way=all"))
{
for(item=0;itemfile.number;item++)
print_way(OSMWays,item);
}
else if(!strncmp(argv[arg],"--way=",6))
{
item=atoi(&argv[arg][6]);
if(itemfile.number)
print_way(OSMWays,item);
else
printf("Invalid way number; minimum=0, maximum=%"Pindex_t".\n",OSMWays->file.number-1);
}
else if(!strcmp(argv[arg],"--turn-relation=all"))
{
for(item=0;itemfile.trnumber;item++)
print_turn_relation(OSMRelations,item,OSMSegments,OSMNodes);
}
else if(!strncmp(argv[arg],"--turn-relation=",16))
{
item=atoi(&argv[arg][16]);
if(itemfile.trnumber)
print_turn_relation(OSMRelations,item,OSMSegments,OSMNodes);
else
printf("Invalid turn relation number; minimum=0, maximum=%"Pindex_t".\n",OSMRelations->file.trnumber-1);
}
else if(!strcmp(argv[arg],"--errorlog=all"))
{
for(item=0;itemfile.number;item++)
print_errorlog(OSMErrorLogs,item);
}
else if(!strncmp(argv[arg],"--errorlog=",11))
{
item=atoi(&argv[arg][11]);
if(itemfile.number)
print_errorlog(OSMErrorLogs,item);
else
printf("Invalid error log number; minimum=0, maximum=%"Pindex_t".\n",OSMErrorLogs->file.number-1);
}
}
/* Print out internal data (in OSM XML format) */
if(option_dump_osm)
{
if(coordcount>0 && coordcount!=4)
print_usage(0,NULL,"The --dump-osm option must have all of --latmin, --latmax, --lonmin, --lonmax or none.\n");
print_head_osm(coordcount,latmin,latmax,lonmin,lonmax);
if(coordcount)
print_region_osm(OSMNodes,OSMSegments,OSMWays,OSMRelations,latmin,latmax,lonmin,lonmax,option_no_super);
else
{
index_t item;
for(item=0;itemfile.number;item++)
print_node_osm(OSMNodes,item);
for(item=0;itemfile.number;item++)
if(!option_no_super || IsNormalSegment(LookupSegment(OSMSegments,item,1)))
print_segment_osm(OSMSegments,item,OSMWays);
for(item=0;itemfile.trnumber;item++)
print_turn_relation_osm(OSMRelations,item,OSMSegments,OSMNodes);
}
print_tail_osm();
}
/* Print out internal data (in HTML format for the visualiser) */
if(option_dump_visualiser)
{
index_t item;
if(!option_data)
print_usage(0,NULL,"The --dump-visualiser option must have --data.\n");
for(arg=1;argfile.number)
print_node_visualiser(OSMNodes,item);
else
printf("Invalid node number; minimum=0, maximum=%"Pindex_t".\n",OSMNodes->file.number-1);
}
else if(!strncmp(argv[arg],"--data=segment",14))
{
item=atoi(&argv[arg][14]);
if(itemfile.number)
print_segment_visualiser(OSMSegments,item,OSMWays);
else
printf("Invalid segment number; minimum=0, maximum=%"Pindex_t".\n",OSMSegments->file.number-1);
}
else if(!strncmp(argv[arg],"--data=turn-relation",20))
{
item=atoi(&argv[arg][20]);
if(itemfile.trnumber)
print_turn_relation_visualiser(OSMRelations,item,OSMSegments,OSMNodes);
else
printf("Invalid turn relation number; minimum=0, maximum=%"Pindex_t".\n",OSMRelations->file.trnumber-1);
}
else if(!strncmp(argv[arg],"--data=errorlog",15))
{
item=atoi(&argv[arg][15]);
if(itemfile.number)
print_errorlog_visualiser(OSMErrorLogs,item);
else
printf("Invalid error log number; minimum=0, maximum=%"Pindex_t".\n",OSMErrorLogs->file.number-1);
}
}
exit(EXIT_SUCCESS);
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a node from the routing database (as plain text).
Nodes *nodes The set of nodes to use.
index_t item The node index to print.
++++++++++++++++++++++++++++++++++++++*/
static void print_node(Nodes *nodes,index_t item)
{
Node *nodep=LookupNode(nodes,item,1);
double latitude,longitude;
GetLatLong(nodes,item,nodep,&latitude,&longitude);
printf("Node %"Pindex_t"\n",item);
printf(" firstseg=%"Pindex_t"\n",nodep->firstseg);
printf(" latoffset=%d lonoffset=%d (latitude=%.6f longitude=%.6f)\n",nodep->latoffset,nodep->lonoffset,radians_to_degrees(latitude),radians_to_degrees(longitude));
printf(" allow=%03x (%s)\n",nodep->allow,TransportsNameList(nodep->allow));
if(IsSuperNode(nodep))
printf(" Super-Node\n");
if(nodep->flags & NODE_MINIRNDBT)
printf(" Mini-roundabout\n");
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a segment from the routing database (as plain text).
Segments *segments The set of segments to use.
index_t item The segment index to print.
++++++++++++++++++++++++++++++++++++++*/
static void print_segment(Segments *segments,index_t item)
{
Segment *segmentp=LookupSegment(segments,item,1);
printf("Segment %"Pindex_t"\n",item);
printf(" node1=%"Pindex_t" node2=%"Pindex_t"\n",segmentp->node1,segmentp->node2);
printf(" next2=%"Pindex_t"\n",segmentp->next2);
printf(" way=%"Pindex_t"\n",segmentp->way);
printf(" distance=%d (%.3f km)\n",DISTANCE(segmentp->distance),distance_to_km(DISTANCE(segmentp->distance)));
if(IsSuperSegment(segmentp) && IsNormalSegment(segmentp))
printf(" Super-Segment AND normal Segment\n");
else if(IsSuperSegment(segmentp) && !IsNormalSegment(segmentp))
printf(" Super-Segment\n");
if(IsOnewayTo(segmentp,segmentp->node1))
printf(" One-Way from node2 to node1\n");
if(IsOnewayTo(segmentp,segmentp->node2))
printf(" One-Way from node1 to node2\n");
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a way from the routing database (as plain text).
Ways *ways The set of ways to use.
index_t item The way index to print.
++++++++++++++++++++++++++++++++++++++*/
static void print_way(Ways *ways,index_t item)
{
Way *wayp=LookupWay(ways,item,1);
char *name=WayName(ways,wayp);
printf("Way %"Pindex_t"\n",item);
if(*name)
printf(" name=%s\n",name);
printf(" type=%03x (%s%s%s%s)\n",wayp->type,
HighwayName(HIGHWAY(wayp->type)),
wayp->type&Highway_OneWay?",One-Way":"",
wayp->type&Highway_CycleBothWays?",Cycle-Both-Ways":"",
wayp->type&Highway_Roundabout?",Roundabout":"");
printf(" allow=%03x (%s)\n",wayp->allow,TransportsNameList(wayp->allow));
if(wayp->props)
printf(" props=%02x (%s)\n",wayp->props,PropertiesNameList(wayp->props));
if(wayp->speed)
printf(" speed=%d (%d km/hr)\n",wayp->speed,speed_to_kph(wayp->speed));
if(wayp->weight)
printf(" weight=%d (%.1f tonnes)\n",wayp->weight,weight_to_tonnes(wayp->weight));
if(wayp->height)
printf(" height=%d (%.1f m)\n",wayp->height,height_to_metres(wayp->height));
if(wayp->width)
printf(" width=%d (%.1f m)\n",wayp->width,width_to_metres(wayp->width));
if(wayp->length)
printf(" length=%d (%.1f m)\n",wayp->length,length_to_metres(wayp->length));
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a turn relation from the routing database (as plain text).
Relations *relations The set of relations to use.
index_t item The turn relation index to print.
Segments *segments The set of segments to use.
Nodes *nodes The set of nodes to use.
++++++++++++++++++++++++++++++++++++++*/
static void print_turn_relation(Relations *relations,index_t item,Segments *segments,Nodes *nodes)
{
Segment *segmentp;
TurnRelation *relationp=LookupTurnRelation(relations,item,1);
Node *nodep=LookupNode(nodes,relationp->via,1);
index_t from_way=NO_WAY,to_way=NO_WAY;
index_t from_node=NO_NODE,to_node=NO_NODE;
segmentp=FirstSegment(segments,nodep,1);
do
{
index_t seg=IndexSegment(segments,segmentp);
if(seg==relationp->from)
{
from_node=OtherNode(segmentp,relationp->via);
from_way=segmentp->way;
}
if(seg==relationp->to)
{
to_node=OtherNode(segmentp,relationp->via);
to_way=segmentp->way;
}
segmentp=NextSegment(segments,segmentp,relationp->via);
}
while(segmentp);
printf("Relation %"Pindex_t"\n",item);
printf(" from=%"Pindex_t" (segment) = %"Pindex_t" (way) = %"Pindex_t" (node)\n",relationp->from,from_way,from_node);
printf(" via=%"Pindex_t" (node)\n",relationp->via);
printf(" to=%"Pindex_t" (segment) = %"Pindex_t" (way) = %"Pindex_t" (node)\n",relationp->to,to_way,to_node);
if(relationp->except)
printf(" except=%03x (%s)\n",relationp->except,TransportsNameList(relationp->except));
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of an error log from the routing database (as plain text).
ErrorLogs *errorlogs The set of error logs to use.
index_t item The error log index to print.
++++++++++++++++++++++++++++++++++++++*/
static void print_errorlog(ErrorLogs *errorlogs,index_t item)
{
ErrorLog *errorlogp=LookupErrorLog(errorlogs,item,1);
printf("Error Log %"Pindex_t"\n",item);
if(itemfile.number_geo)
{
double latitude,longitude;
GetErrorLogLatLong(errorlogs,item,errorlogp,&latitude,&longitude);
printf(" latoffset=%d lonoffset=%d (latitude=%.6f longitude=%.6f)\n",errorlogp->latoffset,errorlogp->lonoffset,radians_to_degrees(latitude),radians_to_degrees(longitude));
}
else
printf(" No geographical information\n");
printf(" '%s'\n",LookupErrorLogString(errorlogs,item));
}
/*++++++++++++++++++++++++++++++++++++++
Print out a header in OSM XML format.
int coordcount If true then include a bounding box.
double latmin The minimum latitude.
double latmax The maximum latitude.
double lonmin The minimum longitude.
double lonmax The maximum longitude.
++++++++++++++++++++++++++++++++++++++*/
static void print_head_osm(int coordcount,double latmin,double latmax,double lonmin,double lonmax)
{
printf("\n");
printf("\n");
if(coordcount)
printf(" \n",
radians_to_degrees(latmin),radians_to_degrees(latmax),radians_to_degrees(lonmin),radians_to_degrees(lonmax));
}
/*++++++++++++++++++++++++++++++++++++++
Print a region of the database in OSM XML format.
Nodes *nodes The set of nodes to use.
Segments *segments The set of segments to use.
Ways *ways The set of ways to use.
Relations *relations The set of relations to use.
double latmin The minimum latitude.
double latmax The maximum latitude.
double lonmin The minimum longitude.
double lonmax The maximum longitude.
int option_no_super The option to print no super-segments.
++++++++++++++++++++++++++++++++++++++*/
static void print_region_osm(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,
double latmin,double latmax,double lonmin,double lonmax,int option_no_super)
{
ll_bin_t latminbin=latlong_to_bin(radians_to_latlong(latmin))-nodes->file.latzero;
ll_bin_t latmaxbin=latlong_to_bin(radians_to_latlong(latmax))-nodes->file.latzero;
ll_bin_t lonminbin=latlong_to_bin(radians_to_latlong(lonmin))-nodes->file.lonzero;
ll_bin_t lonmaxbin=latlong_to_bin(radians_to_latlong(lonmax))-nodes->file.lonzero;
ll_bin_t latb,lonb;
index_t item,index1,index2;
if(latminbin<0) latminbin=0;
if(latmaxbin>nodes->file.latbins) latmaxbin=nodes->file.latbins-1;
if(lonminbin<0) lonminbin=0;
if(lonmaxbin>nodes->file.lonbins) lonmaxbin=nodes->file.lonbins-1;
/* Loop through all of the nodes. */
for(latb=latminbin;latb<=latmaxbin;latb++)
for(lonb=lonminbin;lonb<=lonmaxbin;lonb++)
{
ll_bin2_t llbin=lonb*nodes->file.latbins+latb;
if(llbin<0 || llbin>(nodes->file.latbins*nodes->file.lonbins))
continue;
index1=LookupNodeOffset(nodes,llbin);
index2=LookupNodeOffset(nodes,llbin+1);
for(item=index1;itemfile.latzero+latb)+off_to_latlong(nodep->latoffset));
double lon=latlong_to_radians(bin_to_latlong(nodes->file.lonzero+lonb)+off_to_latlong(nodep->lonoffset));
if(lat>latmin && latlonmin && lonlatmin && olatlonmin && olonoitem)
if(!option_no_super || IsNormalSegment(segmentp))
print_segment_osm(segments,IndexSegment(segments,segmentp),ways);
segmentp=NextSegment(segments,segmentp,item);
}
if(IsTurnRestrictedNode(nodep))
{
index_t relindex=FindFirstTurnRelation1(relations,item);
while(relindex!=NO_RELATION)
{
print_turn_relation_osm(relations,relindex,segments,nodes);
relindex=FindNextTurnRelation1(relations,relindex);
}
}
}
}
}
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a node from the routing database (in OSM XML format).
Nodes *nodes The set of nodes to use.
index_t item The node index to print.
++++++++++++++++++++++++++++++++++++++*/
static void print_node_osm(Nodes *nodes,index_t item)
{
Node *nodep=LookupNode(nodes,item,1);
double latitude,longitude;
int i;
GetLatLong(nodes,item,nodep,&latitude,&longitude);
if(nodep->allow==Transports_ALL && nodep->flags==0)
printf(" \n",item+1,radians_to_degrees(latitude),radians_to_degrees(longitude));
else
{
printf(" \n",item+1,radians_to_degrees(latitude),radians_to_degrees(longitude));
if(nodep->flags & NODE_SUPER)
printf(" \n");
if(nodep->flags & NODE_UTURN)
printf(" \n");
if(nodep->flags & NODE_MINIRNDBT)
printf(" \n");
if(nodep->flags & NODE_TURNRSTRCT)
printf(" \n");
for(i=1;iallow & TRANSPORTS(i)))
printf(" \n",TransportName(i));
printf(" \n");
}
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a segment from the routing database (as a way in OSM XML format).
Segments *segments The set of segments to use.
index_t item The segment index to print.
Ways *ways The set of ways to use.
++++++++++++++++++++++++++++++++++++++*/
static void print_segment_osm(Segments *segments,index_t item,Ways *ways)
{
Segment *segmentp=LookupSegment(segments,item,1);
Way *wayp=LookupWay(ways,segmentp->way,1);
char *name=WayName(ways,wayp);
int i;
printf(" \n",item+1);
if(IsOnewayTo(segmentp,segmentp->node1))
{
printf(" \n",segmentp->node2+1);
printf(" \n",segmentp->node1+1);
}
else
{
printf(" \n",segmentp->node1+1);
printf(" \n",segmentp->node2+1);
}
if(IsSuperSegment(segmentp))
printf(" \n");
if(IsNormalSegment(segmentp))
printf(" \n");
printf(" \n",distance_to_km(DISTANCE(segmentp->distance)));
if(wayp->type & Highway_OneWay)
printf(" \n");
if(wayp->type & Highway_CycleBothWays)
printf(" \n");
if(wayp->type & Highway_Roundabout)
printf(" \n");
printf(" \n",HighwayName(HIGHWAY(wayp->type)));
if(IsNormalSegment(segmentp) && *name)
printf(" \n",ParseXML_Encode_Safe_XML(name));
for(i=1;iallow & TRANSPORTS(i))
printf(" \n",TransportName(i));
for(i=1;iprops & PROPERTIES(i))
printf(" \n",PropertyName(i));
if(wayp->speed)
printf(" \n",speed_to_kph(wayp->speed));
if(wayp->weight)
printf(" \n",weight_to_tonnes(wayp->weight));
if(wayp->height)
printf(" \n",height_to_metres(wayp->height));
if(wayp->width)
printf(" \n",width_to_metres(wayp->width));
if(wayp->length)
printf(" \n",length_to_metres(wayp->length));
printf(" \n");
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a turn relation from the routing database (in OSM XML format).
Relations *relations The set of relations to use.
index_t item The relation index to print.
Segments *segments The set of segments to use.
Nodes *nodes The set of nodes to use.
++++++++++++++++++++++++++++++++++++++*/
static void print_turn_relation_osm(Relations *relations,index_t item,Segments *segments,Nodes *nodes)
{
TurnRelation *relationp=LookupTurnRelation(relations,item,1);
Segment *segmentp_from=LookupSegment(segments,relationp->from,1);
Segment *segmentp_to =LookupSegment(segments,relationp->to ,2);
double angle=TurnAngle(nodes,segmentp_from,segmentp_to,relationp->via);
char *restriction;
if(angle>150 || angle<-150)
restriction="no_u_turn";
else if(angle>30)
restriction="no_right_turn";
else if(angle<-30)
restriction="no_left_turn";
else
restriction="no_straight_on";
printf(" \n",item+1);
printf(" \n");
printf(" \n",restriction);
if(relationp->except)
printf(" \n",TransportsNameList(relationp->except));
printf(" \n",relationp->from+1);
printf(" \n",relationp->via+1);
printf(" \n",relationp->to+1);
printf(" \n");
}
/*++++++++++++++++++++++++++++++++++++++
Print out a tail in OSM XML format.
++++++++++++++++++++++++++++++++++++++*/
static void print_tail_osm(void)
{
printf("\n");
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a node from the routing database (in visualiser format).
Nodes *nodes The set of nodes to use.
index_t item The node index to print.
++++++++++++++++++++++++++++++++++++++*/
static void print_node_visualiser(Nodes *nodes,index_t item)
{
Node *nodep=LookupNode(nodes,item,1);
double latitude,longitude;
int i;
GetLatLong(nodes,item,nodep,&latitude,&longitude);
if(nodep->allow==Transports_ALL && nodep->flags==0)
printf("<routino:node id='%"Pindex_t"' lat='%.7f' lon='%.7f' />\n",item+1,radians_to_degrees(latitude),radians_to_degrees(longitude));
else
{
printf("<routino:node id='%"Pindex_t"' lat='%.7f' lon='%.7f'>\n",item+1,radians_to_degrees(latitude),radians_to_degrees(longitude));
if(nodep->flags & NODE_SUPER)
printf(" <tag k='routino:super' v='yes' />\n");
if(nodep->flags & NODE_UTURN)
printf(" <tag k='routino:uturn' v='yes' />\n");
if(nodep->flags & NODE_MINIRNDBT)
printf(" <tag k='junction' v='roundabout' />\n");
if(nodep->flags & NODE_TURNRSTRCT)
printf(" <tag k='routino:turnrestriction' v='yes' />\n");
for(i=1;iallow & TRANSPORTS(i)))
printf(" <tag k='%s' v='no' />\n",TransportName(i));
printf("</routino:node>\n");
}
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a segment from the routing database (as a way in visualiser format).
Segments *segments The set of segments to use.
index_t item The segment index to print.
Ways *ways The set of ways to use.
++++++++++++++++++++++++++++++++++++++*/
static void print_segment_visualiser(Segments *segments,index_t item,Ways *ways)
{
Segment *segmentp=LookupSegment(segments,item,1);
Way *wayp=LookupWay(ways,segmentp->way,1);
char *name=WayName(ways,wayp);
int i;
printf("<routino:way id='%"Pindex_t"'>\n",item+1);
if(IsOnewayTo(segmentp,segmentp->node1))
{
printf(" <nd ref='%"Pindex_t"' />\n",segmentp->node2+1);
printf(" <nd ref='%"Pindex_t"' />\n",segmentp->node1+1);
}
else
{
printf(" <nd ref='%"Pindex_t"' />\n",segmentp->node1+1);
printf(" <nd ref='%"Pindex_t"' />\n",segmentp->node2+1);
}
if(IsSuperSegment(segmentp))
printf(" <tag k='routino:super' v='yes' />\n");
if(IsNormalSegment(segmentp))
printf(" <tag k='routino:normal' v='yes' />\n");
printf(" <tag k='routino:distance' v='%.3f km' />\n",distance_to_km(DISTANCE(segmentp->distance)));
if(wayp->type & Highway_OneWay)
printf(" <tag k='oneway' v='yes' />\n");
if(wayp->type & Highway_CycleBothWays)
printf(" <tag k='cyclebothways' v='yes' />\n");
if(wayp->type & Highway_Roundabout)
printf(" <tag k='roundabout' v='yes' />\n");
printf(" <tag k='highway' v='%s' />\n",HighwayName(HIGHWAY(wayp->type)));
if(IsNormalSegment(segmentp) && *name)
printf(" <tag k='name' v='%s' />\n",ParseXML_Encode_Safe_XML(name));
for(i=1;iallow & TRANSPORTS(i))
printf(" <tag k='%s' v='yes' />\n",TransportName(i));
for(i=1;iprops & PROPERTIES(i))
printf(" <tag k='%s' v='yes' />\n",PropertyName(i));
if(wayp->speed)
printf(" <tag k='maxspeed' v='%d kph' />\n",speed_to_kph(wayp->speed));
if(wayp->weight)
printf(" <tag k='maxweight' v='%.1f t' />\n",weight_to_tonnes(wayp->weight));
if(wayp->height)
printf(" <tag k='maxheight' v='%.1f m' />\n",height_to_metres(wayp->height));
if(wayp->width)
printf(" <tag k='maxwidth' v='%.1f m' />\n",width_to_metres(wayp->width));
if(wayp->length)
printf(" <tag k='maxlength' v='%.1f m' />\n",length_to_metres(wayp->length));
printf("</routino:way>\n");
}
/*++++++++++++++++++++++++++++++++++++++
Print out the contents of a turn relation from the routing database (in visualiser format).
Relations *relations The set of relations to use.
index_t item The relation index to print.
Segments *segments The set of segments to use.
Nodes *nodes The set of nodes to use.
++++++++++++++++++++++++++++++++++++++*/
static void print_turn_relation_visualiser(Relations *relations,index_t item,Segments *segments,Nodes *nodes)
{
TurnRelation *relationp=LookupTurnRelation(relations,item,1);
Segment *segmentp_from=LookupSegment(segments,relationp->from,1);
Segment *segmentp_to =LookupSegment(segments,relationp->to ,2);
double angle=TurnAngle(nodes,segmentp_from,segmentp_to,relationp->via);
char *restriction;
if(angle>150 || angle<-150)
restriction="no_u_turn";
else if(angle>30)
restriction="no_right_turn";
else if(angle<-30)
restriction="no_left_turn";
else
restriction="no_straight_on";
printf("<routino:relation id='%"Pindex_t"'>\n",item+1);
printf(" <tag k='type' v='restriction' />\n");
printf(" <tag k='restriction' v='%s'/>\n",restriction);
if(relationp->except)
printf(" <tag k='except' v='%s' />\n",TransportsNameList(relationp->except));
printf(" <member type='way' ref='%"Pindex_t"' role='from' />\n",relationp->from+1);
printf(" <member type='node' ref='%"Pindex_t"' role='via' />\n",relationp->via+1);
printf(" <member type='way' ref='%"Pindex_t"' role='to' />\n",relationp->to+1);
printf("</routino:relation>\n");
}
/*++++++++++++++++++++++++++++++++++++++
Print out an error log entry from the database (in visualiser format).
ErrorLogs *errorlogs The set of error logs to use.
index_t item The error log index to print.
++++++++++++++++++++++++++++++++++++++*/
static void print_errorlog_visualiser(ErrorLogs *errorlogs,index_t item)
{
char *string=LookupErrorLogString(errorlogs,item);
printf("%s\n",ParseXML_Encode_Safe_XML(string));
}
/*+ Conversion from time_t to date string (day of week). +*/
static const char* const weekdays[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
/*+ Conversion from time_t to date string (month of year). +*/
static const char* const months[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
/*++++++++++++++++++++++++++++++++++++++
Convert the time into an RFC 822 compliant date.
char *RFC822Date Returns a pointer to a fixed string containing the date.
time_t t The time.
++++++++++++++++++++++++++++++++++++++*/
static char *RFC822Date(time_t t)
{
static char value[80]; /* static allocation of return value */
char weekday[4];
char month[4];
struct tm *tim;
tim=gmtime(&t);
strcpy(weekday,weekdays[tim->tm_wday]);
strcpy(month,months[tim->tm_mon]);
/* Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 */
sprintf(value,"%3s, %02d %3s %4d %02d:%02d:%02d %s",
weekday,
tim->tm_mday,
month,
tim->tm_year+1900,
tim->tm_hour,
tim->tm_min,
tim->tm_sec,
"GMT"
);
return(value);
}
/*++++++++++++++++++++++++++++++++++++++
Print out the usage information.
int detail The level of detail to use: -1 = just version number, 0 = low detail, 1 = full details.
const char *argerr The argument that gave the error (if there is one).
const char *err Other error message (if there is one).
++++++++++++++++++++++++++++++++++++++*/
static void print_usage(int detail,const char *argerr,const char *err)
{
if(detail<0)
{
fprintf(stderr,
"Routino version " ROUTINO_VERSION " " ROUTINO_URL ".\n"
);
}
if(detail>=0)
{
fprintf(stderr,
"Usage: filedumper [--version]\n"
" [--help]\n"
" [--dir=] [--prefix=]\n"
" [--statistics]\n"
" [--visualiser --latmin= --latmax=\n"
" --lonmin= --lonmax=\n"
" --data=]\n"
" [--dump [--node= ...]\n"
" [--segment= ...]\n"
" [--way= ...]\n"
" [--turn-relation= ...]\n"
" [--errorlog= ...]]\n"
" [--dump-osm [--no-super]\n"
" [--latmin= --latmax=\n"
" --lonmin= --lonmax=]]\n"
" [--dump-visualiser [--data=node]\n"
" [--data=segment]\n"
" [--data=turn-relation]\n"
" [--data=errorlog]]\n");
if(argerr)
fprintf(stderr,
"\n"
"Error with command line parameter: %s\n",argerr);
if(err)
fprintf(stderr,
"\n"
"Error: %s\n",err);
}
if(detail==1)
fprintf(stderr,
"\n"
"--version Print the version of Routino.\n"
"\n"
"--help Prints this information.\n"
"\n"
"--dir= The directory containing the routing database.\n"
"--prefix= The filename prefix for the routing database.\n"
"\n"
"--statistics Print statistics about the routing database.\n"
"\n"
"--visualiser Extract selected data from the routing database:\n"
" --latmin= * the minimum latitude (degrees N).\n"
" --latmax= * the maximum latitude (degrees N).\n"
" --lonmin= * the minimum longitude (degrees E).\n"
" --lonmax= * the maximum longitude (degrees E).\n"
" --data= * the type of data to select.\n"
"\n"
" can be selected from:\n"
" junctions = segment count at each junction.\n"
" super = super-node and super-segments.\n"
" waytype-* = segments of oneway, cyclebothways or roundabout type.\n"
" highway-* = segments of the specified highway type.\n"
" transport-* = segments allowing the specified transport type.\n"
" barrier-* = nodes disallowing the specified transport type.\n"
" turns = turn restrictions.\n"
" speed = speed limits.\n"
" weight = weight limits.\n"
" height = height limits.\n"
" width = width limits.\n"
" length = length limits.\n"
" property-* = segments with the specified property.\n"
" errorlogs = errors logged during parsing.\n"
"\n"
"--dump Dump selected contents of the database.\n"
" --node= * the node with the selected index.\n"
" --segment= * the segment with the selected index.\n"
" --way= * the way with the selected index.\n"
" --turn-relation= * the turn relation with the selected index.\n"
" --errorlog= * the error log with the selected index.\n"
" Use 'all' instead of a number to get all of them.\n"
"\n"
"--dump-osm Dump all or part of the database as an XML file.\n"
" --no-super * exclude the super-segments.\n"
" --latmin= * the minimum latitude (degrees N).\n"
" --latmax= * the maximum latitude (degrees N).\n"
" --lonmin= * the minimum longitude (degrees E).\n"
" --lonmax= * the maximum longitude (degrees E).\n"
"\n"
"--dump-visualiser Dump selected contents of the database in HTML.\n"
" --data=node * the node with the selected index.\n"
" --data=segment * the segment with the selected index.\n"
" --data=turn-relation * the turn relation with the selected index.\n"
" --data=errorlog * the error log with the selected index.\n");
exit(!detail);
}
routino-3.4.1/src/nodes.c 644 233 144 44120 13755013433 10456 0 /***************************************
Node data type functions.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2008-2015, 2019, 2020 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#include
#include "types.h"
#include "nodes.h"
#include "segments.h"
#include "ways.h"
#include "files.h"
#include "profiles.h"
/* Local functions */
static int valid_segment_for_profile(Ways *ways,Segment *segmentp,Profile *profile);
/*++++++++++++++++++++++++++++++++++++++
Load in a node list from a file.
Nodes *LoadNodeList Returns the node list.
const char *filename The name of the file to load.
++++++++++++++++++++++++++++++++++++++*/
Nodes *LoadNodeList(const char *filename)
{
Nodes *nodes;
#if SLIM
size_t sizeoffsets;
#endif
nodes=(Nodes*)malloc(sizeof(Nodes));
#if !SLIM
nodes->data=MapFile(filename);
/* Copy the NodesFile header structure from the loaded data */
nodes->file=*((NodesFile*)nodes->data);
/* Set the pointers in the Nodes structure. */
nodes->offsets=(index_t*)(nodes->data+sizeof(NodesFile));
nodes->nodes =(Node* )(nodes->data+sizeof(NodesFile)+(nodes->file.latbins*nodes->file.lonbins+1)*sizeof(index_t));
#else
nodes->fd=SlimMapFile(filename);
/* Copy the NodesFile header structure from the loaded data */
SlimFetch(nodes->fd,&nodes->file,sizeof(NodesFile),0);
sizeoffsets=(nodes->file.latbins*nodes->file.lonbins+1)*sizeof(index_t);
nodes->offsets=(index_t*)malloc(sizeoffsets);
#ifndef LIBROUTINO
log_malloc(nodes->offsets,sizeoffsets);
#endif
SlimFetch(nodes->fd,nodes->offsets,sizeoffsets,sizeof(NodesFile));
nodes->nodesoffset=(offset_t)(sizeof(NodesFile)+sizeoffsets);
nodes->cache=NewNodeCache();
#ifndef LIBROUTINO
log_malloc(nodes->cache,sizeof(*nodes->cache));
#endif
#endif
return(nodes);
}
/*++++++++++++++++++++++++++++++++++++++
Destroy the node list.
Nodes *nodes The node list to destroy.
++++++++++++++++++++++++++++++++++++++*/
void DestroyNodeList(Nodes *nodes)
{
#if !SLIM
nodes->data=UnmapFile(nodes->data);
#else
nodes->fd=SlimUnmapFile(nodes->fd);
#ifndef LIBROUTINO
log_free(nodes->offsets);
#endif
free(nodes->offsets);
#ifndef LIBROUTINO
log_free(nodes->cache);
#endif
DeleteNodeCache(nodes->cache);
#endif
free(nodes);
}
/*++++++++++++++++++++++++++++++++++++++
Find the closest node given its latitude, longitude and the profile of the
mode of transport that must be able to move to/from this node.
index_t FindClosestNode Returns the closest node.
Nodes *nodes The set of nodes to search.
Segments *segments The set of segments to use.
Ways *ways The set of ways to use.
double latitude The latitude to look for.
double longitude The longitude to look for.
distance_t distance The maximum distance to look from the specified coordinates.
Profile *profile The profile of the mode of transport.
distance_t *bestdist Returns the distance to the best node.
++++++++++++++++++++++++++++++++++++++*/
index_t FindClosestNode(Nodes *nodes,Segments *segments,Ways *ways,double latitude,double longitude,
distance_t distance,Profile *profile,distance_t *bestdist)
{
ll_bin_t latbin=latlong_to_bin(radians_to_latlong(latitude ))-nodes->file.latzero;
ll_bin_t lonbin=latlong_to_bin(radians_to_latlong(longitude))-nodes->file.lonzero;
int delta=0,count;
index_t i,index1,index2;
index_t bestn=NO_NODE;
distance_t bestd=INF_DISTANCE;
/* Find the maximum distance to search */
double dlat=DeltaLat(longitude,distance);
double dlon=DeltaLon(latitude ,distance);
double minlat=latitude -dlat;
double maxlat=latitude +dlat;
double minlon=longitude-dlon;
double maxlon=longitude+dlon;
ll_bin_t minlatbin=latlong_to_bin(radians_to_latlong(minlat))-nodes->file.latzero;
ll_bin_t maxlatbin=latlong_to_bin(radians_to_latlong(maxlat))-nodes->file.latzero;
ll_bin_t minlonbin=latlong_to_bin(radians_to_latlong(minlon))-nodes->file.lonzero;
ll_bin_t maxlonbin=latlong_to_bin(radians_to_latlong(maxlon))-nodes->file.lonzero;
ll_off_t minlatoff=latlong_to_off(radians_to_latlong(minlat));
ll_off_t maxlatoff=latlong_to_off(radians_to_latlong(maxlat));
ll_off_t minlonoff=latlong_to_off(radians_to_latlong(minlon));
ll_off_t maxlonoff=latlong_to_off(radians_to_latlong(maxlon));
/* Start with the bin containing the location, then spiral outwards. */
do
{
ll_bin_t latb,lonb;
ll_bin2_t llbin;
count=0;
for(latb=latbin-delta;latb<=latbin+delta;latb++)
{
if(latb<0 || latb>=nodes->file.latbins || latbmaxlatbin)
continue;
for(lonb=lonbin-delta;lonb<=lonbin+delta;lonb++)
{
if(lonb<0 || lonb>=nodes->file.lonbins || lonbmaxlonbin)
continue;
if(abs(latb-latbin)file.latbins+latb;
index1=LookupNodeOffset(nodes,llbin);
index2=LookupNodeOffset(nodes,llbin+1);
for(i=index1;ilatoffsetlatoffset>maxlatoff)
continue;
if(lonb==minlonbin && nodep->lonoffsetlonoffset>maxlonoff)
continue;
lat=latlong_to_radians(bin_to_latlong(nodes->file.latzero+latb)+off_to_latlong(nodep->latoffset));
lon=latlong_to_radians(bin_to_latlong(nodes->file.lonzero+lonb)+off_to_latlong(nodep->lonoffset));
dist=Distance(lat,lon,latitude,longitude);
if(distfile.latzero;
ll_bin_t lonbin=latlong_to_bin(radians_to_latlong(longitude))-nodes->file.lonzero;
int delta=0,count;
index_t i,index1,index2;
index_t bestn1=NO_NODE,bestn2=NO_NODE;
distance_t bestd=INF_DISTANCE,bestd1=INF_DISTANCE,bestd2=INF_DISTANCE;
index_t bests=NO_SEGMENT;
/* Find the maximum distance to search */
double dlat=DeltaLat(longitude,distance);
double dlon=DeltaLon(latitude ,distance);
double minlat=latitude -dlat;
double maxlat=latitude +dlat;
double minlon=longitude-dlon;
double maxlon=longitude+dlon;
ll_bin_t minlatbin=latlong_to_bin(radians_to_latlong(minlat))-nodes->file.latzero;
ll_bin_t maxlatbin=latlong_to_bin(radians_to_latlong(maxlat))-nodes->file.latzero;
ll_bin_t minlonbin=latlong_to_bin(radians_to_latlong(minlon))-nodes->file.lonzero;
ll_bin_t maxlonbin=latlong_to_bin(radians_to_latlong(maxlon))-nodes->file.lonzero;
ll_off_t minlatoff=latlong_to_off(radians_to_latlong(minlat));
ll_off_t maxlatoff=latlong_to_off(radians_to_latlong(maxlat));
ll_off_t minlonoff=latlong_to_off(radians_to_latlong(minlon));
ll_off_t maxlonoff=latlong_to_off(radians_to_latlong(maxlon));
/* Start with the bin containing the location, then spiral outwards. */
do
{
ll_bin_t latb,lonb;
ll_bin2_t llbin;
count=0;
for(latb=latbin-delta;latb<=latbin+delta;latb++)
{
if(latb<0 || latb>=nodes->file.latbins || latbmaxlatbin)
continue;
for(lonb=lonbin-delta;lonb<=lonbin+delta;lonb++)
{
if(lonb<0 || lonb>=nodes->file.lonbins || lonbmaxlonbin)
continue;
if(abs(latb-latbin)file.latbins+latb;
index1=LookupNodeOffset(nodes,llbin);
index2=LookupNodeOffset(nodes,llbin+1);
for(i=index1;ilatoffsetlatoffset>maxlatoff)
continue;
if(lonb==minlonbin && nodep->lonoffsetlonoffset>maxlonoff)
continue;
lat1=latlong_to_radians(bin_to_latlong(nodes->file.latzero+latb)+off_to_latlong(nodep->latoffset));
lon1=latlong_to_radians(bin_to_latlong(nodes->file.lonzero+lonb)+off_to_latlong(nodep->lonoffset));
dist1=Distance(lat1,lon1,latitude,longitude);
if(dist1=0 && dist3b>=0)
distp=sqrt((double)dist1*(double)dist1-dist3a*dist3a);
else if(dist3a>0)
{
distp=dist2;
dist3a=dist3;
dist3b=0;
}
else /* if(dist3b>0) */
{
distp=dist1;
dist3a=0;
dist3b=dist3;
}
}
if(distp<(double)bestd)
{
bests=IndexSegment(segments,segmentp);
if(segmentp->node1==i)
{
bestn1=i;
bestn2=OtherNode(segmentp,i);
bestd1=(distance_t)dist3a;
bestd2=(distance_t)dist3b;
}
else
{
bestn1=OtherNode(segmentp,i);
bestn2=i;
bestd1=(distance_t)dist3b;
bestd2=(distance_t)dist3a;
}
bestd=(distance_t)distp;
}
}
segmentp=NextSegment(segments,segmentp,i);
}
while(segmentp);
} /* dist1 < distance */
}
count++;
}
}
delta++;
}
while(count);
*bestdist=bestd;
*bestnode1=bestn1;
*bestnode2=bestn2;
*bestdist1=bestd1;
*bestdist2=bestd2;
return(bests);
}
/*++++++++++++++++++++++++++++++++++++++
Check if the transport defined by the profile is allowed on the segment.
int valid_segment_for_profile Return 1 if it is or 0 if not.
Ways *ways The set of ways to use.
Segment *segmentp The segment to check.
Profile *profile The profile to check.
++++++++++++++++++++++++++++++++++++++*/
static int valid_segment_for_profile(Ways *ways,Segment *segmentp,Profile *profile)
{
Way *wayp=LookupWay(ways,segmentp->way,1);
score_t segment_pref;
int i;
/* mode of transport must be allowed on the highway */
if(!(wayp->allow&profile->transports))
return(0);
/* must obey weight restriction (if exists) */
if(wayp->weight && wayp->weightweight)
return(0);
/* must obey height/width/length restriction (if exists) */
if((wayp->height && wayp->heightheight) ||
(wayp->width && wayp->width width ) ||
(wayp->length && wayp->lengthlength))
return(0);
segment_pref=profile->highway[HIGHWAY(wayp->type)];
for(i=1;ifile.properties & PROPERTIES(i))
{
if(wayp->props & PROPERTIES(i))
segment_pref*=profile->props_yes[i];
else
segment_pref*=profile->props_no[i];
}
/* profile preferences must allow this highway */
if(segment_pref==0)
return(0);
/* Must be OK */
return(1);
}
/*++++++++++++++++++++++++++++++++++++++
Get the latitude and longitude associated with a node.
Nodes *nodes The set of nodes to use.
index_t index The node index.
Node *nodep A pointer to the node if already available.
double *latitude Returns the latitude.
double *longitude Returns the logitude.
++++++++++++++++++++++++++++++++++++++*/
void GetLatLong(Nodes *nodes,index_t index,Node *nodep,double *latitude,double *longitude)
{
ll_bin_t latbin,lonbin;
ll_bin2_t bin=-1;
ll_bin2_t start,end,mid;
index_t offset;
/* Search for offset */
start=0;
end=nodes->file.lonbins*nodes->file.latbins;
/* Binary search - search key exact match is wanted else lower bound is acceptable.
*
* # <- start | Check mid and exit if it matches else move start or end.
* # |
* # | Since a lower bound match is wanted we can set end=mid-1 or
* # <- mid | start=mid if mid doesn't exactly match.
* # |
* # | Eventually either end=start or end=start+1 and one of
* # <- end | start or end is an exact match or the lower bound.
*/
while((end-start)>1)
{
mid=start+(end-start)/2; /* Choose mid point (avoid overflow) */
offset=LookupNodeOffset(nodes,mid);
if(offsetindex) /* Mid point is too high */
end=mid-1;
else /* Mid point is correct */
{bin=mid;break;}
}
if(bin==-1)
{
offset=LookupNodeOffset(nodes,end);
if(offset>index)
bin=start;
else
bin=end;
}
while(bin<=(nodes->file.lonbins*nodes->file.latbins) &&
LookupNodeOffset(nodes,bin)==LookupNodeOffset(nodes,bin+1))
bin++;
latbin=bin%nodes->file.latbins;
lonbin=bin/nodes->file.latbins;
/* Return the values */
if(nodep==NULL)
nodep=LookupNode(nodes,index,4);
*latitude =latlong_to_radians(bin_to_latlong(nodes->file.latzero+latbin)+off_to_latlong(nodep->latoffset));
*longitude=latlong_to_radians(bin_to_latlong(nodes->file.lonzero+lonbin)+off_to_latlong(nodep->lonoffset));
}
routino-3.4.1/src/osmo5mparse.c 644 233 144 45136 14450041353 11623 0 /***************************************
A simple o5m/o5c parser.
Part of the Routino routing software.
******************/ /******************
This file Copyright 2012-2015, 2017, 2019 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
***************************************/
#include
#if defined(_MSC_VER)
#include
#include
#define read(fd,address,length) _read(fd,address,(unsigned int)(length))
#define ssize_t SSIZE_T
#else
#include
#endif
#include
#include
#include
#include
#include "osmparser.h"
#include "tagging.h"
#include "logging.h"
/* At the top level */
#define O5M_FILE_NODE 0x10
#define O5M_FILE_WAY 0x11
#define O5M_FILE_RELATION 0x12
#define O5M_FILE_BOUNDING_BOX 0xdb
#define O5M_FILE_TIMESTAMP 0xdc
#define O5M_FILE_HEADER 0xe0
#define O5M_FILE_SYNC 0xee
#define O5M_FILE_JUMP 0xef
#define O5M_FILE_END 0xfe
#define O5M_FILE_RESET 0xff
/* Errors */
#define O5M_EOF 0
#define O5M_ERROR_UNEXP_EOF 100
#define O5M_ERROR_RESET_NOT_FIRST 101
#define O5M_ERROR_HEADER_NOT_FIRST 102
#define O5M_ERROR_EXPECTED_O5M 103
#define O5M_ERROR_EXPECTED_O5C 104
#define O5M_ERROR_FILE_LEVEL 105
/* Local parsing variables (re-initialised for each file) */
static uint64_t byteno=0;
static uint64_t nnodes=0,nways=0,nrelations=0;
static int64_t id=0;
static int32_t lat=0;
static int32_t lon=0;
static int64_t timestamp=0;
static int64_t node_refid=0,way_refid=0,relation_refid=0;
static int mode_change=MODE_NORMAL;
static uint32_t buffer_allocated;
static unsigned char *buffer=NULL;
static unsigned char *buffer_ptr,*buffer_end;
static int string_table_start=0;
static unsigned char **string_table=NULL;
#define STRING_TABLE_ALLOCATED 15000
/*++++++++++++++++++++++++++++++++++++++
Refill the data buffer and set the pointers.
int buffer_refill Return 0 if everything is OK or 1 for EOF.
int fd The file descriptor to read from.
uint32_t bytes The number of bytes to read.
++++++++++++++++++++++++++++++++++++++*/
static inline int buffer_refill(int fd,uint32_t bytes)
{
ssize_t n,m;
uint32_t totalbytes;
m=buffer_end-buffer_ptr;
if(m)
memmove(buffer,buffer_ptr,m);
totalbytes=bytes+m;
if(totalbytes>buffer_allocated)
buffer=(unsigned char *)realloc(buffer,buffer_allocated=totalbytes);
byteno+=bytes;
buffer_ptr=buffer;
buffer_end=buffer+m;
do
{
n=read(fd,buffer_end,bytes);
if(n<=0)
return(1);
buffer_end+=n;
bytes-=n;
}
while(bytes>0);
return(0);
}
static void process_node(void);
static void process_way(void);
static void process_relation(void);
static void process_info(void);
static unsigned char *process_string(int pair,unsigned char **buf_ptr,unsigned char **string1,unsigned char **string2);
/* Macros to simplify the parser (and make it look more like the XML parser) */
#define BEGIN(xx) do{ state=(xx); goto finish_parsing; } while(0)
#define BUFFER_CHARS(xx) do{ if(buffer_refill(fd,(xx))) BEGIN(O5M_ERROR_UNEXP_EOF); } while(0)
/* O5M decoding */
#define O5M_LATITUDE(xx) (double)(1E-7*(xx))
#define O5M_LONGITUDE(xx) (double)(1E-7*(xx))
/*++++++++++++++++++++++++++++++++++++++
Parse an O5M int32 data value.
uint32_t o5m_int32 Returns the integer value.
unsigned char **ptr The pointer to read the data from.
++++++++++++++++++++++++++++++++++++++*/
static inline uint32_t o5m_int32(unsigned char **ptr)
{
uint32_t result=(**ptr)&0x7F;
if((**ptr)&0x80) result+=((*++(*ptr))&0x7F)<<7;
if((**ptr)&0x80) result+=((*++(*ptr))&0x7F)<<14;
if((**ptr)&0x80) result+=((*++(*ptr))&0x7F)<<21;
if((**ptr)&0x80) result+=((*++(*ptr))&0x7F)<<28;
(*ptr)++;
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Parse an O5M int32 data value.
int32_t o5m_sint32 Returns the integer value.
unsigned char **ptr The pointer to read the data from.
++++++++++++++++++++++++++++++++++++++*/
static inline int32_t o5m_sint32(unsigned char **ptr)
{
int64_t result=((**ptr)&0x7E)>>1;
int sign=(**ptr)&0x01;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<6;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<13;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<20;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<27;
(*ptr)++;
if(sign)
result=-result-1;
return(result);
}
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
#endif
/*++++++++++++++++++++++++++++++++++++++
Parse an O5M int64 data value.
int64_t o5m_int64 Returns the integer value.
unsigned char **ptr The pointer to read the data from.
++++++++++++++++++++++++++++++++++++++*/
static inline int64_t o5m_int64(unsigned char **ptr)
{
uint64_t result=(**ptr)&0x7F;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<7;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<14;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<21;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<28;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<35;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<42;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<49;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<56;
if((**ptr)&0x80) result+=(uint64_t)((*++(*ptr))&0x7F)<<63;
(*ptr)++;
return(result);
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
/*++++++++++++++++++++++++++++++++++++++
Parse an O5M sint64 data value.
int64_t o5m_sint64 Returns the integer value.
unsigned char **ptr The pointer to read the data from.
++++++++++++++++++++++++++++++++++++++*/
static inline int64_t o5m_sint64(unsigned char **ptr)
{
int64_t result=((**ptr)&0x7E)>>1;
int sign=(**ptr)&0x01;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<6;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<13;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<20;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<27;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<34;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<41;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<48;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<55;
if((**ptr)&0x80) result+=(int64_t)((*++(*ptr))&0x7F)<<62;
(*ptr)++;
if(sign)
result=-result-1;
return(result);
}
/*++++++++++++++++++++++++++++++++++++++
Parse the O5M and call the functions for each OSM item as seen.
int ParseO5M Returns 0 if OK or something else in case of an error.
int fd The file descriptor of the file to parse.
int changes Set to 1 if this is expected to be a changes file, otherwise zero.
++++++++++++++++++++++++++++++++++++++*/
static int ParseO5M(int fd,int changes)
{
int i;
int state;
int number_reset=0;
int error;
/* Print the initial message */
printf_first("Reading: Bytes=0 Nodes=0 Ways=0 Relations=0");
/* The actual parser. */
nnodes=0,nways=0,nrelations=0;
if(changes)
mode_change=MODE_MODIFY;
string_table_start=0;
string_table=(unsigned char **)malloc(STRING_TABLE_ALLOCATED*sizeof(unsigned char *));
for(i=0;i