<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>$ /usr/bin/blog</title>
	<atom:link href="http://woconnor.ca/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://woconnor.ca/blog</link>
	<description>Geek blog about software and things</description>
	<lastBuildDate>Thu, 09 Feb 2012 04:18:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Forecasting with R</title>
		<link>http://woconnor.ca/blog/2011/12/06/forecasting-with-r/</link>
		<comments>http://woconnor.ca/blog/2011/12/06/forecasting-with-r/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 04:58:15 +0000</pubDate>
		<dc:creator>woconnor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://woconnor.ca/blog/?p=38</guid>
		<description><![CDATA[For the past month I&#8217;ve been tracking my weight daily as part of a long term project. I am also tracking all expenses for my car I bought this year for commuting. I have vague plans on calculating statistics and &#8230; <a href="http://woconnor.ca/blog/2011/12/06/forecasting-with-r/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For the past month I&#8217;ve been tracking my weight daily as part of a long term project.  I am also tracking all expenses for my car I bought this year for commuting.  I have vague plans on calculating statistics and running analyses as I collect more data, but for now I am just accumulating data.  In the meantime I am reading the R Cookbook from O&#8217;Reilly&#8217;s <a href="http://shop.oreilly.com/category/deals/data-science-kit.do">Data Science Starter Kit</a> I bought recently to learn data analysis.</p>
<p>One neat idea I had would be to forecast tomorrow&#8217;s weight.  For a little bit of instant gratification, I looked up one method for predicting the next value in a time series using an <a href="http://en.wikipedia.org/wiki/ARIMA">ARIMA</a> model.  I&#8217;m not yet sure if this is the best model to use in this case, but it seems like a good start, and some diagnostics suggest it may be good.  Here&#8217;s a snippet I cobbled together to read my CSV data and predict the next value (format of file is &#8220;Date,Weight&#8221;):</p>
<p><code><style type="text/css">


/* *************************************************** */
/* WordPress default theme "twenty-ten" compatibility: */
/* FIXME: Is there a way to limit these changes to pygmentize_5mLIyR  */
/*        without editing the WordPress theme directly? */
/* *************************************************** */

#content pre {
  /* The background: transparent is needed to work with WordPress:*/
  background: transparent;
  /* Default WordPress style has a big fat <pre> margin-bottom: */
  margin-bottom: 0px;

  /*color: #333333;*/
  font-size: .9em; 
  line-height: 1.25em;
}

#content table {
}

#content table {
	border: 1px solid #e7e7e7;
    margin: 0 0 0 0;
	text-align: left;
	width: 100%;
}
#content tr th,
#content thead th {
	color: #888;
	font-size: 12px;
	font-weight: bold;
	line-height: 18px;
	padding: 0px;
}
#content tr td {
	border: 0px;
	padding: 0px;
	margin: 0px;
    margin-bottom: 0px;
    padding-bottom: 0px;

}

/* *************************************************** */
/* *************************************************** */

/* Standard fixes to the default output: */

/* Set the tab width in "ch" character units: */
.pygmentize_5mLIyR .tabspan {
  display: inline-block;
  width: 4ch;
}

/* When using line numbers, use 100% table width and no cellpadding: */
.pygmentize_5mLIyRtable {
  width: 100%;
  border-spacing: 0px;
  border-collapse: collapse;
}


/*
#content table {
    border: 1px solid #E7E7E7;
    margin: 0 -1px 24px 0;
    text-align: left;
    width: 100%;
}
*/

.pygmentize_5mLIyRtable td, .pygmentize_5mLIyRtable th {
  padding: 0px;
  margin: 0px;
}

/* Add a little buffer so the monotype font doesn't bump directly against the edge: */
.pygmentize_5mLIyR pre {
  padding: .6ch;
  
}

/* This is more consistent with <p> tags... I didn't like it for my use: */
/*
div .pygmentize_5mLIyR {
    margin-bottom: 24px; 
}
*/

td.linenos.pygmentize_5mLIyR {
  width: 1ch;
  padding: .6ch;
  line-height: 1.25em;
}

.pygmentize_5mLIyR td {
  padding-right: 1px;
}


