{"id":3436,"date":"2016-09-27T19:50:14","date_gmt":"2016-09-27T18:50:14","guid":{"rendered":"https:\/\/blog.christiaan008.com\/?p=3436"},"modified":"2016-10-09T16:54:36","modified_gmt":"2016-10-09T15:54:36","slug":"plotting-schools-port-elizabeth-using-shell-scripting","status":"publish","type":"post","link":"https:\/\/blog.christiaan008.com\/?p=3436","title":{"rendered":"Plotting schools Port Elizabeth using shell scripting"},"content":{"rendered":"<p>[et_pb_section admin_label=&#8221;section&#8221; background_image=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/header_port_elizabeth_hd_darker.jpg&#8221; transparent_background=&#8221;off&#8221; background_color=&#8221;rgba(0,0,0,0)&#8221; allow_player_pause=&#8221;off&#8221; inner_shadow=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; padding_mobile=&#8221;off&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; make_equal=&#8221;off&#8221; use_custom_gutter=&#8221;off&#8221; fullwidth=&#8221;off&#8221; specialty=&#8221;off&#8221; disabled=&#8221;off&#8221;][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;off&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; padding_mobile=&#8221;off&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;on&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;on&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;on&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_3&#8243;][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_divider admin_label=&#8221;Divider&#8221; color=&#8221;#ffffff&#8221; height=&#8221;200&#8243; divider_style=&#8221;solid&#8221; divider_position=&#8221;top&#8221; divider_weight=&#8221;1px&#8221; hide_on_mobile=&#8221;on&#8221; disabled=&#8221;off&#8221;] [\/et_pb_divider][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;72&#8243; text_font_size_tablet=&#8221;52&#8243; text_text_color=&#8221;#ffffff&#8221; text_line_height=&#8221;1.1em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;0px||0px|&#8221; disabled=&#8221;off&#8221; text_font_size_phone=&#8221;42&#8243; text_font_size_last_edited=&#8221;on|phone&#8221; border_color=&#8221;#ffffff&#8221; custom_margin_phone=&#8221;30px||30px|&#8221; custom_margin_last_edited=&#8221;on|phone&#8221;]<\/p>\n<p>Plotting\u00a0schools Port Elizabeth\u00a0using shell scripting<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section admin_label=&#8221;Section&#8221; transparent_background=&#8221;off&#8221; background_color=&#8221;#f7f7f4&#8243; allow_player_pause=&#8221;off&#8221; inner_shadow=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; padding_mobile=&#8221;off&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; make_equal=&#8221;off&#8221; use_custom_gutter=&#8221;off&#8221; fullwidth=&#8221;off&#8221; specialty=&#8221;off&#8221; disabled=&#8221;off&#8221;][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;0px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;10em&#8221; text_text_color=&#8221;#323232&#8243; text_line_height=&#8221;1.1em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;0px||0px|&#8221; disabled=&#8221;off&#8221;] 27 [\/et_pb_text][et_pb_divider admin_label=&#8221;Divider&#8221; color=&#8221;#aeaeac&#8221; show_divider=&#8221;on&#8221; divider_style=&#8221;solid&#8221; divider_position=&#8221;top&#8221; divider_weight=&#8221;1px&#8221; hide_on_mobile=&#8221;off&#8221; custom_css_main_element=&#8221;width:20px;&#8221; disabled=&#8221;off&#8221;] [\/et_pb_divider][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Sans|on|||&#8221; text_font_size=&#8221;18&#8243; text_text_color=&#8221;#363636&#8243; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;-10px||0px|&#8221; disabled=&#8221;off&#8221;] SEPTEMBER, 2016 [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Sans||||&#8221; text_text_color=&#8221;#02b875&#8243; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;20px|||&#8221; disabled=&#8221;off&#8221;]<\/p>\n<p><a href=\"https:\/\/blog.christiaan008.com\/category\/scripting\/\">Scripting<\/a><\/p>\n<p><a href=\"https:\/\/blog.christiaan008.com\/category\/south-africa\/\">South Africa<\/a><\/p>\n<p>[\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Sans||||&#8221; text_text_color=&#8221;#02b875&#8243; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;20px|||&#8221; disabled=&#8221;off&#8221;] Reading time: ~15 min [\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;24&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.4em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;10px||0px|&#8221; disabled=&#8221;off&#8221;]<\/p>\n<p>Earlier this year I was in Port Elizabeth, South Africa to help the organization <a title=\"Ready4Life\" href=\"http:\/\/ready4life.org\" target=\"_blank\">Ready4Life<\/a> with their Smart School Network project.<\/p>\n<p>To gain an overview of all the schools that can be connected to the Smart School Network we wanted to plot\u00a0all the schools in Port Elizabeth and the surrounded townships onto Google Maps.<\/p>\n<p>The script explained\u00a0in\u00a0this post can be found on the <a href=\"https:\/\/wiki.christiaan008.com\/index.php\/Plotting_schools_Port_Elizabeth_using_shell_scripting\" target=\"_blank\">wiki<\/a>.<\/p>\n<p>[\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;80px|||&#8221; disabled=&#8221;off&#8221; inline_fonts=&#8221;Abel,Amatic SC,Arimo,Arvo,Bevan,Bitter,Black Ops One,Boogaloo,Bree Serif,Calligraffitti,Cantata One,Cardo,Changa One,Cherry Cream Soda,Chewy,Comfortaa,Coming Soon,Covered By Your Grace,Crafty Girls,Crete Round,Crimson Text,Cuprum,Dancing Script,Dosis,Droid Sans,Droid Serif,Francois One,Fredoka One,The Girl Next Door,Gloria Hallelujah,Happy Monkey,Indie Flower,Josefin Slab,Judson,Kreon,Lato,Lato Light,Lobster,Leckerli One,PT Serif&#8221;]<\/p>\n<h2 style=\"text-align: center;\"><span style=\"font-family: 'PT Serif'; font-size: x-large;\">The challenge<\/span><\/h2>\n<p>My South African IT colleague was able to find his way on the &#8216;net&#8217; and found a list of all the schools in Port Elizabeth.\u00a0As you can see in the image the list of schools he found had an suburb for every school.<\/p>\n<p>In this overview there was not an exact address or sometimes there was no suburb provided for a school. We could solve this challenge by manually looking up every school.<\/p>\n<p>[\/et_pb_text][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/website_w_schools_port_elizabeth.jpg&#8221; alt=&#8221;Overview schools Port Elizabeth&#8221; title_text=&#8221;Overview schools Port Elizabeth&#8221; show_in_lightbox=&#8221;on&#8221; url=&#8221;http:\/\/www.schools4sa.co.za\/province\/eastern-cape\/port-elizabeth\/&#8221; url_new_window=&#8221;on&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;off&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_width=&#8221;1px&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;50px||50px|&#8221; disabled=&#8221;off&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;||0px|&#8221; disabled=&#8221;off&#8221;]<\/p>\n<p>Since the list consisted of 175 schools\u00a0manually looking up every school would take quite some time.<\/p>\n<p>My South African friend tried really hard to look up every school and collect coordinates, but at the end of the day he only found the coordinates for a couple of schools.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;50px|||&#8221; custom_padding_tablet=&#8221;17px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;on&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;4_4&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/google_maps_schools_port_elizabeth_1.jpg&#8221; alt=&#8221;Schools Port Elizabeth onto Google Maps&#8221; title_text=&#8221;Schools Port Elizabeth onto Google Maps&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;on&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;on&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221; url=&#8221;https:\/\/www.flickr.com\/photos\/132889348@N07\/29969489565&#8243;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;16&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;20px||0px|&#8221; disabled=&#8221;off&#8221;] Schools Port Elizabeth plotted onto Google Maps [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;6px|||&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Photograph by Christiaan Colen available on <a href=\"https:\/\/www.flickr.com\/photos\/132889348@N07\/29969489565\" target=\"_blank\">Flickr<\/a><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;0px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled_on=&#8221;off|off|off&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_3&#8243;][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; disabled_on=&#8221;off|off|off&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px|||&#8221; disabled=&#8221;off&#8221;]<\/p>\n<h2 style=\"text-align: center;\"><span style=\"font-family: 'PT Serif'; font-size: x-large;\">The solution<\/span><\/h2>\n<p>The next morning I thought we can do this easier, time to create a shell script for it. We copied all the information from the webpage into Excel and with the help of some Excel formulas created an easy overview of all the schools.<\/p>\n<p>This overview could then be exported as a CSV file that used the &#8216;;&#8217; (semicolon) sign as a separator to separate the data of the different fields such as the name of the school, suburb\u00a0or telephone number.<\/p>\n<p>Exporting all the data to a CSV file made it easy to use it in Linux and write a script to process the data. Less then an hour of scripting resulted in the script that&#8217;s explained further in this post. It&#8217;s not that &#8216;fancy&#8217; but it gets the job done with just a couple lines of code.<\/p>\n<p>[\/et_pb_text][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/screenshots_csv_schools_port_elizabeth.jpg&#8221; alt=&#8221;CSV file with schools Port Elizabeth&#8221; title_text=&#8221;CSV file with schools Port Elizabeth&#8221; show_in_lightbox=&#8221;on&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;off&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; disabled_on=&#8221;off|off|off&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_width=&#8221;1px&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; disabled=&#8221;off&#8221;]<\/p>\n<p>I&#8217;m going to use the Google Maps Places API to retrieve coordinates for a school. For those who don&#8217;t know what an API is, in short &#8216;an API is the messenger that runs and delivers your request to the provider you\u2019re requesting it from, and then delivers the response back to you&#8217;. For more information see this visual <a href=\"https:\/\/www.youtube.com\/watch?v=s7wmiS2mSXY\" target=\"_blank\">explanation<\/a>.<\/p>\n<p>To be more accurate I&#8217;m using\u00a0the <a href=\"https:\/\/developers.google.com\/places\/web-service\/search\" target=\"_blank\">Google Maps Text Search Service<\/a>.\u00a0A short description from the Google Maps API documentation:<\/p>\n<p>&#8220;<em>The Google Places API Text Search Service is a web service that returns information about a set of places based on a string \u2014 for example &#8220;pizza in New York&#8221; or &#8220;shoe stores near Ottawa&#8221;. The service responds with a list of places matching the text string and any location bias that has been set.<\/em>&#8221;<\/p>\n<p>This means that I&#8217;m asking Google Maps for coordinates (latitude, longitude) given a point of interest. In this case it&#8217;s based on the school&#8217;s name and place, for example Philip Nikiwe P School Port Elizabeth needs to result into 33.8974800 , 25.5875800 (coordinates).<\/p>\n<p>Before using this Google Maps service you need to retrieve an API key first, to retrieve an API key have a look at the <a href=\"https:\/\/developers.google.com\/places\/web-service\/get-api-key\" target=\"_blank\">documentation<\/a>.<\/p>\n<p>After saving all the retrieved coordinates, names of the schools\u00a0and addresses into a new CSV file we could upload the data to Google&#8217;s <a href=\"https:\/\/support.google.com\/fusiontables\/answer\/2571232\" target=\"_blank\">Fusion Tables<\/a>\u00a0to automatically plot it onto Google Maps. The result can be viewed <a href=\"https:\/\/www.google.com\/fusiontables\/DataSource?docid=1isnikzr8BKhoeqXICJJBPtvTS1vd47H0Y6gQcFMO#map:id=3\" target=\"_blank\">here<\/a>.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;50px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;on&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;4_4&#8243;][et_pb_divider admin_label=&#8221;Divider&#8221; color=&#8221;#aeaeac&#8221; show_divider=&#8221;on&#8221; divider_style=&#8221;solid&#8221; divider_position=&#8221;top&#8221; divider_weight=&#8221;1px&#8221; hide_on_mobile=&#8221;off&#8221; disabled=&#8221;off&#8221;] [\/et_pb_divider][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; max_width=&#8221;900px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;48&#8243; text_font_size_tablet=&#8221;38&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.3em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;16px||30px|&#8221; disabled=&#8221;off&#8221;] Nothing is impossible, the word itself says &#8216;I&#8217;m possible&#8217;! &#8211;\u00a0Audrey Hepburn [\/et_pb_text][et_pb_divider admin_label=&#8221;Divider&#8221; color=&#8221;#aeaeac&#8221; show_divider=&#8221;on&#8221; divider_style=&#8221;solid&#8221; divider_position=&#8221;top&#8221; divider_weight=&#8221;1px&#8221; hide_on_mobile=&#8221;off&#8221; disabled=&#8221;off&#8221;] [\/et_pb_divider][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;16px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_3&#8243;][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px|||&#8221; disabled=&#8221;off&#8221;]<\/p>\n<h2 style=\"text-align: center;\"><span style=\"font-family: 'PT Serif'; font-size: x-large;\">The script<\/span><\/h2>\n<p>Now it&#8217;s time for the technical part! Whenever you write\u00a0a\u00a0shell script you need to start with &#8216;<strong>#!\/bin\/bash<\/strong>&#8216; so the computer knows what interpreter (language) is going to be used to process the instructions.<\/p>\n<p>The &#8216;<strong>#<\/strong>&#8216; (hash) sign in a shell script will allow you to write comments, like reminders.<\/p>\n<p>Lets start with the first line of code &#8216;the while loop&#8217;. The basic principle of the while loop in this case is while reading a file do something.<\/p>\n<p>[\/et_pb_text][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/shell_script_schools_port_elizabeth_2.jpg&#8221; alt=&#8221;Shell script point of interest to coordinates&#8221; title_text=&#8221;Shell script point of interest to coordinates&#8221; show_in_lightbox=&#8221;on&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;off&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_width=&#8221;1px&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;5%||5%|&#8221; disabled=&#8221;off&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; disabled=&#8221;off&#8221;]<\/p>\n<p>For this script it means <span style=\"text-decoration: underline;\">while readin<\/span>g<span style=\"text-decoration: underline;\"> a line<\/span> from the file schools1.csv <span style=\"text-decoration: underline;\">do read all the input into different variables<\/span> that are separated by the &#8216;;&#8217; sign to store the data.<\/p>\n<p>This makes it possible to read a line and store the name of a school into the variable called &#8216;name&#8217; or to read the telephone number and store it into the variable &#8216;tel&#8217;.<\/p>\n<p><strong>while IFS=&#8221;;&#8221; read -r name tel phase suburb special<\/strong><\/p>\n<p><strong>do<\/strong><\/p>\n<p style=\"padding-left: 30px;\"><strong>something<\/strong><\/p>\n<p><strong>done &lt; &#8220;schools1.csv&#8221;<\/strong><\/p>\n<p>[\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px|||&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Onto the next line:<\/p>\n<p><strong>poi=$(echo $name | sed &#8220;s| |+|g&#8221; | sed &#8220;s|To Be Updated||g&#8221; | sed &#8220;s|Port Elizabeth||g&#8221; | sed &#8216;s|$|+Port+Elizabeth|&#8217;)<\/strong><\/p>\n<p>Here we create a variable called &#8216;<span style=\"text-decoration: underline;\">poi<\/span>&#8216; (short for point of interest). The data in this variable will be used in a next step to request data via the Google Maps API.\u00a0We need to prepare the data a bit so it has always the same structure, otherwise it&#8217;s possible that some of the requests won&#8217;t give a correct result due to misunderstanding the data when performing a request.<\/p>\n<p>The first thing we do is &#8216;<span style=\"text-decoration: underline;\">echo $name<\/span>&#8216;, which will put the name of the school into the variable &#8216;<span style=\"text-decoration: underline;\">poi<\/span>&#8216;.\u00a0The data could sometimes be containing more then only the name of a school. For this reason\u00a0we are going to replace or remove certain text strings with the &#8216;<span style=\"text-decoration: underline;\">sed<\/span>&#8216; command so the data has always a certain structure.<\/p>\n<p>The sed command &#8216;<span style=\"text-decoration: underline;\">sed &#8220;s| |+|g&#8221;<\/span>&#8216; will replace all empty spaces (also called white space) with a &#8216;+&#8217; sign, this is necessary for the API request. By replacing empty spaces with a &#8216;+&#8217; sign the Google Maps API will know that there needs to be an empty space when proccesing the request.<\/p>\n<p>Going back to the school example:\u00a0Philip Nikiwe P School Port Elizabeth will translate into\u00a0Philip+Nikiwe+P+School+Port+Elizabeth. \u00a0When you look at an URL of a website you will never see an empty space in the URL (it&#8217;s not allowed), normally it&#8217;s converted to a &#8216;+&#8217; (plus) or &#8216;-&#8216; (hyphen) or &#8216;_&#8217; (underscore) sign.<\/p>\n<p>The next two commands <span style=\"text-decoration: underline;\">(sed &#8220;s|To Be Updated||g&#8221; | sed &#8220;s|Port Elizabeth||g&#8221;)<\/span> will replace &#8216;To be Updated&#8217; and &#8216;Port Elizabeth&#8217; with nothing, it&#8217;s removing it if it&#8217;s a part of the data.<\/p>\n<p>The last command &#8216;<span style=\"text-decoration: underline;\">sed &#8220;s|$|+Port+Elizabeth|&#8221;<\/span>&#8216;\u00a0will append &#8216;+Port+Elizabeth&#8217; to all the data. By doing this\u00a0Philip+Nikiwe+P+School will result into\u00a0Philip+Nikiwe+P+School+Port+Elizabeth.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;50px|||&#8221; custom_padding_tablet=&#8221;17px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;on&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;4_4&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/blogpost_shell_script_schools_port_elizabeth_7.jpg&#8221; alt=&#8221;The different variable in the shell script&#8221; title_text=&#8221;The different variable in the shell script&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;on&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;on&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221; url=&#8221;https:\/\/www.flickr.com\/photos\/132889348@N07\/29854858262&#8243;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;16&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;20px||0px|&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>The different variables in the shell script.<\/p>\n<p>[\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;6px|||&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Photograph by Christiaan Colen available on <a href=\"https:\/\/www.flickr.com\/photos\/132889348@N07\/29854858262\" target=\"_blank\">Flickr<\/a><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;0px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled_on=&#8221;off|off|off&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_3&#8243;][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px|||&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Next up doing the actual request to the Google Maps API. This is done by the next line in the script:<\/p>\n<p><strong>request=$(curl &#8211;silent &#8220;https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/xml?query=&#8221;$poi&#8221;&amp;key=insertyourkey&#8221;)<\/strong><\/p>\n<p>Here we create a variable called &#8216;<span style=\"text-decoration: underline;\">request<\/span>&#8216;. We use the Linux &#8216;<span style=\"text-decoration: underline;\">curl<\/span>&#8216; program to do a web request (ask a question). You can compare it to you typing the web request in the URL field of your browser. The &#8216;<span style=\"text-decoration: underline;\">&#8211;silent<\/span>&#8216; will suppress output to the command line, this means the generated output won&#8217;t be shown on the screen.<\/p>\n<p>Next is the Google Maps API URL address. The full request will look something like:<\/p>\n<p><strong>request=$(curl &#8211;silent &#8220;https:\/\/maps.googleapis.com\/maps\/api\/place\/textsearch\/xml?query=Philip+Nikiwe+P+School+Port+Elizabeth&amp;key=APIKEY1234&#8221;)<\/strong><\/p>\n<p>As you can see after textsearch we define that the response needs to be in XML format. For those reading that don&#8217;t know what XML means the <a href=\"https:\/\/en.wikipedia.org\/wiki\/XML\">Wikipedia<\/a> definition:<\/p>\n<p>&#8220;<em>Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.<\/em>&#8221;<\/p>\n<p>To make it more visual in the image below the XML output of the request for\u00a0Philip Nikiwe P School Port Elizabeth.<\/p>\n<p>[\/et_pb_text][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/xml_response_google_maps.jpg&#8221; alt=&#8221;XML example Google Maps API output&#8221; title_text=&#8221;XML example Google Maps API output&#8221; show_in_lightbox=&#8221;on&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;off&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_width=&#8221;1px&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221;] [\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;on&#8221; gutter_width=&#8221;2&#8243; custom_padding=&#8221;50px|||&#8221; custom_padding_tablet=&#8221;30px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_2&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/blogpost_shell_script_schools_port_elizabeth_4-3.jpg&#8221; alt=&#8221;Shell script poi to coordinates&#8221; title_text=&#8221;Shell script poi to coordinates&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;on&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221; url=&#8221;https:\/\/www.flickr.com\/photos\/132889348@N07\/29854860342&#8243;] [\/et_pb_image][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/blogpost_shell_script_schools_port_elizabeth_1-10.jpg&#8221; alt=&#8221;Shell script poi to coordinates&#8221; title_text=&#8221;Shell script poi to coordinates&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;on&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;34px|||&#8221; disabled=&#8221;off&#8221; url=&#8221;https:\/\/www.flickr.com\/photos\/132889348@N07\/29675236050&#8243;] [\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;1_2&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/blogpost_shell_script_schools_port_elizabeth_2-2.jpg&#8221; alt=&#8221;Shell script poi to coordinates&#8221; title_text=&#8221;Shell script poi to coordinates&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;on&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221; url=&#8221;https:\/\/www.flickr.com\/photos\/132889348@N07\/29854861042&#8243;] [\/et_pb_image][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/blogpost_shell_script_schools_port_elizabeth_3-2.jpg&#8221; alt=&#8221;Shell script poi to coordinates&#8221; title_text=&#8221;Shell script poi to coordinates&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;on&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;34px|||&#8221; disabled=&#8221;off&#8221; url=&#8221;https:\/\/www.flickr.com\/photos\/132889348@N07\/29854860712&#8243;] [\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;17px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_3&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/blogpost_shell_script_schools_port_elizabeth_5-2.jpg&#8221; alt=&#8221;Schools Port Elizabeth onto Google Maps&#8221; title_text=&#8221;Schools Port Elizabeth onto Google Maps&#8221; show_in_lightbox=&#8221;on&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; sticky=&#8221;off&#8221; align=&#8221;left&#8221; max_width=&#8221;140px&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;off&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_width=&#8221;1px&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;36px||0px|&#8221; disabled=&#8221;off&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;140px&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;16&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.1em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;16px||0px|&#8221; disabled=&#8221;off&#8221;] Schools Port Elizabeth plotted onto Google Maps. [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;140px&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;6px|||&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Photographs by Christiaan Colen available on\u00a0<a href=\"https:\/\/www.flickr.com\/photos\/132889348@N07\/29854859652\/\" target=\"_blank\"><span style=\"color: #02ab6b;\">Flickr<\/span><\/a><\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Next step:\u00a0<strong>formatted=$(echo $request | grep -o -P &#8216;(?&lt;=&lt;formatted_address&gt;).*(?=&lt;\/formatted_address&gt;)&#8217;)<\/strong><\/p>\n<p>Here we create a variable called &#8216;<span style=\"text-decoration: underline;\">formatted<\/span>&#8216;. The purpose of this variable is to get the &#8216;formatted address&#8217; Google Maps provided. According to the Google documentation:<\/p>\n<p>&#8220;<em>formatted_address is a string containing the human-readable address of this location. Often this address is equivalent to the &#8220;postal address,&#8221; which sometimes differs from country to country.<\/em>&#8221;<\/p>\n<p>How do we get the formatted address?<\/p>\n<p>It&#8217;s quite easy since the output we requested is XML we only have to get the values between the formatted_address tags. For the variable we first\u00a0&#8216;<span style=\"text-decoration: underline;\">echo<\/span>&#8216;\u00a0(&#8216;print&#8217;)\u00a0the output of the web request and then use &#8216;<span style=\"text-decoration: underline;\">grep<\/span>&#8216; to get all the data between the &#8216;<span style=\"text-decoration: underline;\">&lt;formatted_address&gt;<\/span>&#8216; and &#8216;<span style=\"text-decoration: underline;\">&lt;\/formatted_address&gt;<\/span>&#8216; strings. &#8216;<span style=\"text-decoration: underline;\">grep -o<\/span>&#8216; means that it will only take the data that is asked, no data surrounding the found data. That&#8217;s it.<\/p>\n<p>Back to\u00a0the\u00a0Philip Nikiwe P School Port Elizabeth example, the output of the above command will result into &#8216;New Brighton 1, Ibahyi, 6200, South Africa&#8217;.<\/p>\n<p>The same is done for the latitude (&lt;lat&gt;) and longtitude (&lt;lng&gt;) values.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;50px|||&#8221; custom_padding_tablet=&#8221;17px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;on&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;4_4&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/blogpost_shell_script_schools_port_elizabeth_6-1.jpg&#8221; alt=&#8221;Shell script school&#8217;s name to coordinates&#8221; title_text=&#8221;Shell script school&#8217;s name to coordinates&#8221; show_in_lightbox=&#8221;off&#8221; url_new_window=&#8221;on&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;on&#8221; align=&#8221;left&#8221; force_fullwidth=&#8221;off&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221; url=&#8221;https:\/\/www.flickr.com\/photos\/132889348@N07\/29675235080&#8243;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;16&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;20px||0px|&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Getting the latitude and longitude values.<\/p>\n<p>[\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; text_font=&#8221;PT Serif||on||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;6px|||&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Photograph by Christiaan Colen available on <a href=\"https:\/\/www.flickr.com\/photos\/132889348@N07\/29675235080\" target=\"_blank\">Flickr<\/a><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; custom_padding=&#8221;0px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled_on=&#8221;off|off|off&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_3&#8243;][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;left&#8221; max_width=&#8221;620px&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;20&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.5em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px||0px|&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;]<\/p>\n<p>Once we have these three values the next step is to &#8216;<span style=\"text-decoration: underline;\">echo<\/span>&#8216; (&#8216;print&#8217;) all the data to the screen so you can see it while the script is running.<\/p>\n<p>After generating the output to the screen the script will go to &#8216;<span style=\"text-decoration: underline;\">sleep<\/span>&#8216; for 5 seconds. This means that no command is executed for 5 seconds and had to be done because I got problems with asking the Google Maps API too much too fast.<\/p>\n<p>The last step:<\/p>\n<p><strong>echo $name&#8221;;&#8221;$formatted&#8221;;&#8221;$lat&#8221;;&#8221;$long &gt;&gt; schools_w_coordinates.csv<\/strong><\/p>\n<p>This will store all the data into the file &#8216;<span style=\"text-decoration: underline;\">schools_w_coordinates.csv<\/span>&#8216; separated by\u00a0&#8216;;&#8217; sign.<\/p>\n<p>In case of the Philip Nikiwe P School example it will look like:<\/p>\n<p><strong>echo\u00a0Philip Nikiwe P School;New Brighton 1, Ibahyi, 6200, South Africa;-33.8974800;25.5875800<\/strong><\/p>\n<p>The &#8216;<span style=\"text-decoration: underline;\">&gt;&gt;<\/span>&#8216;\u00a0(two times greater than sign) is used to append the data to the file every time an entry in the while loop is done. If you use one &#8216;<span style=\"text-decoration: underline;\">&gt;<\/span>&#8216; \u00a0sign then it will create a new file for every entry that is processed which means (since the filename is the same for every entry) it would overwrite the existing file.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section admin_label=&#8221;Section&#8221; transparent_background=&#8221;off&#8221; allow_player_pause=&#8221;off&#8221; inner_shadow=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;on&#8221; padding_mobile=&#8221;off&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;off&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; make_equal=&#8221;off&#8221; use_custom_gutter=&#8221;off&#8221; fullwidth=&#8221;off&#8221; specialty=&#8221;off&#8221; disabled=&#8221;off&#8221;][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;on&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;780px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;off&#8221; gutter_width=&#8221;3&#8243; padding_mobile=&#8221;off&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;on&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;on&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;4_4&#8243;][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Serif||||&#8221; text_font_size=&#8221;36&#8243; text_font_size_tablet=&#8221;26&#8243; text_text_color=&#8221;#363636&#8243; text_line_height=&#8221;1.4em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;||70px|&#8221; disabled=&#8221;off&#8221;] Music videos of the day [\/et_pb_text][et_pb_video_slider admin_label=&#8221;Video Slider&#8221; show_image_overlay=&#8221;hide&#8221; show_arrows=&#8221;on&#8221; show_thumbnails=&#8221;off&#8221; controls_color=&#8221;dark&#8221; disabled=&#8221;off&#8221;] [et_pb_video_slider_item src=&#8221;https:\/\/www.youtube.com\/watch?v=-JkWUfUM_-o&#8221; image_src=&#8221;\/\/i.ytimg.com\/vi\/-JkWUfUM_-o\/hqdefault.jpg&#8221; background_layout=&#8221;dark&#8221; disabled=&#8221;off&#8221; show_image_overlay=&#8221;hide&#8221;] [\/et_pb_video_slider_item][et_pb_video_slider_item src=&#8221;https:\/\/www.youtube.com\/watch?v=Cwm6ZmRZP1M&#8221; image_src=&#8221;\/\/i.ytimg.com\/vi\/Cwm6ZmRZP1M\/hqdefault.jpg&#8221; background_layout=&#8221;dark&#8221; disabled=&#8221;off&#8221; show_image_overlay=&#8221;hide&#8221;] [\/et_pb_video_slider_item][et_pb_video_slider_item src=&#8221;https:\/\/www.youtube.com\/watch?v=yvXmMOEuWwE&#8221; image_src=&#8221;\/\/i.ytimg.com\/vi\/yvXmMOEuWwE\/hqdefault.jpg&#8221; background_layout=&#8221;dark&#8221; disabled=&#8221;off&#8221; show_image_overlay=&#8221;hide&#8221;] [\/et_pb_video_slider_item][et_pb_video_slider_item src=&#8221;https:\/\/www.youtube.com\/watch?v=pgQQ7k30Ti4&#8243; image_src=&#8221;\/\/i.ytimg.com\/vi\/pgQQ7k30Ti4\/hqdefault.jpg&#8221; background_layout=&#8221;dark&#8221; disabled=&#8221;off&#8221; show_image_overlay=&#8221;hide&#8221;][\/et_pb_video_slider_item] [\/et_pb_video_slider][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section admin_label=&#8221;Section&#8221; transparent_background=&#8221;off&#8221; background_color=&#8221;#222222&#8243; allow_player_pause=&#8221;off&#8221; inner_shadow=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; custom_padding=&#8221;0px||0px|&#8221; padding_mobile=&#8221;on&#8221; make_fullwidth=&#8221;off&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; make_equal=&#8221;off&#8221; use_custom_gutter=&#8221;off&#8221; fullwidth=&#8221;off&#8221; specialty=&#8221;off&#8221; disabled=&#8221;off&#8221;][et_pb_row admin_label=&#8221;Row&#8221; make_fullwidth=&#8221;on&#8221; use_custom_width=&#8221;off&#8221; width_unit=&#8221;on&#8221; custom_width_px=&#8221;1080px&#8221; custom_width_percent=&#8221;80%&#8221; use_custom_gutter=&#8221;on&#8221; gutter_width=&#8221;2&#8243; custom_padding=&#8221;40px|||&#8221; padding_mobile=&#8221;on&#8221; allow_player_pause=&#8221;off&#8221; parallax=&#8221;off&#8221; parallax_method=&#8221;off&#8221; make_equal=&#8221;off&#8221; column_padding_mobile=&#8221;on&#8221; parallax_1=&#8221;off&#8221; parallax_method_1=&#8221;off&#8221; parallax_2=&#8221;off&#8221; parallax_method_2=&#8221;off&#8221; parallax_3=&#8221;off&#8221; parallax_method_3=&#8221;off&#8221; parallax_4=&#8221;off&#8221; parallax_method_4=&#8221;on&#8221; disabled=&#8221;off&#8221;][et_pb_column type=&#8221;1_3&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/06\/flickr_api_code3_hd.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url=&#8221;https:\/\/blog.christiaan008.com\/2016\/07\/12\/retrieving-flickr-photo-views-using-shell-scripting\/&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221; alt=&#8221;Retrieving Flickr photo views using shell scripting&#8221; title_text=&#8221;Retrieving Flickr photo views using shell scripting&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans|on|||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#888888&#8243; text_letter_spacing=&#8221;2px&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px|||&#8221; disabled=&#8221;off&#8221;] <a href=\"https:\/\/blog.christiaan008.com\/category\/scripting\/\" target=\"_blank\">SCRIPTING<\/a> [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;24&#8243; text_text_color=&#8221;#ffffff&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221;] <span style=\"color: #ffffff;\"><a style=\"color: #ffffff;\" href=\"https:\/\/blog.christiaan008.com\/2016\/07\/12\/retrieving-flickr-photo-views-using-shell-scripting\/\">Retrieving\u00a0Flickr photo <\/a><a style=\"color: #ffffff;\" href=\"https:\/\/blog.christiaan008.com\/2016\/07\/12\/retrieving-flickr-photo-views-using-shell-scripting\/\">views using shell scripting<\/a><\/span> [\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2015\/11\/shell_script1_high.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url=&#8221;https:\/\/blog.christiaan008.com\/2015\/11\/08\/dynamically-splitting-output-into-files-while-processing\/&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;on&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_width=&#8221;1px&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans|on|||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#888888&#8243; text_letter_spacing=&#8221;2px&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px|||&#8221; disabled=&#8221;off&#8221;] <a href=\"https:\/\/blog.christiaan008.com\/category\/scripting\/\" target=\"_blank\">SCRIPTING<\/a> [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;24&#8243; text_text_color=&#8221;#ffffff&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221;]<\/p>\n<p><a href=\"https:\/\/blog.christiaan008.com\/2015\/11\/08\/dynamically-splitting-output-into-files-while-processing\/\"><span style=\"color: #ffffff;\">Dynamically splitting output into <\/span><\/a><br \/>\n<span style=\"color: #ffffff;\">files while processing<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243;][et_pb_image admin_label=&#8221;Image&#8221; src=&#8221;https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2015\/01\/cover.jpg&#8221; show_in_lightbox=&#8221;off&#8221; url=&#8221;https:\/\/blog.christiaan008.com\/2015\/01\/16\/building-a-pole-for-the-wifi-project\/&#8221; url_new_window=&#8221;off&#8221; use_overlay=&#8221;off&#8221; animation=&#8221;fade_in&#8221; sticky=&#8221;off&#8221; align=&#8221;center&#8221; force_fullwidth=&#8221;on&#8221; always_center_on_mobile=&#8221;on&#8221; use_border_color=&#8221;off&#8221; border_color=&#8221;#ffffff&#8221; border_width=&#8221;1px&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221;] [\/et_pb_image][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans|on|||&#8221; text_font_size=&#8221;12&#8243; text_text_color=&#8221;#888888&#8243; text_letter_spacing=&#8221;2px&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; custom_margin=&#8221;30px|||&#8221; disabled=&#8221;off&#8221;] <a href=\"https:\/\/blog.christiaan008.com\/category\/south-africa\/\" target=\"_blank\">SOUTH AFRICA<\/a> [\/et_pb_text][et_pb_text admin_label=&#8221;Text&#8221; background_layout=&#8221;light&#8221; text_orientation=&#8221;center&#8221; text_font=&#8221;PT Sans||||&#8221; text_font_size=&#8221;24&#8243; text_text_color=&#8221;#ffffff&#8221; text_line_height=&#8221;1.2em&#8221; use_border_color=&#8221;off&#8221; border_style=&#8221;solid&#8221; disabled=&#8221;off&#8221;]<\/p>\n<p><a href=\"https:\/\/blog.christiaan008.com\/2015\/01\/16\/building-a-pole-for-the-wifi-project\/\"><span style=\"color: #ffffff;\">Building a pole for <\/span><\/a><br \/>\n<span style=\"color: #ffffff;\">the WiFi project<\/span><\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I will explain how to use the Google Maps API to retrieve coordinates for points of interest via shell scripting.<\/p>\n","protected":false},"author":2,"featured_media":3437,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"categories":[43,40],"tags":[],"class_list":["post-3436","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","category-south-africa"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Plotting schools Port Elizabeth using shell scripting | Christiaan&#039;s blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.christiaan008.com\/?p=3436\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Plotting schools Port Elizabeth using shell scripting | Christiaan&#039;s blog\" \/>\n<meta property=\"og:description\" content=\"In this post I will explain how to use the Google Maps API to retrieve coordinates for points of interest via shell scripting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.christiaan008.com\/?p=3436\" \/>\n<meta property=\"og:site_name\" content=\"Christiaan&#039;s blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/christiaan008\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-27T18:50:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-10-09T15:54:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/header_port_elizabeth_hd.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christiaan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@christiaan008\" \/>\n<meta name=\"twitter:site\" content=\"@christiaan008\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christiaan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"32 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436\"},\"author\":{\"name\":\"Christiaan\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#\\\/schema\\\/person\\\/80afd7344699708649053651d6583631\"},\"headline\":\"Plotting schools Port Elizabeth using shell scripting\",\"datePublished\":\"2016-09-27T18:50:14+00:00\",\"dateModified\":\"2016-10-09T15:54:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436\"},\"wordCount\":6352,\"image\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.christiaan008.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2016\\\/09\\\/header_port_elizabeth_hd.jpg\",\"articleSection\":[\"Scripting\",\"South Africa\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436\",\"url\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436\",\"name\":\"Plotting schools Port Elizabeth using shell scripting | Christiaan&#039;s blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.christiaan008.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2016\\\/09\\\/header_port_elizabeth_hd.jpg\",\"datePublished\":\"2016-09-27T18:50:14+00:00\",\"dateModified\":\"2016-10-09T15:54:36+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#\\\/schema\\\/person\\\/80afd7344699708649053651d6583631\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436#primaryimage\",\"url\":\"https:\\\/\\\/blog.christiaan008.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2016\\\/09\\\/header_port_elizabeth_hd.jpg\",\"contentUrl\":\"https:\\\/\\\/blog.christiaan008.com\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2016\\\/09\\\/header_port_elizabeth_hd.jpg\",\"width\":1920,\"height\":1080,\"caption\":\"Schools Port Elizabeth onto Google Maps\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/?p=3436#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.christiaan008.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Plotting schools Port Elizabeth using shell scripting\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#website\",\"url\":\"https:\\\/\\\/blog.christiaan008.com\\\/\",\"name\":\"Christiaan&#039;s blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.christiaan008.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.christiaan008.com\\\/#\\\/schema\\\/person\\\/80afd7344699708649053651d6583631\",\"name\":\"Christiaan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g\",\"caption\":\"Christiaan\"},\"url\":\"https:\\\/\\\/blog.christiaan008.com\\\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Plotting schools Port Elizabeth using shell scripting | Christiaan&#039;s blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.christiaan008.com\/?p=3436","og_locale":"en_US","og_type":"article","og_title":"Plotting schools Port Elizabeth using shell scripting | Christiaan&#039;s blog","og_description":"In this post I will explain how to use the Google Maps API to retrieve coordinates for points of interest via shell scripting.","og_url":"https:\/\/blog.christiaan008.com\/?p=3436","og_site_name":"Christiaan&#039;s blog","article_publisher":"https:\/\/www.facebook.com\/christiaan008","article_published_time":"2016-09-27T18:50:14+00:00","article_modified_time":"2016-10-09T15:54:36+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/header_port_elizabeth_hd.jpg","type":"image\/jpeg"}],"author":"Christiaan","twitter_card":"summary_large_image","twitter_creator":"@christiaan008","twitter_site":"@christiaan008","twitter_misc":{"Written by":"Christiaan","Est. reading time":"32 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.christiaan008.com\/?p=3436#article","isPartOf":{"@id":"https:\/\/blog.christiaan008.com\/?p=3436"},"author":{"name":"Christiaan","@id":"https:\/\/blog.christiaan008.com\/#\/schema\/person\/80afd7344699708649053651d6583631"},"headline":"Plotting schools Port Elizabeth using shell scripting","datePublished":"2016-09-27T18:50:14+00:00","dateModified":"2016-10-09T15:54:36+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.christiaan008.com\/?p=3436"},"wordCount":6352,"image":{"@id":"https:\/\/blog.christiaan008.com\/?p=3436#primaryimage"},"thumbnailUrl":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/header_port_elizabeth_hd.jpg","articleSection":["Scripting","South Africa"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blog.christiaan008.com\/?p=3436","url":"https:\/\/blog.christiaan008.com\/?p=3436","name":"Plotting schools Port Elizabeth using shell scripting | Christiaan&#039;s blog","isPartOf":{"@id":"https:\/\/blog.christiaan008.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.christiaan008.com\/?p=3436#primaryimage"},"image":{"@id":"https:\/\/blog.christiaan008.com\/?p=3436#primaryimage"},"thumbnailUrl":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/header_port_elizabeth_hd.jpg","datePublished":"2016-09-27T18:50:14+00:00","dateModified":"2016-10-09T15:54:36+00:00","author":{"@id":"https:\/\/blog.christiaan008.com\/#\/schema\/person\/80afd7344699708649053651d6583631"},"breadcrumb":{"@id":"https:\/\/blog.christiaan008.com\/?p=3436#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.christiaan008.com\/?p=3436"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.christiaan008.com\/?p=3436#primaryimage","url":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/header_port_elizabeth_hd.jpg","contentUrl":"https:\/\/blog.christiaan008.com\/wp-content\/uploads\/sites\/2\/2016\/09\/header_port_elizabeth_hd.jpg","width":1920,"height":1080,"caption":"Schools Port Elizabeth onto Google Maps"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.christiaan008.com\/?p=3436#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.christiaan008.com\/"},{"@type":"ListItem","position":2,"name":"Plotting schools Port Elizabeth using shell scripting"}]},{"@type":"WebSite","@id":"https:\/\/blog.christiaan008.com\/#website","url":"https:\/\/blog.christiaan008.com\/","name":"Christiaan&#039;s blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.christiaan008.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.christiaan008.com\/#\/schema\/person\/80afd7344699708649053651d6583631","name":"Christiaan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9dccd3d7797978fc75633bf236d50d191dc2475023f14a9226da5a9a9495288d?s=96&d=mm&r=g","caption":"Christiaan"},"url":"https:\/\/blog.christiaan008.com\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/posts\/3436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3436"}],"version-history":[{"count":107,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/posts\/3436\/revisions"}],"predecessor-version":[{"id":3563,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/posts\/3436\/revisions\/3563"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=\/wp\/v2\/media\/3437"}],"wp:attachment":[{"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.christiaan008.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}