Permalink
Browse files

*** empty log message ***

  • Loading branch information...
1 parent 7c043c2 commit da12d46cb8e933070aef82e37f5224e602b8dd8d @drolbr committed Feb 25, 2010
View
@@ -8,10 +8,6 @@ bin/import_osm
bin/init_dispatcher
bin/load_rules
bin/timestamp_of
-cgi-bin/add_rule
-cgi-bin/get_rule
-cgi-bin/interpreter
-cgi-bin/update_rule
testfiles
import_osm
import_osm_nw
View
@@ -2,3 +2,13 @@ add_rule
get_rule
interpreter
update_rule
+download
+elems
+foo
+nodes-csv
+nodes-csv-gzip
+nodes-csv-lat-lon-name
+poi
+sketch-line
+sketch-options
+sketch-route
@@ -46,10 +46,14 @@
The value of the tag <em>network</em> of the relation(s) to consider. A working example is <em>VRR</em> for the German <em>Verkehrsverbund Rhein-Ruhr</em>.<br/>
<strong>Line number</strong>: <input name="ref" type="text" size="40"/><br/>
The value of the tag <em>ref</em> of the relation(s) to consider. A working example is <em>625</em>.<br/>
+ <strong>Correspondences</strong>: <input name="correspondences" type="text" size="10"/><br/>
+ A nonempty value in this field enables the display of correspondences. This slows down the response
+ times but gives more information. The value is interpreted as maximum acceptable distance in meters
+ between two stations or bus stops to still be acceptable for changing vehicles. The default value is 100.<br/>
<strong>Width</strong>: <input name="width" type="text" value="700" size="10"/><br/>
The width of the generated SVG in pixels. Default is 700.<br/>
<strong>Height</strong>: <input name="height" type="text" value="495" size="10"/><br/>
- The heigth of the generated SVG in pixels. Default is 700.<br/>
+ The heigth of the generated SVG in pixels. Default is 495.<br/>
<strong>Font size of stop names</strong>: <input name="font-size" type="text" size="10"/><br/>
The font size in pixels for the stopname in the generated SVG. Default is is empty field.
This means that the generator takes font size 10 for lines displayed in two rows and font size 16
@@ -58,6 +62,12 @@
This field can have values 1 or 2 or can be empty. If it is empty, the generator chooses whether to
display the line in one or two rows. If it is set to 1 resp. 2, the generator displays the line
in an case in one resp. two rows.<br/>
+ <strong>Maximum correspondences per row</strong>: <input name="max-cors-per-line" type="text" size="10"/><br/>
+ The limit for the acceptable number of line numbers to be printed per line. This option is only
+ effective when correspondences aer enabled. Its default value is 6.<br/>
+ <strong>Maximum correspondences below</strong>: <input name="max-cors-below" type="text" size="10"/><br/>
+ The limit for the acceptable number of line numbers to be printed below the line bar. This option is only
+ effective when correspondences aer enabled. Its default value is 0.<br/>
<strong>Style</strong>: <input name="style" type="text" size="40"/><br/>
This parameter makes the generator using an existing style for formatting the diagram. A working example
is <em>wuppertal</em> for a style with German translations and abbreviations.<br/>
@@ -2,16 +2,18 @@
* Must be used with Expat compiled for UTF-8 output.
*/
+#include <iomanip>
#include <iostream>
#include <math.h>
#include "../expat_justparse_interface.h"
using namespace std;
-const double BRIM = 0.02;
const double PI = acos(0)*2;
+double brim;
+
string frame_template()
{
return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
@@ -42,14 +44,14 @@ void start(const char *el, const char **attr)
}
cout<<" <query type=\"node\">\n"
<<" <bbox-query "
- <<"n=\""<<lat + BRIM<<"\" s=\""<<lat - BRIM<<"\" "
- <<"w=\""<<lon - BRIM/cos(lat/180.0*PI)<<"\" e=\""<<lon + BRIM/cos(lat/180.0*PI)<<"\"/>\n"
+ <<"n=\""<<setprecision(14)<<lat + brim<<"\" s=\""<<setprecision(14)<<lat - brim<<"\" "
+ <<"w=\""<<setprecision(14)<<lon - brim/cos(lat/180.0*PI)<<"\" e=\""<<setprecision(14)<<lon + brim/cos(lat/180.0*PI)<<"\"/>\n"
<<" <has-kv k=\"railway\"/>\n"
<<" </query>\n"
<<" <query type=\"node\">\n"
<<" <bbox-query "
- <<"n=\""<<lat + BRIM<<"\" s=\""<<lat - BRIM<<"\" "
- <<"w=\""<<lon - BRIM/cos(lat/180.0*PI)<<"\" e=\""<<lon + BRIM/cos(lat/180.0*PI)<<"\"/>\n"
+ <<"n=\""<<setprecision(14)<<lat + brim<<"\" s=\""<<setprecision(14)<<lat - brim<<"\" "
+ <<"w=\""<<setprecision(14)<<lon - brim/cos(lat/180.0*PI)<<"\" e=\""<<setprecision(14)<<lon + brim/cos(lat/180.0*PI)<<"\"/>\n"
<<" <has-kv k=\"highway\"/>\n"
<<" </query>\n";
}
@@ -61,6 +63,16 @@ void end(const char *el)
int main(int argc, char *argv[])
{
+ brim = 0.009;
+
+ int argi(1);
+ while (argi < argc)
+ {
+ if (!strncmp("--size=", argv[argi], 7))
+ brim = atof(((string)(argv[argi])).substr(7).c_str())/1000.0/40000.0*360.0;
+ ++argi;
+ }
+
cout<<"<osm-script timeout=\"180\" element-limit=\"10000000\">\n"
<<"\n"
<<"<union>\n";
@@ -20,6 +20,13 @@ echo -e "\
REQUEST_METHOD=
/home/roland/osm-3s/cgi-bin/interpreter </tmp/nodes_csv_rel_req >/tmp/nodes_csv_rel_result.1
+RESPONSE_TYPE=`head -n 1 </tmp/nodes_csv_rel_result.1`
+if [[ $RESPONSE_TYPE != "Content-type: application/osm3s" ]]; then
+{
+ cat </tmp/nodes_csv_rel_result.1
+ exit 0
+};
+fi
dd if=/tmp/nodes_csv_rel_result.1 of=/tmp/nodes_csv_rel_result.2 bs=1 skip=56
gunzip </tmp/nodes_csv_rel_result.2 | ../bin/memberlist >/tmp/nodes_rel_csv_result.3
@@ -40,6 +47,13 @@ while read -u 3 REL; do
REQUEST_METHOD=
/home/roland/osm-3s/cgi-bin/interpreter </tmp/nodes_csv_req >/tmp/nodes_csv_result.1
+ RESPONSE_TYPE=`head -n 1 </tmp/nodes_csv_result.1`
+ if [[ $RESPONSE_TYPE != "Content-type: application/osm3s" ]]; then
+ {
+ cat </tmp/nodes_csv_result.1
+ exit 0
+ };
+ fi
dd if=/tmp/nodes_csv_result.1 of=/tmp/nodes_csv_result.2 bs=1 skip=56
if [[ $ARG_2 == "forward" ]]; then
{
View
@@ -21,12 +21,20 @@ echo -e "\
</osm-script> \
" >/tmp/nodes_csv_req
-echo "Content-Type: text/html; charset=utf-8"
-echo
-
REQUEST_METHOD=
/home/roland/osm-3s/cgi-bin/interpreter </tmp/nodes_csv_req >/tmp/nodes_csv_result.1
+RESPONSE_TYPE=`head -n 1 </tmp/nodes_csv_result.1`
+if [[ $RESPONSE_TYPE != "Content-type: application/osm3s" ]]; then
+{
+ cat </tmp/nodes_csv_result.1
+ exit 0
+};
+fi
dd if=/tmp/nodes_csv_result.1 of=/tmp/nodes_csv_result.2 bs=1 skip=56
+
+echo "Content-Type: text/html; charset=utf-8"
+echo
+
if [[ $ARG_2 == "forward" ]]; then
{
gunzip </tmp/nodes_csv_result.2 | ../bin/nodes-csv-lat-lon-name --forward
View
@@ -2,9 +2,6 @@
BUF=$QUERY_STRING\&
-# echo "Content-Type: text/plain; charset=utf-8"
-# echo
-
SKETCH_PARAMS=
while [[ -n $BUF ]]; do
@@ -16,7 +13,10 @@ while [[ -n $BUF ]]; do
if [[ $KEY == "network" && -n $VALUE ]]; then
NETWORK=$VALUE
elif [[ $KEY == "ref" && -n $VALUE ]]; then
+ {
REF=$VALUE
+ REF_=`echo $VALUE | ../bin/uncgi`
+ };
elif [[ $KEY == "width" && -n $VALUE ]]; then
SKETCH_PARAMS="$SKETCH_PARAMS --width=$VALUE"
elif [[ $KEY == "height" && -n $VALUE ]]; then
@@ -27,11 +27,19 @@ while [[ -n $BUF ]]; do
SKETCH_PARAMS="$SKETCH_PARAMS --rows=$VALUE"
elif [[ $KEY == "style" && -n $VALUE ]]; then
SKETCH_PARAMS="$SKETCH_PARAMS --options=/opt/osm_why_api/options/sketch-line.$VALUE"
+ elif [[ $KEY == "correspondences" && -n $VALUE ]]; then
+ CORRESPONDENCES=$VALUE
+ elif [[ $KEY == "max-cors-per-line" && -n $VALUE ]]; then
+ SKETCH_PARAMS="$SKETCH_PARAMS --max-correspondences-per-line=$VALUE"
+ elif [[ $KEY == "max-cors-below" && -n $VALUE ]]; then
+ SKETCH_PARAMS="$SKETCH_PARAMS --max-correspondences-below=$VALUE"
+ elif [[ $KEY == "debug" && -n $VALUE ]]; then
+ DEBUG=$VALUE
fi
};
done
-echo -e "
+echo -e "\
data=<osm-script timeout=\"180\" element-limit=\"10000000\"> \
\
<union> \
@@ -43,13 +51,73 @@ data=<osm-script timeout=\"180\" element-limit=\"10000000\"> \
</union> \
<print mode=\"body\"/> \
\
-</osm-script> \
+</osm-script>
" >/tmp/sketch_line_req
-echo "Content-Type: image/svg+xml; charset=utf-8"
-echo
+if [[ -n $CORRESPONDENCES ]]; then
+{
+ REQUEST_METHOD=
+ /home/roland/osm-3s/cgi-bin/interpreter </tmp/sketch_line_req >/tmp/sketch_line_req.1
+ RESPONSE_TYPE=`head -n 1 </tmp/sketch_line_req.1`
+ if [[ $RESPONSE_TYPE != "Content-type: application/osm3s" ]]; then
+ {
+ cat </tmp/sketch_line_req.1
+ exit 0
+ };
+ fi
+ dd if=/tmp/sketch_line_req.1 of=/tmp/sketch_line_req.2 bs=1 skip=56
+ gunzip </tmp/sketch_line_req.2 | ../bin/bbox-brim-query --size=$CORRESPONDENCES >/tmp/sketch_line_req.3
+
+ if [[ $DEBUG == "full-query" ]]; then
+ {
+ echo "Content-Type: text/plain; charset=utf-8"
+ echo
+
+ cat </tmp/sketch_line_req.3
+
+ echo
+ };
+ fi;
+
+ REQUEST_METHOD=
+ /home/roland/osm-3s/cgi-bin/interpreter </tmp/sketch_line_req.3 >/tmp/sketch_line_req.4
+ RESPONSE_TYPE=`head -n 1 </tmp/sketch_line_req.4`
+ if [[ $RESPONSE_TYPE != "Content-type: application/osm3s" ]]; then
+ {
+ cat </tmp/sketch_line_req.4
+ exit 0
+ };
+ fi
+ dd if=/tmp/sketch_line_req.4 of=/tmp/sketch_line_req.5 bs=1 skip=56
+
+ echo "Content-Type: image/svg+xml; charset=utf-8"
+ echo
+
+ if [[ $DEBUG == "full-query" ]]; then
+ {
+ gunzip </tmp/sketch_line_req.5
+ exit 0;
+ };
+ fi;
+
+ gunzip </tmp/sketch_line_req.5 | ../bin/sketch-route-svg --walk-limit=$CORRESPONDENCES --ref="$REF_" $SKETCH_PARAMS
+};
+else
+{
+ REQUEST_METHOD=
+ /home/roland/osm-3s/cgi-bin/interpreter </tmp/sketch_line_req >/tmp/sketch_line_req.1
+ RESPONSE_TYPE=`head -n 1 </tmp/sketch_line_req.1`
+ if [[ $RESPONSE_TYPE != "Content-type: application/osm3s" ]]; then
+ {
+ cat </tmp/sketch_line_req.1
+ exit 0
+ };
+ fi
+ dd if=/tmp/sketch_line_req.1 of=/tmp/sketch_line_req.2 bs=1 skip=56
+
+ echo "Content-Type: image/svg+xml; charset=utf-8"
+ echo
-REQUEST_METHOD=
-/home/roland/osm-3s/cgi-bin/interpreter </tmp/sketch_line_req >/tmp/sketch_line_req.1
-dd if=/tmp/sketch_line_req.1 of=/tmp/sketch_line_req.2 bs=1 skip=56
-gunzip </tmp/sketch_line_req.2 | ../bin/sketch-route-svg $SKETCH_PARAMS
+ gunzip </tmp/sketch_line_req.2 | ../bin/sketch-route-svg $SKETCH_PARAMS
+};
+fi
@@ -78,7 +78,8 @@ of street.
<pre>&lt;width px=&quot;1200&quot;/&gt;
&lt;height px=&quot;400&quot;/&gt;
&lt;stop-font-size px=&quot;10&quot;/&gt;
-&lt;force rows=&quot;1&quot;/&gt;</pre>
+&lt;force rows=&quot;1&quot;/&gt;
+&lt;max-correspondences per-line=&quot;6&quot; below=&quot;0&quot;/&gt;</pre>
These correspond to the options that can be directly passed to sketch-line. They are
explained at the <a href=\"../public_transport.html\">public transport page</a>.
Oops, something went wrong.

0 comments on commit da12d46

Please sign in to comment.