<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.christiaan008.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.christiaan008.com/index.php?action=history&amp;feed=atom&amp;title=Plotting_schools_Port_Elizabeth_using_shell_scripting</id>
		<title>Plotting schools Port Elizabeth using shell scripting - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.christiaan008.com/index.php?action=history&amp;feed=atom&amp;title=Plotting_schools_Port_Elizabeth_using_shell_scripting"/>
		<link rel="alternate" type="text/html" href="https://wiki.christiaan008.com/index.php?title=Plotting_schools_Port_Elizabeth_using_shell_scripting&amp;action=history"/>
		<updated>2026-10-22T10:03:25Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.3</generator>

	<entry>
		<id>https://wiki.christiaan008.com/index.php?title=Plotting_schools_Port_Elizabeth_using_shell_scripting&amp;diff=32&amp;oldid=prev</id>
		<title>Christiaan008: Created page with &quot;&lt;pre&gt; #Script written on 3 Feb 2016 #Purpose: retrieving coordinates for schools Port Elizabeth  #While reading file &#039;schools1.csv&#039; per line, split by ; character into variabl...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.christiaan008.com/index.php?title=Plotting_schools_Port_Elizabeth_using_shell_scripting&amp;diff=32&amp;oldid=prev"/>
				<updated>2016-09-27T09:21:16Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; #Script written on 3 Feb 2016 #Purpose: retrieving coordinates for schools Port Elizabeth  #While reading file &amp;#039;schools1.csv&amp;#039; per line, split by ; character into variabl...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#Script written on 3 Feb 2016&lt;br /&gt;
#Purpose: retrieving coordinates for schools Port Elizabeth&lt;br /&gt;
&lt;br /&gt;
#While reading file &amp;#039;schools1.csv&amp;#039; per line, split by ; character into variable name,tel,phase,suburb,special&lt;br /&gt;
while IFS=&amp;quot;;&amp;quot; read -r name tel phase suburb special&lt;br /&gt;
do&lt;br /&gt;
&lt;br /&gt;
        #Take the name of a school, replace white spaces with a + sign  and &amp;#039;To Be Updated and &amp;#039;Port Elizabeth&amp;#039;  with nothing (remove)&lt;br /&gt;
        #Afterwards place after school name +Port+Elizabeth&lt;br /&gt;
        poi=$(echo $name | sed &amp;quot;s| |+|g&amp;quot; | sed &amp;quot;s|To Be Updated||g&amp;quot; | sed &amp;quot;s|Port Elizabeth||g&amp;quot; | sed &amp;quot;s|$|+Port+Elizabeth|&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
        #Do a webrequest to the Google Geocoding API&lt;br /&gt;
        request=$(curl --silent &amp;quot;https://maps.googleapis.com/maps/api/place/textsearch/xml?query=&amp;quot;$poi&amp;quot;&amp;amp;key=insertyourownkey&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
        #Take the output of the request and only use the information between &amp;lt;formatted_address&amp;gt; and &amp;lt;/formatted_address&amp;gt;&lt;br /&gt;
        formatted=$(echo $request | grep -o -P &amp;#039;(?&amp;lt;=&amp;lt;formatted_address&amp;gt;).*(?=&amp;lt;/formatted_address&amp;gt;)&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
        #Take the output of the request and only use the information between &amp;lt;lat&amp;gt; and &amp;lt;/lat&amp;gt;&lt;br /&gt;
        lat=$(echo $request | grep -o -P &amp;#039;(?&amp;lt;=&amp;lt;lat&amp;gt;).*(?=&amp;lt;/lat&amp;gt;)&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
        #Take the output of the request and only use the information between &amp;lt;lng&amp;gt; and &amp;lt;/lng&amp;gt;&lt;br /&gt;
        long=$(echo $request |  grep -o -P &amp;#039;(?&amp;lt;=&amp;lt;lng&amp;gt;).*(?=&amp;lt;/lng&amp;gt;)&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
        #Ouput name, address and coordinates to the screen&lt;br /&gt;
        echo &amp;quot;School: $name&amp;quot;&lt;br /&gt;
        echo &amp;quot;Address: $formatted&amp;quot;&lt;br /&gt;
        echo &amp;quot;Coordinates: $lat , $long&amp;quot;&lt;br /&gt;
&lt;br /&gt;
        #Go to sleep for 5 seconds (do nothing for 5 seconds)&lt;br /&gt;
        sleep 5&lt;br /&gt;
&lt;br /&gt;
        #Write the school name, Address and coordinates to the file &amp;#039;schools_w_coordinates.csv&amp;#039;&lt;br /&gt;
        echo $name&amp;quot;;&amp;quot;$formatted&amp;quot;;&amp;quot;$lat&amp;quot;;&amp;quot;$long &amp;gt;&amp;gt; schools_w_coordinates.csv&lt;br /&gt;
&lt;br /&gt;
#End the while loop&lt;br /&gt;
done &amp;lt; &amp;quot;schools1.csv&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Christiaan008</name></author>	</entry>

	</feed>