{"action":"created","comment":{"url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/comments/40521268","id":40521268,"diff_hunk":"@@ -12,667 +12,317 @@ if [ -f $FILE ]; then\n rm $FILE\n fi\n \n+gather_statistics(){\n+\n+\t#SETUP THE VARIOUS VARIABLES FOR THE STATISTICS COMPILATION\t\n+\tVAL=(${!1})\t\t\t#Array with values to be used for statistics for a table\n+\tTABLE=$2\t\t\t#Table Name from which stats are to be accumulated\n+\tOPTION=$3\t\t\t#Type of PSQL command to be used for the particular table\n+\tcount=0\t\t\t\t#STAT Count\n+\tif [ \"$OPTION\" = '1' ] || [ \"$OPTION\" = \"3\" ]; then \n+\t\tKEY=2\n+\telif [ \"$OPTION\" = \"2\" ] || [ \"$OPTION\" = \"4\" ] || [ \"$OPTION\" = \"5\" ]; then\n+\t\tKEY=3\n+\tfi\n+\n+\t#START COMPILATION OF STATISTICS\n+\tfor ELEMENT in \"${VAL[@]}\"\n+\t\tdo\n+\t\t\tcase $OPTION in\n+\t\t\n+\t\t\t1) \n+\t\t\t\tTYPE=\"where type='\"$ELEMENT\"'\"\n+\t\t\t\tLABEL=\"\";;\t\t\t\t\t\t#No LABEL to be attached, just the variable from the array\n+\t\t\t2) \n+\t\t\t\tTYPE=\"where type='\"$ELEMENT\"'\"\n+\t\t\t\tLABEL=$4\",\";;\t\t\t\t\t\t#Label to be attached to the stat count in the \"FILE\"\n+\t\t\t3)\n+\t\t\t\tTYPE=\"where type='\"$4\"' and status='\"$ELEMENT\"'\"\n+\t\t\t\tLABEL=$4\",\";;\t\t\t\t\t\t#Label to be attached to the stat count in the \"FILE\"\n+\t\t\t4)\n+\t\t\t\tTYPE=\"where aggtype='\"$4\"' and type='\"$ELEMENT\"'\"\n+\t\t\t\tLABEL=$4\",\";;\t\t\t\t\t\t#Label to be attached to the stat count in the \"FILE\"\n+\t\t\t5)\n+\t\t\t\tTYPE=\"where aggtype<>'\"$5\"' and type='\"$ELEMENT\"'\"\t#As LABEL and aggtype parameter are different we need a fifth argument\n+\t\t\t\tLABEL=$4\",\";;\n+\t\t\tesac\n+\n+\t\t\tCOUNT=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.$TABLE $TYPE and osmaxx.$TABLE.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n+\t\t\tprintf \"$LABEL%20s,%20s\\n\" $ELEMENT\t$COUNT>>TEMP.txt;\n+\t\tdone\n+\tsort --key=$KEY --reverse --numeric-sort TEMP.txt>>$FILE\n+\trm TEMP.txt\n+\techo >>$FILE\n+}\n+\n+\n+\n+#Different Tables with their arrays for statistics compilation\n+#How to call the function\n+#gather_statistics <array> <table_name> <Type of PSQL statement(1,2,3,4)> <Label for tables with subentries> <aggtype parameter When Type=5>\n+#The Special Case is for Table Road_l and subentry Road(or !roundabout)\n+\n #adminarea_a\n echo \"adminarea_a\">> $FILE\n val=(admin_level1 national admin_level3 admin_level4 admin_level5 admin_level6 admin_level7 admin_level8 admin_level9 admin_level10 admin_level11 administrative national_park protected_area)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.adminarea_a where type='\"$val\"' and osmaxx.adminarea_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] adminarea_a 1\n \n #boundary_l\n echo 'boundary_l'>>$FILE\n val=(admin_level1 national admin_level3 admin_level4 admin_level5 admin_level6 admin_level7 admin_level8 admin_level9 admin_level10 admin_level11 administrative national_park protected_area)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.boundary_l where type='\"$val\"' and osmaxx.boundary_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@]  boundary_l 1\n \n #geoname_l\n echo 'geoname_l'>>$FILE\n val=(city town village hamlet suburb island farm isolated_dwelling locality islet neighbourhood county region state municipality named_place place)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.geoname_l where type='\"$val\"' and osmaxx.geoname_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] geoname_l 1\n \n #geoname_a\n echo 'geoname_a'>>$FILE\n val=(city town village hamlet suburb island farm isolated_dwelling locality islet neighbourhood county region state municipality named_place place)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.geoname_p where type='\"$val\"' and osmaxx.geoname_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] geoname_p 1\n \n #landuse_a\n echo 'landuse_a'>>$FILE\n val=(allotments commercial farm farmyard fishfarm grass greenhouse industrial forest meadow military nature_reserve orchard park plant_nursery quarry railway recreation_ground residential retail vineyard reservoir basin landfill landuse)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.landuse_a where type='\"$val\"' and osmaxx.landuse_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] landuse_a 1\n \n #military_a\n echo 'military_a'>>$FILE\n val=(airfield barracks bunker checkpoint danger_area naval_base nuclear_site obstacle_course range training_area military)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.military_a where type='\"$val\"' and osmaxx.military_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] military_a 1\n \n #military_p\n echo 'military_p'>>$FILE\n val=(airfield barracks bunker checkpoint danger_area naval_base nuclear_site obstacle_course range training_area military)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.military_p where type='\"$val\"' and osmaxx.military_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] military_p 1\n \n #misc_l\n echo 'misc_l'>>$FILE\n val=(barrier gate fence city_wall hedge \"wall\" avalanche_protection retaining_wall cliff traffic_calming hump bump table chicane cushion)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.misc_l where type='\"$val\"' and osmaxx.misc_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] misc_l 1\n \n #natural_a\n echo 'natural_a'>>$FILE\n val=(bare_rock beach cave_entrance fell grassland heath moor mud scrub sand scree sinkhole wood glacier wetland natural)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.natural_a where type='\"$val\"' and osmaxx.natural_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] natural_a 1\n \n #natural_p\n echo 'natural_p'>>$FILE\n val=(beach cave_entrance fell grassland heath moor mud peak rock saddle sand scrub sinkhole stone tree volcano wood glacier wetland natural)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.natural_p where type='\"$val\"' and osmaxx.natural_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] natural_p 1\n \n #nonop_l\n echo 'nonop_l'>>$FILE\n val=(P C D A)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.nonop_l where type='highway' and status='\"$val\"' and osmaxx.nonop_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"highway,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] nonop_l 3 highway\n \n val=(P C D A)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.nonop_l where type='railway' and status='\"$val\"' and osmaxx.nonop_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"railway,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] nonop_l 3 railway\n \n \n #pow_a\n echo 'pow_a'>>$FILE\n val=(christian anglican baptist  catholic evangelical lutheran methodist orthodox protestant mormon presbyterian hindu jewish muslim shia sunni shinto sikh taoist place_of_worship)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.pow_a where type='\"$val\"' and osmaxx.pow_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] pow_a 1\n \n #pow_p\n echo 'pow_p'>>$FILE\n val=(christian anglican baptist  catholic evangelical lutheran methodist orthodox protestant mormon presbyterian hindu jewish muslim shia sunni shinto sikh taoist place_of_worship)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.pow_p where type='\"$val\"' and osmaxx.pow_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] pow_p 1\n \n #poi_a\n echo 'poi_a'>>$FILE\n val=(police fire_station post_box post_office telephone library townhall courthouse prison embassy community_centre nursing_home arts_centre grave_yard marketplace)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"public,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 2 public\n \n val=(general_recycling glass paper clothes metal)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"recycling,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 2 recycling\n \n val=(university school kindergarten college public_building)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"education,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 2 education\n \n val=(pharmacy hospital clinic social_facility doctors dentist veterinary)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"health,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 2 health\n \n val=(theatre nightclub cinema playground dog_park sports_centre tennis_pitch soccer_pitch swimming_pool golf_course stadium ice_rink leisure)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='leisure' and type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"leisure,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 4 leisure\n \n val=(restaurant fast_food cafe pub bar food_court biergarten)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"catering,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 2 catering\n \n val=(hotel motel guest_house hostel chalet)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"accomondation_in,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 2 accomodation_in\n \n val=(shelter camp_site alpine_hut caravan_site)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"accomondation_out,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n-\n+gather_statistics val[@] poi_a 2 accomodation_out\n \n val=(supermarket bakery kiosk mall department_store convenience clothes florist chemist books butcher shoes beverages optician jewelry gift sports stationery outdoor mobile_phone toys newsagent greengrocer beauty video car bicycle hardware furniture computer garden_centre hairdresser car_repair car_rental car_wash car_sharing bicycle_rental travel_agency laundry shop)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='shop' and type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"shop,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 4 shop\n \n val=(vending_machine vending_cigarettes vending_parking)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='vending' and type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"vending,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n-\n+gather_statistics val[@] poi_a 4 vending\n \n val=(bank atm money_changer)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='money' and type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"money,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 4 money\n \n val=(information map board guidepost tourism)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='tourism' and type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"tourism,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 4 tourism\n \n val=(attraction museum monument memorial artwork castle ruins archaeological_site wayside_cross wayside_shrine battlefield fort picnic_site viewpoint zoo theme_park)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"destination,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_a 2 destination\n \n val=(toilets bench drinking_water fountain hunting_stand waste_basket surveillance emergency_phone fire_hydrant emergency_access tower comm_tower water_tower observation_tower windmill lighthouse wastewater_plant water_well watermill water_works )\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where type='\"$val\"' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"miscpoi,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE \n+gather_statistics val[@] poi_a 2 miscpoi\n \n echo 'sport'>>$FILE\n-count=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='sport' and type='sport' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-printf \"sport    sport %20s\\n\" $count>>$FILE;\n+val=(sport)\n+gather_statistics val[@] poi_a 4 sport\n \n echo 'man_made'>>$FILE\n-count=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='man_made' and type='man_made' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-printf \"man_made man_made %20s\\n\" $count>>$FILE;\n+val=(man_made)\n+gather_statistics val[@] poi_a 4 man_made\n \n echo 'historic'>>$FILE\n-count=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='historic' and type='historic' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-printf \"historic historic %20s\\n\" $count>>$FILE;\n+val=(historic)\n+gather_statistics val[@] poi_a 4 historic\n \n echo 'amenity'>>$FILE\n-count=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_a where aggtype='amenity' and type='amenity' and osmaxx.poi_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-printf \"amenity  amenity %20s\\n\" $count>>$FILE;\n+val=(amenity)\n+gather_statistics val[@] poi_a 4 amenity\n \n \n #poi_p\n echo 'poi_p'>>$FILE\n val=(police fire_station post_box post_office telephone library townhall courthouse prison embassy community_centre nursing_home arts_centre grave_yard marketplace)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"public,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 2 public\n \n val=(general_recycling glass paper clothes metal)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"recycling,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 2 recycling\n \n val=(university school kindergarten college public_building)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"education,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 2 education\n \n val=(pharmacy hospital clinic social_facility doctors dentist veterinary)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"health,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 2 health\n \n val=(theatre nightclub cinema playground dog_park sports_centre tennis_pitch soccer_pitch swimming_pool golf_course stadium ice_rink leisure)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='leisure' and type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"leisure,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 4 leisure\n \n val=(restaurant fast_food cafe pub bar food_court biergarten)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"catering,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 2 catering\n \n val=(hotel motel guest_house hostel chalet)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"accomondation_in,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 2 accomodation_in\n \n val=(shelter camp_site alpine_hut caravan_site)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"accomondation_out,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 2 accomodation_out\n \n val=(supermarket bakery kiosk mall department_store convenience clothes florist chemist books butcher shoes beverages optician jewelry gift sports stationery outdoor mobile_phone toys newsagent greengrocer beauty video car bicycle hardware furniture computer garden_centre hairdresser car_repair car_rental car_wash car_sharing bicycle_rental travel_agency laundry shop)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='shop' and type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"shop,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 4 shop\n \n val=(vending_machine vending_cigarettes vending_parking)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='vending' and type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"vending,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n-\n+gather_statistics val[@] poi_p 4 vending\n \n val=(bank atm money_changer)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='money' and type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"money,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 4 money\n \n val=(information map board guidepost tourism)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='tourism' and type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"tourism,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 4 tourism\n \n val=(attraction museum monument memorial artwork castle ruins archaeological_site wayside_cross wayside_shrine battlefield fort picnic_site viewpoint zoo theme_park)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"destination,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] poi_p 2 destination\n \n val=(toilets bench drinking_water fountain hunting_stand waste_basket surveillance emergency_phone fire_hydrant emergency_access tower comm_tower water_tower observation_tower windmill lighthouse wastewater_plant water_well watermill water_works )\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where type='\"$val\"' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"miscpoi,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE \n+gather_statistics val[@] poi_p 2 miscpoi\n \n echo 'sport'>>$FILE\n-count=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='sport' and type='sport' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-printf \"sport    sport %20s\\n\" $count>>$FILE;\n+val=(sport)\n+gather_statistics val[@] poi_p 4 sport\n \n echo 'man_made'>>$FILE\n-count=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='man_made' and type='man_made' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-printf \"man_made man_made %20s\\n\" $count>>$FILE;\n+val=(man_made)\n+gather_statistics val[@] poi_p 4 man_made\n \n echo 'historic'>>$FILE\n-count=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='historic' and type='historic' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-printf \"historic historic %20s\\n\" $count>>$FILE;\n+val=(historic)\n+gather_statistics val[@] poi_p 4 historic\n \n echo 'amenity'>>$FILE\n-count=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.poi_p where aggtype='amenity' and type='amenity' and osmaxx.poi_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-printf \"amenity  amenity %20s\\n\" $count>>$FILE;\n+val=(amenity)\n+gather_statistics val[@] poi_p 4 amenity\n \n #railway_l\n echo 'railway_l'>>$FILE\n val=(rail light_rail subway tram monorail narrow_gauge miniature funicular railway drag_lift chair_lift cable_car gondola goods platter t-bar j-bar magic_carpet zip_line rope_tow mixed_lift aerialway)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.railway_l where type='\"$val\"' and osmaxx.railway_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] railway_l 1\n \n #road_l\n echo 'road_l'>>$FILE\n val=(motorway trunk primary secondary tertiary unclassified residential living_street pedestrian motorway_link trunk_link primary_link secondary_link service track grade1 grade2 grade3 grade4 grade5 bridleway cycleway footway path steps road)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.road_l where aggtype<>'roundabout' and type='\"$val\"' and osmaxx.road_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"road,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] road_l 5 road roundabout\n \n val=(motorway trunk primary secondary tertiary unclassified residential living_street pedestrian motorway_link trunk_link primary_link secondary_link service track grade1 grade2 grade3 grade4 grade5 bridleway cycleway footway path steps roundabout)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.road_l where aggtype='roundabout' and type='\"$val\"' and osmaxx.road_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"roundabout,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort -k3 -rn TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] road_l 4 roundabout\n+\n \n #route_l\n echo 'route_l'>>$FILE\n val=(bicycle bus inline_skates canoe detour ferry hiking horse light_rail mtb nordic_walking pipeline piste power railway road running ski train tram route)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.route_l where type='\"$val\"' and osmaxx.route_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] route_l 1\n+\n \n #traffic_a\n echo 'traffic_a'>>$FILE\n val=(fuel parking surface multi-storey underground bicycle )\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.traffic_a where type='\"$val\"' and osmaxx.traffic_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] traffic_a 1\n \n #traffic_p\n echo 'traffic_p'>>$FILE\n val=(general_traffic traffic_signals mini_roundabout stop crossing level_crossing speed_camera motorway_junction turning_circle ford street_lamp barrier entrance gate bollard lift_gate stile cycle_barrier fence toll_booth block kissing_gate cattle_grid traffic_calming hump bump table chicane cushion fuel services parking surface multi-storey underground bicycle)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.traffic_p where type='\"$val\"' and osmaxx.traffic_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] traffic_p 1\n \n #transport_a\n echo 'transport_a'>>$FILE\n val=(railway_station railway_halt bus_stop bus_station taxi_stand airport runway helipad ferry_terminal aerialway_station aeroway aerialway stop_position taxiway apron)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.transport_a where type='\"$val\"' and osmaxx.transport_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] transport_a 1\n \n #transport_p\n echo 'transport_p'>>$FILE\n val=(railway_station railway_halt tram_stop bus_stop bus_station taxi_stand airport runway helipad ferry_terminal aerialway_station aeroway aerialway stop_position taxiway apron)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.transport_p where type='\"$val\"' and osmaxx.transport_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n-\n+gather_statistics val[@] transport_p 1\n \n #utility_a\n echo 'utility_a'>>$FILE\n val=(tower station nuclear solar fossil hydro wind substation transformer water_works wastewater_plant power)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.utility_a where type='\"$val\"' and osmaxx.utility_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] utility_a 1\n \n #utility_p\n echo 'utility_p'>>$FILE\n val=(tower pole station nuclear solar fossil hydro wind substation transformer water_works wastewater_plant power)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.utility_p where type='\"$val\"' and osmaxx.utility_p.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] utility_p 1\n \n #utility_l\n echo 'utility_l'>>$FILE\n val=(line minor_line cable minor_cable power)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.utility_l where type='\"$val\"' and osmaxx.utility_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"power,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] utility_l 2 power\n+\n val=(pipeline)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.utility_l where type='\"$val\"' and osmaxx.utility_l.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"man_made,%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] utility_l 2 man_made\n \n #water_a\n echo 'water_a'>>$FILE\n val=(water spring riverbank slipway marina pier dam weir reservoir_covered waterway)\n-for val in ${val[@]}\n-do\n-\tcount=$(psql -U postgres -Atc \"SELECT count(type) from osmaxx.water_a where type='\"$val\"' and osmaxx.water_a.geom && ST_MakeEnvelope($XMIN, $YMIN, $XMAX, $YMAX, $CRS)\" osmaxx_db)\n-\tprintf \"%20s,%20s\\n\" $val\t$count>>TEMP.txt;\n-done\n-sort --key=2 --reverse --numeric-sort TEMP.txt>>$FILE\n-rm TEMP.txt\n-echo >>$FILE\n+gather_statistics val[@] water_a 1\n \n #water_p\n echo 'water_p'>>$FILE\n val=(water spring riverbank slipway marina pier dam waterfall lock_gate weir reservoir_covered waterway)","path":"extract/extract/extract_statistics.sh","position":769,"original_position":769,"commit_id":"2530695bfa82558ecbf6e87c6ee871862d8e2a00","original_commit_id":"2530695bfa82558ecbf6e87c6ee871862d8e2a00","user":{"login":"njordan-hsr","id":8830664,"avatar_url":"https://avatars.githubusercontent.com/u/8830664?v=3","gravatar_id":"","url":"https://api.github.com/users/njordan-hsr","html_url":"https://github.com/njordan-hsr","followers_url":"https://api.github.com/users/njordan-hsr/followers","following_url":"https://api.github.com/users/njordan-hsr/following{/other_user}","gists_url":"https://api.github.com/users/njordan-hsr/gists{/gist_id}","starred_url":"https://api.github.com/users/njordan-hsr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/njordan-hsr/subscriptions","organizations_url":"https://api.github.com/users/njordan-hsr/orgs","repos_url":"https://api.github.com/users/njordan-hsr/repos","events_url":"https://api.github.com/users/njordan-hsr/events{/privacy}","received_events_url":"https://api.github.com/users/njordan-hsr/received_events","type":"User","site_admin":false},"body":"Since `val` is a positional argument, would it be possible to actually name this according to the group it represents? (ie. `water`)","created_at":"2015-09-28T06:35:22Z","updated_at":"2015-09-28T06:35:22Z","html_url":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/25#discussion_r40521268","pull_request_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/comments/40521268"},"html":{"href":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/25#discussion_r40521268"},"pull_request":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/25","id":46008779,"html_url":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/25","diff_url":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/25.diff","patch_url":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/25.patch","issue_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/25","number":25,"state":"open","locked":false,"title":"Feature/function based statistics generation","user":{"login":"Dhruv222","id":9646546,"avatar_url":"https://avatars.githubusercontent.com/u/9646546?v=3","gravatar_id":"","url":"https://api.github.com/users/Dhruv222","html_url":"https://github.com/Dhruv222","followers_url":"https://api.github.com/users/Dhruv222/followers","following_url":"https://api.github.com/users/Dhruv222/following{/other_user}","gists_url":"https://api.github.com/users/Dhruv222/gists{/gist_id}","starred_url":"https://api.github.com/users/Dhruv222/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dhruv222/subscriptions","organizations_url":"https://api.github.com/users/Dhruv222/orgs","repos_url":"https://api.github.com/users/Dhruv222/repos","events_url":"https://api.github.com/users/Dhruv222/events{/privacy}","received_events_url":"https://api.github.com/users/Dhruv222/received_events","type":"User","site_admin":false},"body":"### Implementations: Changed extract_statistics.sh to be function based rather than have the same code repeated over\r\n* Tested by comparing with CSV file from the old version of extract_statistics.sh\r\n* Most of format of the CSV file remains the except 1 scenario which happens twice in the file\r\n* The data remains consistent with the previous version, only the format changes\r\n* The link to the image to see the difference: http://imgur.com/XwkHpAL\r\n\r\n* We are actually gathering statistics through two files, extract_statistics.sh and  https://github.com/geometalab/osmaxx-postgis-conversion/blob/develop/bootstrap/statistics.sh\r\n* I would like to know what should I do with this file?\r\n* The only between the files is that the 2nd one actually gathers stats about address_p as well whereas extract_statistics doesnt\r\n\r\nTo be reviewed by:\r\n- [ ] @sfkeller \r\n- [ ] @das-g \r\n- [ ] @njordan-hsr \r\n- [x] @wasabideveloper ","created_at":"2015-09-25T12:57:49Z","updated_at":"2015-09-28T06:35:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b27f755dc7462901d3f3311e1423a8feef4c28ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/25/commits","review_comments_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/25/comments","review_comment_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/25/comments","statuses_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/statuses/2530695bfa82558ecbf6e87c6ee871862d8e2a00","head":{"label":"geometalab:feature/function-based-statistics-generation","ref":"feature/function-based-statistics-generation","sha":"2530695bfa82558ecbf6e87c6ee871862d8e2a00","user":{"login":"geometalab","id":8266374,"avatar_url":"https://avatars.githubusercontent.com/u/8266374?v=3","gravatar_id":"","url":"https://api.github.com/users/geometalab","html_url":"https://github.com/geometalab","followers_url":"https://api.github.com/users/geometalab/followers","following_url":"https://api.github.com/users/geometalab/following{/other_user}","gists_url":"https://api.github.com/users/geometalab/gists{/gist_id}","starred_url":"https://api.github.com/users/geometalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometalab/subscriptions","organizations_url":"https://api.github.com/users/geometalab/orgs","repos_url":"https://api.github.com/users/geometalab/repos","events_url":"https://api.github.com/users/geometalab/events{/privacy}","received_events_url":"https://api.github.com/users/geometalab/received_events","type":"Organization","site_admin":false},"repo":{"id":36354077,"name":"osmaxx-postgis-conversion","full_name":"geometalab/osmaxx-postgis-conversion","owner":{"login":"geometalab","id":8266374,"avatar_url":"https://avatars.githubusercontent.com/u/8266374?v=3","gravatar_id":"","url":"https://api.github.com/users/geometalab","html_url":"https://github.com/geometalab","followers_url":"https://api.github.com/users/geometalab/followers","following_url":"https://api.github.com/users/geometalab/following{/other_user}","gists_url":"https://api.github.com/users/geometalab/gists{/gist_id}","starred_url":"https://api.github.com/users/geometalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometalab/subscriptions","organizations_url":"https://api.github.com/users/geometalab/orgs","repos_url":"https://api.github.com/users/geometalab/repos","events_url":"https://api.github.com/users/geometalab/events{/privacy}","received_events_url":"https://api.github.com/users/geometalab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geometalab/osmaxx-postgis-conversion","description":"Downloads OSM data, imports it into PostgreSQL, transforms it, exports it into various formats","fork":false,"url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion","forks_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/forks","keys_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/teams","hooks_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/hooks","issue_events_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/events{/number}","events_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/events","assignees_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/assignees{/user}","branches_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/branches{/branch}","tags_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/tags","blobs_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/refs{/sha}","trees_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/statuses/{sha}","languages_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/languages","stargazers_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/stargazers","contributors_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/contributors","subscribers_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/subscribers","subscription_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/subscription","commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/commits{/sha}","git_commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/commits{/sha}","comments_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/comments{/number}","issue_comment_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/comments{/number}","contents_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/contents/{+path}","compare_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/merges","archive_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/downloads","issues_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues{/number}","pulls_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls{/number}","milestones_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/milestones{/number}","notifications_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/labels{/name}","releases_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/releases{/id}","created_at":"2015-05-27T08:35:02Z","updated_at":"2015-08-18T09:18:04Z","pushed_at":"2015-09-27T10:11:55Z","git_url":"git://github.com/geometalab/osmaxx-postgis-conversion.git","ssh_url":"git@github.com:geometalab/osmaxx-postgis-conversion.git","clone_url":"https://github.com/geometalab/osmaxx-postgis-conversion.git","svn_url":"https://github.com/geometalab/osmaxx-postgis-conversion","homepage":null,"size":1112,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"develop"}},"base":{"label":"geometalab:develop","ref":"develop","sha":"be61590cfed224a577cedd95d3a28761d99f543a","user":{"login":"geometalab","id":8266374,"avatar_url":"https://avatars.githubusercontent.com/u/8266374?v=3","gravatar_id":"","url":"https://api.github.com/users/geometalab","html_url":"https://github.com/geometalab","followers_url":"https://api.github.com/users/geometalab/followers","following_url":"https://api.github.com/users/geometalab/following{/other_user}","gists_url":"https://api.github.com/users/geometalab/gists{/gist_id}","starred_url":"https://api.github.com/users/geometalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometalab/subscriptions","organizations_url":"https://api.github.com/users/geometalab/orgs","repos_url":"https://api.github.com/users/geometalab/repos","events_url":"https://api.github.com/users/geometalab/events{/privacy}","received_events_url":"https://api.github.com/users/geometalab/received_events","type":"Organization","site_admin":false},"repo":{"id":36354077,"name":"osmaxx-postgis-conversion","full_name":"geometalab/osmaxx-postgis-conversion","owner":{"login":"geometalab","id":8266374,"avatar_url":"https://avatars.githubusercontent.com/u/8266374?v=3","gravatar_id":"","url":"https://api.github.com/users/geometalab","html_url":"https://github.com/geometalab","followers_url":"https://api.github.com/users/geometalab/followers","following_url":"https://api.github.com/users/geometalab/following{/other_user}","gists_url":"https://api.github.com/users/geometalab/gists{/gist_id}","starred_url":"https://api.github.com/users/geometalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometalab/subscriptions","organizations_url":"https://api.github.com/users/geometalab/orgs","repos_url":"https://api.github.com/users/geometalab/repos","events_url":"https://api.github.com/users/geometalab/events{/privacy}","received_events_url":"https://api.github.com/users/geometalab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geometalab/osmaxx-postgis-conversion","description":"Downloads OSM data, imports it into PostgreSQL, transforms it, exports it into various formats","fork":false,"url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion","forks_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/forks","keys_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/teams","hooks_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/hooks","issue_events_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/events{/number}","events_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/events","assignees_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/assignees{/user}","branches_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/branches{/branch}","tags_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/tags","blobs_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/refs{/sha}","trees_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/statuses/{sha}","languages_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/languages","stargazers_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/stargazers","contributors_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/contributors","subscribers_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/subscribers","subscription_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/subscription","commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/commits{/sha}","git_commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/commits{/sha}","comments_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/comments{/number}","issue_comment_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/comments{/number}","contents_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/contents/{+path}","compare_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/merges","archive_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/downloads","issues_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues{/number}","pulls_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls{/number}","milestones_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/milestones{/number}","notifications_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/labels{/name}","releases_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/releases{/id}","created_at":"2015-05-27T08:35:02Z","updated_at":"2015-08-18T09:18:04Z","pushed_at":"2015-09-27T10:11:55Z","git_url":"git://github.com/geometalab/osmaxx-postgis-conversion.git","ssh_url":"git@github.com:geometalab/osmaxx-postgis-conversion.git","clone_url":"https://github.com/geometalab/osmaxx-postgis-conversion.git","svn_url":"https://github.com/geometalab/osmaxx-postgis-conversion","homepage":null,"size":1112,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/25"},"html":{"href":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/25"},"issue":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/25"},"comments":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/statuses/2530695bfa82558ecbf6e87c6ee871862d8e2a00"}}}}