<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161470</link>
    <title>MATLAB Central Newsreader - how to assign lat/lon to a 2D Earth image</title>
    <description>Feed for thread: how to assign lat/lon to a 2D Earth image</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2008 by The MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>The MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 03 Jan 2008 01:42:44 -0500</pubDate>
      <title>how to assign lat/lon to a 2D Earth image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161470#407796</link>
      <author>Roy Chang</author>
      <description>For the below earth image&lt;br&gt;
&lt;br&gt;
&lt;a href="http://veimages.gsfc.nasa.gov/2430/land_ocean_ice_2048.jpg"&gt;http://veimages.gsfc.nasa.gov/2430/land_ocean_ice_2048.jpg&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
how to assign the latitudes/longitudes to the corresponding&lt;br&gt;
locations of the image? For example, if I plot a red point&lt;br&gt;
on the location (lon,lat) then the corresponding location on&lt;br&gt;
the image will show a red point.&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 03 Jan 2008 04:23:43 -0500</pubDate>
      <title>Re: how to assign lat/lon to a 2D Earth image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161470#407804</link>
      <author>Roger Stafford</author>
      <description>"Roy Chang" &amp;lt;tigermacross@yahoo.com&amp;gt; wrote in message &amp;lt;flheik$l3b&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; For the below earth image&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;a href="http://veimages.gsfc.nasa.gov/2430/land_ocean_ice_2048.jpg"&gt;http://veimages.gsfc.nasa.gov/2430/land_ocean_ice_2048.jpg&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; how to assign the latitudes/longitudes to the corresponding&lt;br&gt;
&amp;gt; locations of the image? For example, if I plot a red point&lt;br&gt;
&amp;gt; on the location (lon,lat) then the corresponding location on&lt;br&gt;
&amp;gt; the image will show a red point.&lt;br&gt;
--------&lt;br&gt;
&amp;nbsp;&amp;nbsp;That image looks very much like a Mercator projection.  If so, then longitude &lt;br&gt;
and latitude values can be translated linearly into the usual x,y indices for &lt;br&gt;
images.  In other words, the area within a one-degree interval of longitude and &lt;br&gt;
one-degree interval of latitude will the same-sized rectangle - probably a &lt;br&gt;
square - throughout the entire map.&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 03 Jan 2008 23:21:32 -0500</pubDate>
      <title>Re: how to assign lat/lon to a 2D Earth image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161470#407946</link>
      <author>Roy Chang</author>
      <description>Hi,&lt;br&gt;
Could you please show me which commands I can use to load&lt;br&gt;
the image file, assign the lat/lon, draw the figure, and&lt;br&gt;
plot the result as I mentioned?&lt;br&gt;
Thanks a lot. &lt;br&gt;
&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Fri, 04 Jan 2008 02:40:19 -0500</pubDate>
      <title>Re: how to assign lat/lon to a 2D Earth image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161470#407956</link>
      <author>Joaquim Luis</author>
      <description>"Roy Chang" &amp;lt;tigermacross@yahoo.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fljqls$ian$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; Could you please show me which commands I can use to load&lt;br&gt;
&amp;gt; the image file, assign the lat/lon, draw the figure, and&lt;br&gt;
&amp;gt; plot the result as I mentioned?&lt;br&gt;
&amp;gt; Thanks a lot. &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Normally the operation you want (image registration or &lt;br&gt;
georeferencing) is more complicated but in this case it's &lt;br&gt;
trivial since the image is simply in lon-lat covering the &lt;br&gt;
whole earth. So something like this should work&lt;br&gt;
&lt;br&gt;
I = imread('the image');         % 'the image' is obviously &lt;br&gt;
the image file name&lt;br&gt;
image([-180 180],[-90 90],I)&lt;br&gt;
&lt;br&gt;
J. Luis&lt;br&gt;
</description>
    </item>
    <item>
      <pubDate>Fri, 04 Jan 2008 05:37:14 -0500</pubDate>
      <title>Re: how to assign lat/lon to a 2D Earth image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/161470#407960</link>
      <author>Roger Stafford</author>
      <description>"Roy Chang" &amp;lt;tigermacross@yahoo.com&amp;gt; wrote in message &amp;lt;fljqls$ian&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; Could you please show me which commands I can use to load&lt;br&gt;
&amp;gt; the image file, assign the lat/lon, draw the figure, and&lt;br&gt;
&amp;gt; plot the result as I mentioned?&lt;br&gt;
&amp;gt; Thanks a lot. &lt;br&gt;
---------&lt;br&gt;
&amp;nbsp;&amp;nbsp;Roy, I cannot advise you as to loading images, drawing the figure, or &lt;br&gt;
plotting, since I don't have the imaging toolbox on my matlab version.  I can &lt;br&gt;
only indicate the conversion from latitude and longitude values to the &lt;br&gt;
corresponding pixel coordinates of your image.  You will note that in doing &lt;br&gt;
so I am assuming that the projection in this image is actually a Mercator &lt;br&gt;
projection as I guessed earlier in this thread, and that the image covers the &lt;br&gt;
entire earth from pole to pole and east to west, as it seems to do.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Let it be understood that 'lat' and 'long' are values that express earth's &lt;br&gt;
latitude and longitude in degrees and fractions of a degree (not in minutes &lt;br&gt;
and seconds,) with the understanding that latitude south and longitude west &lt;br&gt;
values are to be negative.  Thus 'lat' ranges from -90 to +90 and 'long' &lt;br&gt;
ranges from -180 to +180.  Since your image is 1024 by 2048 pixels, and &lt;br&gt;
since the Greenwich prime meridian is apparently located at the east/west &lt;br&gt;
center of the image, the conversion to pixel coordinates can be expressed by:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;f = 1-2*eps; % Keep indices within bounds&lt;br&gt;
&amp;nbsp;row = ceil(512-lat*1024/180*f);&lt;br&gt;
&amp;nbsp;col = ceil(1024+long*2048/360*f);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;For example, Mt. Whitney in the Sierra Nevada mountains is located at &lt;br&gt;
latitude 36 deg, 34', 42.78" N and longitude 118 deg, 17', 32.604" W which &lt;br&gt;
would make lat = 36.57855 and long = -118.29239.  By the above &lt;br&gt;
conversion this would lie within the pixel with coordinates (304,352).&lt;br&gt;
&lt;br&gt;
Roger Stafford&lt;br&gt;
&lt;br&gt;
</description>
    </item>
  </channel>
</rss>
