nodes-csv.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. ARG_1=`echo $QUERY_STRING | awk -F [=,\&] '{ print $1; }'`
  3. ARG_2=`echo $QUERY_STRING | awk -F [=,\&] '{ print $2; }'`
  4. ARG_3=`echo $QUERY_STRING | awk -F [=,\&] '{ print $3; }'`
  5. ARG_4=`echo $QUERY_STRING | awk -F [=,\&] '{ print $4; }'`
  6. ARG_5=`echo $QUERY_STRING | awk -F [=,\&] '{ print $5; }'`
  7. ARG_6=`echo $QUERY_STRING | awk -F [=,\&] '{ print $6; }'`
  8. ARG_7=`echo $QUERY_STRING | awk -F [=,\&] '{ print $7; }'`
  9. ARG_8=`echo $QUERY_STRING | awk -F [=,\&] '{ print $8; }'`
  10. echo -e "\
  11. <osm-script timeout=\"180\" element-limit=\"10000000\"> \
  12. \
  13. <union> \
  14. <id-query type=\"relation\" ref=\"$ARG_1\"/> \
  15. <recurse type=\"relation-node\"/> \
  16. </union> \
  17. <print mode=\"body\"/> \
  18. \
  19. </osm-script> \
  20. " >/tmp/nodes_csv_req
  21. REQUEST_METHOD=
  22. /home/roland/osm-3s/cgi-bin/interpreter </tmp/nodes_csv_req >/tmp/nodes_csv_result.1
  23. RESPONSE_TYPE=`head -n 1 </tmp/nodes_csv_result.1`
  24. if [[ $RESPONSE_TYPE != "Content-type: application/osm3s" ]]; then
  25. {
  26. cat </tmp/nodes_csv_result.1
  27. exit 0
  28. };
  29. fi
  30. dd if=/tmp/nodes_csv_result.1 of=/tmp/nodes_csv_result.2 bs=1 skip=56
  31. echo "Content-Type: text/html; charset=utf-8"
  32. echo
  33. if [[ $ARG_2 == "forward" ]]; then
  34. {
  35. gunzip </tmp/nodes_csv_result.2 | ../bin/nodes-csv-lat-lon-name --forward
  36. };
  37. fi
  38. if [[ $ARG_2 == "backward" ]]; then
  39. {
  40. gunzip </tmp/nodes_csv_result.2 | ../bin/nodes-csv-lat-lon-name --backward
  41. };
  42. fi
  43. if [[ $ARG_2 == "all" ]]; then
  44. {
  45. gunzip </tmp/nodes_csv_result.2 | ../bin/nodes-csv-lat-lon-name
  46. };
  47. fi