title: How to GeoCode a simple address using Data Science Toolbox
body: <p>I am fed up with Google's geocoding, and decided to try an alternative. The Data Science Toolkit (<a href="http://www.datasciencetoolkit.org" rel="nofollow noreferrer">http://www.datasciencetoolkit.org</a>) allows you to Geocode unlimited number of addresses. R has an excellent package that serves as a wrapper for its functions (CRAN:RDSTK). The package has a function called <code>street2coordinates()</code> that interfaces with the Data Science Toolkit's geocoding utility.</p>
  <p>However, the RDSTK function <code>street2coordinates()</code> does not work if you try to geocode something simple like <em>City, Country</em>. In the following example I will try to use the function to get the latitude and longitude for the city of Phoenix:</p>
  <pre><code>&gt; require(&quot;RDSTK&quot;)
  &gt; street2coordinates(&quot;Phoenix+Arizona+United+States&quot;)
  [1] full.address
  &lt;0 rows&gt; (or 0-length row.names)
  </code></pre>
  <p>The utility from the data science toolkit works perfectly. This is the URL request that gives the answer:
  <a href="http://www.datasciencetoolkit.org/maps/api/geocode/json?sensor=false&amp;address=Phoenix+Arizona+United+States" rel="nofollow noreferrer">http://www.datasciencetoolkit.org/maps/api/geocode/json?sensor=false&amp;address=Phoenix+Arizona+United+States</a></p>
  <p>I am interested in geocoding multiple addresses (which complete addresses and city names). I know that the Data Science Toolkit URL will work well.</p>
  <p><strong>How do I interface with the URL and get multiple latitudes and longitudes into a data frame with the addresses?</strong></p>
  <p>Here is an sample dataset:</p>
  <pre><code>dff &lt;- data.frame(address=c(
    &quot;Birmingham, Alabama, United States&quot;,
    &quot;Mobile, Alabama, United States&quot;,
    &quot;Phoenix, Arizona, United States&quot;,
    &quot;Tucson, Arizona, United States&quot;,
    &quot;Little Rock, Arkansas, United States&quot;,
    &quot;Berkeley, California, United States&quot;,
    &quot;Duarte, California, United States&quot;,
    &quot;Encinitas, California, United States&quot;,
    &quot;La Jolla, California, United States&quot;,
    &quot;Los Angeles, California, United States&quot;,
    &quot;Orange, California, United States&quot;,
    &quot;Redwood City, California, United States&quot;,
    &quot;Sacramento, California, United States&quot;,
    &quot;San Francisco, California, United States&quot;,
    &quot;Stanford, California, United States&quot;,
    &quot;Hartford, Connecticut, United States&quot;,
    &quot;New Haven, Connecticut, United States&quot;
    ))
  </code></pre>