td.linenos { background-color: #f0f0f0; padding-right: 1px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
.pygmentize_5mLIyR .hll { background-color: #ffffcc }
.pygmentize_5mLIyR  { background: #ffffff; }
.pygmentize_5mLIyR .c { color: #999988; font-style: italic } /* Comment */
.pygmentize_5mLIyR .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.pygmentize_5mLIyR .k { color: #000000; font-weight: bold } /* Keyword */
.pygmentize_5mLIyR .o { color: #000000; font-weight: bold } /* Operator */
.pygmentize_5mLIyR .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.pygmentize_5mLIyR .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.pygmentize_5mLIyR .c1 { color: #999988; font-style: italic } /* Comment.Single */
.pygmentize_5mLIyR .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.pygmentize_5mLIyR .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.pygmentize_5mLIyR .ge { color: #000000; font-style: italic } /* Generic.Emph */
.pygmentize_5mLIyR .gr { color: #aa0000 } /* Generic.Error */
.pygmentize_5mLIyR .gh { color: #999999 } /* Generic.Heading */
.pygmentize_5mLIyR .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.pygmentize_5mLIyR .go { color: #888888 } /* Generic.Output */
.pygmentize_5mLIyR .gp { color: #555555 } /* Generic.Prompt */
.pygmentize_5mLIyR .gs { font-weight: bold } /* Generic.Strong */
.pygmentize_5mLIyR .gu { color: #aaaaaa } /* Generic.Subheading */
.pygmentize_5mLIyR .gt { color: #aa0000 } /* Generic.Traceback */
.pygmentize_5mLIyR .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
.pygmentize_5mLIyR .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
.pygmentize_5mLIyR .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
.pygmentize_5mLIyR .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
.pygmentize_5mLIyR .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
.pygmentize_5mLIyR .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.pygmentize_5mLIyR .m { color: #009999 } /* Literal.Number */
.pygmentize_5mLIyR .s { color: #d01040 } /* Literal.String */
.pygmentize_5mLIyR .na { color: #008080 } /* Name.Attribute */
.pygmentize_5mLIyR .nb { color: #0086B3 } /* Name.Builtin */
.pygmentize_5mLIyR .nc { color: #445588; font-weight: bold } /* Name.Class */
.pygmentize_5mLIyR .no { color: #008080 } /* Name.Constant */
.pygmentize_5mLIyR .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
.pygmentize_5mLIyR .ni { color: #800080 } /* Name.Entity */
.pygmentize_5mLIyR .ne { color: #990000; font-weight: bold } /* Name.Exception */
.pygmentize_5mLIyR .nf { color: #990000; font-weight: bold } /* Name.Function */
.pygmentize_5mLIyR .nl { color: #990000; font-weight: bold } /* Name.Label */
.pygmentize_5mLIyR .nn { color: #555555 } /* Name.Namespace */
.pygmentize_5mLIyR .nt { color: #000080 } /* Name.Tag */
.pygmentize_5mLIyR .nv { color: #008080 } /* Name.Variable */
.pygmentize_5mLIyR .ow { color: #000000; font-weight: bold } /* Operator.Word */
.pygmentize_5mLIyR .w { color: #bbbbbb } /* Text.Whitespace */
.pygmentize_5mLIyR .mf { color: #009999 } /* Literal.Number.Float */
.pygmentize_5mLIyR .mh { color: #009999 } /* Literal.Number.Hex */
.pygmentize_5mLIyR .mi { color: #009999 } /* Literal.Number.Integer */
.pygmentize_5mLIyR .mo { color: #009999 } /* Literal.Number.Oct */
.pygmentize_5mLIyR .sb { color: #d01040 } /* Literal.String.Backtick */
.pygmentize_5mLIyR .sc { color: #d01040 } /* Literal.String.Char */
.pygmentize_5mLIyR .sd { color: #d01040 } /* Literal.String.Doc */
.pygmentize_5mLIyR .s2 { color: #d01040 } /* Literal.String.Double */
.pygmentize_5mLIyR .se { color: #d01040 } /* Literal.String.Escape */
.pygmentize_5mLIyR .sh { color: #d01040 } /* Literal.String.Heredoc */
.pygmentize_5mLIyR .si { color: #d01040 } /* Literal.String.Interpol */
.pygmentize_5mLIyR .sx { color: #d01040 } /* Literal.String.Other */
.pygmentize_5mLIyR .sr { color: #009926 } /* Literal.String.Regex */
.pygmentize_5mLIyR .s1 { color: #d01040 } /* Literal.String.Single */
.pygmentize_5mLIyR .ss { color: #990073 } /* Literal.String.Symbol */
.pygmentize_5mLIyR .bp { color: #999999 } /* Name.Builtin.Pseudo */
.pygmentize_5mLIyR .vc { color: #008080 } /* Name.Variable.Class */
.pygmentize_5mLIyR .vg { color: #008080 } /* Name.Variable.Global */
.pygmentize_5mLIyR .vi { color: #008080 } /* Name.Variable.Instance */
.pygmentize_5mLIyR .il { color: #009999 } /* Literal.Number.Integer.Long */

  </style>




<div class="pygmentize_5mLIyR"><pre><span class="n">library</span><span class="p">(</span><span class="n">zoo</span><span class="p">)</span>
<span class="n">library</span><span class="p">(</span><span class="n">forecast</span><span class="p">)</span>
<span class="n">data</span> <span class="o">&lt;-</span> <span class="n">read</span><span class="o">.</span><span class="n">csv2</span><span class="p">(</span><span class="nb">file</span><span class="o">=</span><span class="s">&quot;weight.csv&quot;</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s">&quot;,&quot;</span><span class="p">,</span> <span class="n">colClasses</span><span class="o">=</span><span class="n">c</span><span class="p">(</span><span class="s">&quot;Date&quot;</span><span class="p">,</span><span class="n">NA</span><span class="p">),</span>
                  <span class="n">head</span><span class="o">=</span><span class="n">FALSE</span><span class="p">,</span> <span class="n">stringsAsFactors</span><span class="o">=</span><span class="n">FALSE</span><span class="p">)</span>
<span class="n">dates</span> <span class="o">&lt;-</span> <span class="n">data</span><span class="p">[[</span><span class="mi">1</span><span class="p">]]</span>
<span class="n">weights</span> <span class="o">&lt;-</span> <span class="k">as</span><span class="o">.</span><span class="n">numeric</span><span class="p">(</span><span class="n">data</span><span class="p">[[</span><span class="mi">2</span><span class="p">]])</span>
<span class="n">ts</span> <span class="o">&lt;-</span> <span class="n">zoo</span><span class="p">(</span><span class="n">weights</span><span class="p">,</span> <span class="n">dates</span><span class="p">)</span>
<span class="n">m</span> <span class="o">&lt;-</span> <span class="n">auto</span><span class="o">.</span><span class="n">arima</span><span class="p">(</span><span class="n">ts</span><span class="p">)</span>
<span class="n">predict</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
</pre></div>

</code></p>
<p>This is probably a very crude way of forecasting, given that I&#8217;ve only just begun teaching myself data analysis, but it&#8217;s still cool nonetheless.  Tomorrow&#8217;s forecast is up from today; hopefully it is wrong!</p>
]]></content:encoded>
			<wfw:commentRss>http://woconnor.ca/blog/2011/12/06/forecasting-with-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Geotagging with Exif Metadata</title>
		<link>http://woconnor.ca/blog/2011/11/30/geotagging-with-exif-metadata/</link>
		<comments>http://woconnor.ca/blog/2011/11/30/geotagging-with-exif-metadata/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 04:14:00 +0000</pubDate>
		<dc:creator>woconnor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://woconnor.ca/blog/?p=18</guid>
		<description><![CDATA[Recently I was coding a prototype using the Google Maps API to geotag objects and then search by location. Geospatial metadata would be imported automatically when users uploaded files. Alternately, items could be manually geotagged by resolving an address or &#8230; <a href="http://woconnor.ca/blog/2011/11/30/geotagging-with-exif-metadata/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I was coding a prototype using the Google Maps API to geotag objects and then search by location.  Geospatial metadata would be imported automatically when users uploaded files.  Alternately, items could be manually geotagged by resolving an address or place name (using the Geocoding API) and then adjusting the resulting coordinates on the map.</p>
<p>For my demo I wanted to use photographs with geospatial metadata baked in.  Since I&#8217;m still a few months away from owning a (GPS enabled) smartphone, I had to find a way to manually set the latitude and longitude after taking some photos.  First, to get the coordinates, I used a javascript bookmarklet to alert the current centred latitude and longitude in Google Maps.  I aliased this as &#8220;<code>geo</code>&#8220;:</p>
<p><code><style type="text/css">


/* *************************************************** */
/* WordPress default theme "twenty-ten" compatibility: */
/* FIXME: Is there a way to limit these changes to pygmentize_RBFPyr  */
/*        without editing the WordPress theme directly? */
/* *************************************************** */

#content pre {
  /* The background: transparent is needed to work with WordPress:*/
  background: transparent;
  /* Default WordPress style has a big fat <pre> margin-bottom: */
  margin-bottom: 0px;

  /*color: #333333;*/
  font-size: .9em; 
  line-height: 1.25em;
}

#content table {
}

#content table {
	border: 1px solid #e7e7e7;
    margin: 0 0 0 0;
	text-align: left;
	width: 100%;
}
#content tr th,
#content thead th {
	color: #888;
	font-size: 12px;
	font-weight: bold;
	line-height: 18px;
	padding: 0px;
}
#content tr td {
	border: 0px;
	padding: 0px;
	margin: 0px;
    margin-bottom: 0px;
    padding-bottom: 0px;

}

/* *************************************************** */
/* *************************************************** */

/* Standard fixes to the default output: */

/* Set the tab width in "ch" character units: */
.pygmentize_RBFPyr .tabspan {
  display: inline-block;
  width: 4ch;
}

/* When using line numbers, use 100% table width and no cellpadding: */
.pygmentize_RBFPyrtable {
  width: 100%;
  border-spacing: 0px;
  border-collapse: collapse;
}


/*
#content table {
    border: 1px solid #E7E7E7;
    margin: 0 -1px 24px 0;
    text-align: left;
    width: 100%;
}
*/

.pygmentize_RBFPyrtable td, .pygmentize_RBFPyrtable th {
  padding: 0px;
  margin: 0px;
}

/* Add a little buffer so the monotype font doesn't bump directly against the edge: */
.pygmentize_RBFPyr pre {
  padding: .6ch;
  
}

/* This is more consistent with <p> tags... I didn't like it for my use: */
/*
div .pygmentize_RBFPyr {
    margin-bottom: 24px; 
}
*/

td.linenos.pygmentize_RBFPyr {
  width: 1ch;
  padding: .6ch;
  line-height: 1.25em;
}

.pygmentize_RBFPyr td {
  padding-right: 1px;
}


td.linenos { background-color: #f0f0f0; padding-right: 1px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
.pygmentize_RBFPyr .hll { background-color: #ffffcc }
.pygmentize_RBFPyr  { background: #ffffff; }
.pygmentize_RBFPyr .c { color: #999988; font-style: italic } /* Comment */
.pygmentize_RBFPyr .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.pygmentize_RBFPyr .k { color: #000000; font-weight: bold } /* Keyword */
.pygmentize_RBFPyr .o { color: #000000; font-weight: bold } /* Operator */
.pygmentize_RBFPyr .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.pygmentize_RBFPyr .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.pygmentize_RBFPyr .c1 { color: #999988; font-style: italic } /* Comment.Single */
.pygmentize_RBFPyr .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.pygmentize_RBFPyr .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.pygmentize_RBFPyr .ge { color: #000000; font-style: italic } /* Generic.Emph */
.pygmentize_RBFPyr .gr { color: #aa0000 } /* Generic.Error */
.pygmentize_RBFPyr .gh { color: #999999 } /* Generic.Heading */
.pygmentize_RBFPyr .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.pygmentize_RBFPyr .go { color: #888888 } /* Generic.Output */
.pygmentize_RBFPyr .gp { color: #555555 } /* Generic.Prompt */
.pygmentize_RBFPyr .gs { font-weight: bold } /* Generic.Strong */
.pygmentize_RBFPyr .gu { color: #aaaaaa } /* Generic.Subheading */
.pygmentize_RBFPyr .gt { color: #aa0000 } /* Generic.Traceback */
.pygmentize_RBFPyr .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
.pygmentize_RBFPyr .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
.pygmentize_RBFPyr .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
.pygmentize_RBFPyr .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
.pygmentize_RBFPyr .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
.pygmentize_RBFPyr .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.pygmentize_RBFPyr .m { color: #009999 } /* Literal.Number */
.pygmentize_RBFPyr .s { color: #d01040 } /* Literal.String */
.pygmentize_RBFPyr .na { color: #008080 } /* Name.Attribute */
.pygmentize_RBFPyr .nb { color: #0086B3 } /* Name.Builtin */
.pygmentize_RBFPyr .nc { color: #445588; font-weight: bold } /* Name.Class */
.pygmentize_RBFPyr .no { color: #008080 } /* Name.Constant */
.pygmentize_RBFPyr .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
.pygmentize_RBFPyr .ni { color: #800080 } /* Name.Entity */
.pygmentize_RBFPyr .ne { color: #990000; font-weight: bold } /* Name.Exception */
.pygmentize_RBFPyr .nf { color: #990000; font-weight: bold } /* Name.Function */
.pygmentize_RBFPyr .nl { color: #990000; font-weight: bold } /* Name.Label */
.pygmentize_RBFPyr .nn { color: #555555 } /* Name.Namespace */
.pygmentize_RBFPyr .nt { color: #000080 } /* Name.Tag */
.pygmentize_RBFPyr .nv { color: #008080 } /* Name.Variable */
.pygmentize_RBFPyr .ow { color: #000000; font-weight: bold } /* Operator.Word */
.pygmentize_RBFPyr .w { color: #bbbbbb } /* Text.Whitespace */
.pygmentize_RBFPyr .mf { color: #009999 } /* Literal.Number.Float */
.pygmentize_RBFPyr .mh { color: #009999 } /* Literal.Number.Hex */
.pygmentize_RBFPyr .mi { color: #009999 } /* Literal.Number.Integer */
.pygmentize_RBFPyr .mo { color: #009999 } /* Literal.Number.Oct */
.pygmentize_RBFPyr .sb { color: #d01040 } /* Literal.String.Backtick */
.pygmentize_RBFPyr .sc { color: #d01040 } /* Literal.String.Char */
.pygmentize_RBFPyr .sd { color: #d01040 } /* Literal.String.Doc */
.pygmentize_RBFPyr .s2 { color: #d01040 } /* Literal.String.Double */
.pygmentize_RBFPyr .se { color: #d01040 } /* Literal.String.Escape */
.pygmentize_RBFPyr .sh { color: #d01040 } /* Literal.String.Heredoc */
.pygmentize_RBFPyr .si { color: #d01040 } /* Literal.String.Interpol */
.pygmentize_RBFPyr .sx { color: #d01040 } /* Literal.String.Other */
.pygmentize_RBFPyr .sr { color: #009926 } /* Literal.String.Regex */
.pygmentize_RBFPyr .s1 { color: #d01040 } /* Literal.String.Single */
.pygmentize_RBFPyr .ss { color: #990073 } /* Literal.String.Symbol */
.pygmentize_RBFPyr .bp { color: #999999 } /* Name.Builtin.Pseudo */
.pygmentize_RBFPyr .vc { color: #008080 } /* Name.Variable.Class */
.pygmentize_RBFPyr .vg { color: #008080 } /* Name.Variable.Global */
.pygmentize_RBFPyr .vi { color: #008080 } /* Name.Variable.Instance */
.pygmentize_RBFPyr .il { color: #009999 } /* Literal.Number.Integer.Long */

  </style>




<div class="pygmentize_RBFPyr"><pre><span class="nx">javascript</span><span class="o">:</span><span class="kd">var</span> <span class="nx">c</span><span class="o">=</span><span class="nb">window</span><span class="p">.</span><span class="nx">gApplication</span><span class="p">.</span><span class="nx">getMap</span><span class="p">().</span><span class="nx">getCenter</span><span class="p">();</span><span class="nx">alert</span><span class="p">(</span><span class="nx">c</span><span class="p">.</span><span class="nx">lat</span><span class="p">()</span><span class="o">+</span><span class="s1">&#39; &#39;</span><span class="o">+</span><span class="nx">c</span><span class="p">.</span><span class="nx">lng</span><span class="p">())</span>
</pre></div>

</code></p>
<p>A quick glance at the man page of <code>exiv2</code> showed that Exif uses triplets of rational numbers for degrees, minutes, and seconds along with cardinal directions instead of simple decimal numbers.  So for example, &#8220;43.54861810, -80.26079178&#8243; becomes 43/1 32/1 55/1 N and 80/1 15/1 39/1 W (denominator is always 1).  I wrote a python script &#8220;<code>geo.py</code>&#8221; to do the conversion and invoke <code>exiv2</code>:</p>
<p><code><style type="text/css">


/* *************************************************** */
/* WordPress default theme "twenty-ten" compatibility: */
/* FIXME: Is there a way to limit these changes to pygmentize_vzFHT1  */
/*        without editing the WordPress theme directly? */
/* *************************************************** */

#content pre {
  /* The background: transparent is needed to work with WordPress:*/
  background: transparent;
  /* Default WordPress style has a big fat <pre> margin-bottom: */
  margin-bottom: 0px;

  /*color: #333333;*/
  font-size: .9em; 
  line-height: 1.25em;
}

#content table {
}

#content table {
	border: 1px solid #e7e7e7;
    margin: 0 0 0 0;
	text-align: left;
	width: 100%;
}
#content tr th,
#content thead th {
	color: #888;
	font-size: 12px;
	font-weight: bold;
	line-height: 18px;
	padding: 0px;
}
#content tr td {
	border: 0px;
	padding: 0px;
	margin: 0px;
    margin-bottom: 0px;
    padding-bottom: 0px;

}

/* *************************************************** */
/* *************************************************** */

/* Standard fixes to the default output: */

/* Set the tab width in "ch" character units: */
.pygmentize_vzFHT1 .tabspan {
  display: inline-block;
  width: 4ch;
}

/* When using line numbers, use 100% table width and no cellpadding: */
.pygmentize_vzFHT1table {
  width: 100%;
  border-spacing: 0px;
  border-collapse: collapse;
}


/*
#content table {
    border: 1px solid #E7E7E7;
    margin: 0 -1px 24px 0;
    text-align: left;
    width: 100%;
}
*/

.pygmentize_vzFHT1table td, .pygmentize_vzFHT1table th {
  padding: 0px;
  margin: 0px;
}

/* Add a little buffer so the monotype font doesn't bump directly against the edge: */
.pygmentize_vzFHT1 pre {
  padding: .6ch;
  
}

/* This is more consistent with <p> tags... I didn't like it for my use: */
/*
div .pygmentize_vzFHT1 {
    margin-bottom: 24px; 
}
*/

td.linenos.pygmentize_vzFHT1 {
  width: 1ch;
  padding: .6ch;
  line-height: 1.25em;
}

.pygmentize_vzFHT1 td {
  padding-right: 1px;
}


td.linenos { background-color: #f0f0f0; padding-right: 1px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
.pygmentize_vzFHT1 .hll { background-color: #ffffcc }
.pygmentize_vzFHT1  { background: #ffffff; }
.pygmentize_vzFHT1 .c { color: #999988; font-style: italic } /* Comment */
.pygmentize_vzFHT1 .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.pygmentize_vzFHT1 .k { color: #000000; font-weight: bold } /* Keyword */
.pygmentize_vzFHT1 .o { color: #000000; font-weight: bold } /* Operator */
.pygmentize_vzFHT1 .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.pygmentize_vzFHT1 .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.pygmentize_vzFHT1 .c1 { color: #999988; font-style: italic } /* Comment.Single */
.pygmentize_vzFHT1 .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.pygmentize_vzFHT1 .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.pygmentize_vzFHT1 .ge { color: #000000; font-style: italic } /* Generic.Emph */
.pygmentize_vzFHT1 .gr { color: #aa0000 } /* Generic.Error */
.pygmentize_vzFHT1 .gh { color: #999999 } /* Generic.Heading */
.pygmentize_vzFHT1 .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.pygmentize_vzFHT1 .go { color: #888888 } /* Generic.Output */
.pygmentize_vzFHT1 .gp { color: #555555 } /* Generic.Prompt */
.pygmentize_vzFHT1 .gs { font-weight: bold } /* Generic.Strong */
.pygmentize_vzFHT1 .gu { color: #aaaaaa } /* Generic.Subheading */
.pygmentize_vzFHT1 .gt { color: #aa0000 } /* Generic.Traceback */
.pygmentize_vzFHT1 .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
.pygmentize_vzFHT1 .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
.pygmentize_vzFHT1 .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
.pygmentize_vzFHT1 .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
.pygmentize_vzFHT1 .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
.pygmentize_vzFHT1 .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.pygmentize_vzFHT1 .m { color: #009999 } /* Literal.Number */
.pygmentize_vzFHT1 .s { color: #d01040 } /* Literal.String */
.pygmentize_vzFHT1 .na { color: #008080 } /* Name.Attribute */
.pygmentize_vzFHT1 .nb { color: #0086B3 } /* Name.Builtin */
.pygmentize_vzFHT1 .nc { color: #445588; font-weight: bold } /* Name.Class */
.pygmentize_vzFHT1 .no { color: #008080 } /* Name.Constant */
.pygmentize_vzFHT1 .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
.pygmentize_vzFHT1 .ni { color: #800080 } /* Name.Entity */
.pygmentize_vzFHT1 .ne { color: #990000; font-weight: bold } /* Name.Exception */
.pygmentize_vzFHT1 .nf { color: #990000; font-weight: bold } /* Name.Function */
.pygmentize_vzFHT1 .nl { color: #990000; font-weight: bold } /* Name.Label */
.pygmentize_vzFHT1 .nn { color: #555555 } /* Name.Namespace */
.pygmentize_vzFHT1 .nt { color: #000080 } /* Name.Tag */
.pygmentize_vzFHT1 .nv { color: #008080 } /* Name.Variable */
.pygmentize_vzFHT1 .ow { color: #000000; font-weight: bold } /* Operator.Word */
.pygmentize_vzFHT1 .w { color: #bbbbbb } /* Text.Whitespace */
.pygmentize_vzFHT1 .mf { color: #009999 } /* Literal.Number.Float */
.pygmentize_vzFHT1 .mh { color: #009999 } /* Literal.Number.Hex */
.pygmentize_vzFHT1 .mi { color: #009999 } /* Literal.Number.Integer */
.pygmentize_vzFHT1 .mo { color: #009999 } /* Literal.Number.Oct */
.pygmentize_vzFHT1 .sb { color: #d01040 } /* Literal.String.Backtick */
.pygmentize_vzFHT1 .sc { color: #d01040 } /* Literal.String.Char */
.pygmentize_vzFHT1 .sd { color: #d01040 } /* Literal.String.Doc */
.pygmentize_vzFHT1 .s2 { color: #d01040 } /* Literal.String.Double */
.pygmentize_vzFHT1 .se { color: #d01040 } /* Literal.String.Escape */
.pygmentize_vzFHT1 .sh { color: #d01040 } /* Literal.String.Heredoc */
.pygmentize_vzFHT1 .si { color: #d01040 } /* Literal.String.Interpol */
.pygmentize_vzFHT1 .sx { color: #d01040 } /* Literal.String.Other */
.pygmentize_vzFHT1 .sr { color: #009926 } /* Literal.String.Regex */
.pygmentize_vzFHT1 .s1 { color: #d01040 } /* Literal.String.Single */
.pygmentize_vzFHT1 .ss { color: #990073 } /* Literal.String.Symbol */
.pygmentize_vzFHT1 .bp { color: #999999 } /* Name.Builtin.Pseudo */
.pygmentize_vzFHT1 .vc { color: #008080 } /* Name.Variable.Class */
.pygmentize_vzFHT1 .vg { color: #008080 } /* Name.Variable.Global */
.pygmentize_vzFHT1 .vi { color: #008080 } /* Name.Variable.Instance */
.pygmentize_vzFHT1 .il { color: #009999 } /* Literal.Number.Integer.Long */

  </style>




<div class="pygmentize_vzFHT1"><pre><span class="c">#!/usr/bin/python</span>
<span class="kn">import</span> <span class="nn">sys</span><span class="o">,</span> <span class="nn">os</span>
<span class="n">lat</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="n">lng</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
<span class="n">path</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span>

<span class="k">def</span> <span class="nf">format</span><span class="p">(</span><span class="n">dec</span><span class="p">):</span>
  <span class="n">dec</span> <span class="o">=</span> <span class="nb">abs</span><span class="p">(</span><span class="n">dec</span><span class="p">)</span>
  <span class="n">d</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">dec</span><span class="p">)</span>
  <span class="n">m</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">dec</span><span class="o">*</span><span class="mi">60</span><span class="o">%</span><span class="mi">60</span><span class="p">)</span>
  <span class="n">s</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">dec</span><span class="o">*</span><span class="mi">3600</span><span class="o">%</span><span class="mi">60</span><span class="p">)</span>
  <span class="k">return</span> <span class="s">&quot;</span><span class="si">%02d</span><span class="s">/1 </span><span class="si">%02d</span><span class="s">/1 </span><span class="si">%02d</span><span class="s">/1&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">d</span><span class="p">,</span> <span class="n">m</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">lat_cardinal</span><span class="p">(</span><span class="n">dec</span><span class="p">):</span>
  <span class="k">return</span> <span class="s">&#39;N&#39;</span> <span class="k">if</span> <span class="n">dec</span> <span class="o">&gt;=</span> <span class="mi">0</span> <span class="k">else</span> <span class="s">&#39;S&#39;</span>

<span class="k">def</span> <span class="nf">lng_cardinal</span><span class="p">(</span><span class="n">dec</span><span class="p">):</span>
  <span class="k">return</span> <span class="s">&#39;E&#39;</span> <span class="k">if</span> <span class="n">dec</span> <span class="o">&gt;=</span> <span class="mi">0</span> <span class="k">else</span> <span class="s">&#39;W&#39;</span>

<span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span> <span class="s">&quot;exiv2 </span><span class="se">\</span>
<span class="s">  -M</span><span class="se">\&quot;</span><span class="s">set Exif.GPSInfo.GPSLatitude </span><span class="si">%s</span><span class="se">\&quot;</span><span class="s"> </span><span class="se">\</span>
<span class="s">  -M</span><span class="se">\&quot;</span><span class="s">set Exif.GPSInfo.GPSLatitudeRef </span><span class="si">%s</span><span class="se">\&quot;</span><span class="s"> </span><span class="se">\</span>
<span class="s">  -M</span><span class="se">\&quot;</span><span class="s">set Exif.GPSInfo.GPSLongitude </span><span class="si">%s</span><span class="se">\&quot;</span><span class="s"> </span><span class="se">\</span>
<span class="s">  -M</span><span class="se">\&quot;</span><span class="s">set Exif.GPSInfo.GPSLongitudeRef </span><span class="si">%s</span><span class="se">\&quot;</span><span class="s"> </span><span class="se">\</span>
<span class="s">  </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">format</span><span class="p">(</span><span class="n">lat</span><span class="p">),</span> <span class="n">lat_cardinal</span><span class="p">(</span><span class="n">lat</span><span class="p">),</span> <span class="n">format</span><span class="p">(</span><span class="n">lng</span><span class="p">),</span> <span class="n">lng_cardinal</span><span class="p">(</span><span class="n">lng</span><span class="p">),</span> <span class="n">path</span><span class="p">)</span>
<span class="p">)</span>
</pre></div>

</code></p>
<p>Now all I have to do is find the location in Google Maps, type &#8216;<code>geo</code>&#8216; to get the coordinates, and run <code>geo.py <i>latitude</i> <i>longitude</i> <i>file.jpg</i></code>!</p>
]]></content:encoded>
			<wfw:commentRss>http://woconnor.ca/blog/2011/11/30/geotagging-with-exif-metadata/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

