<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5316462986483650877</id><updated>2012-01-12T12:13:32.119-05:00</updated><category term='GraphPlot'/><category term='Map'/><category term='Algorithm'/><category term='CityData'/><category term='XML'/><category term='Graph'/><category term='Tips'/><category term='Nonsense'/><category term='HowTos'/><category term='FinancialData'/><category term='Image'/><category term='CountryData'/><title type='text'>Lunchtime Playground: Fun with Mathematica</title><subtitle type='html'>No advanced topic here, just some simple/silly/useless problems that slip into my mind during lunch break. Free use the contents in any way you like.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default?start-index=101&amp;max-results=100'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>111</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5362161907722092089</id><published>2011-10-31T11:29:00.001-04:00</published><updated>2011-10-31T11:29:25.534-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>How to make arrow objects for Google Earth</title><content type='html'>&lt;p&gt;In the previous post, we has use GeoDestination function to make circle objects, and we can use the same function to generate arrow objects, too.&lt;/p&gt;  &lt;p&gt;The data we have is the position and displacements in north and east direction, {lat, lon, ndis, edis}. ndis, edis is in millimeter in this case.&lt;/p&gt;  &lt;p&gt;First, let calculator the length of the arrow, the scale here is 1 mm displacement = 1000 meters&lt;/p&gt;  &lt;p&gt;length = Sqrt[ndis^2 + edis^2]*1000&lt;/p&gt;  &lt;p&gt;Then the angle. GeoDestionation requires GeoDirection, it starts from the north. &lt;/p&gt;  &lt;p&gt;angle = ArcTan[edis, ndis] /Degree    &lt;br /&gt;geoangle = 90 - angle&lt;/p&gt;  &lt;p&gt;For the end point:&lt;/p&gt;  &lt;p&gt;end = First@GeoDestination[{lat, lon}, {length, geoangle}]&lt;/p&gt;  &lt;p&gt;The trick to generate the arrow is that to form another smaller circle around the end point, pick up two points from the arrow heads.&amp;#160; &lt;/p&gt;  &lt;p&gt;arr1 = First@GeoDestination[end, {dist*.25, geoangle + 180 - 30}]    &lt;br /&gt;arr2 = First@GeoDestination[end, {dist*.25, geoangle - 180 + 30}]&lt;/p&gt;  &lt;p&gt;Then we can have two lines which draw in this order, {org –&amp;gt; end}, {arr1-&amp;gt;end-&amp;gt;arr2}. When comes to export kml, we need to use &amp;lt;MultiGeometry&amp;gt; object in KML, it seems not supported by Export function in Mathematica yet, so you can just export the following string directly:&lt;/p&gt;  &lt;p&gt;&amp;lt;MultiGeometry&amp;gt;    &lt;br /&gt;&amp;lt;LineString&amp;gt;     &lt;br /&gt;&amp;lt;tessellate&amp;gt;1&amp;lt;/tessellate&amp;gt;     &lt;br /&gt;&amp;lt;coordinates&amp;gt;     &lt;br /&gt;-117.093195026,34.116408002,0 -117.020521006,34.0741018797,0     &lt;br /&gt;&amp;lt;/coordinates&amp;gt;     &lt;br /&gt;&amp;lt;/LineString&amp;gt;     &lt;br /&gt;&amp;lt;LineString&amp;gt;     &lt;br /&gt;&amp;lt;tessellate&amp;gt;1&amp;lt;/tessellate&amp;gt;     &lt;br /&gt;&amp;lt;coordinates&amp;gt;     &lt;br /&gt;-117.042636322,34.0757361767,0 -117.020521006,34.0741018797,0 -117.029869517, 34.0907835742, 0     &lt;br /&gt;&amp;lt;/coordinates&amp;gt;     &lt;br /&gt;&amp;lt;/LineString&amp;gt;     &lt;br /&gt;&amp;lt;/MultiGeometry&amp;gt;     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Here is the screenshot of the final product in Google Earth:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="screenshot" border="0" alt="screenshot" src="http://lh4.ggpht.com/-U-2FNXJGGPg/Tq6-1drYKlI/AAAAAAAACPk/CmKSGvynY70/screenshot%25255B6%25255D.jpg?imgmax=800" width="532" height="454" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5362161907722092089?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5362161907722092089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5362161907722092089' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5362161907722092089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5362161907722092089'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/10/how-to-make-arrow-objects-for-google.html' title='How to make arrow objects for Google Earth'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/-U-2FNXJGGPg/Tq6-1drYKlI/AAAAAAAACPk/CmKSGvynY70/s72-c/screenshot%25255B6%25255D.jpg?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8654100587669924362</id><published>2011-06-02T10:00:00.001-04:00</published><updated>2011-06-02T10:00:31.363-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>How to make a circle for Google Earth</title><content type='html'>&lt;p&gt;KML doesn’t have the circle object built in, a circle can be made by line or polygon object. With &lt;a href="http://reference.wolfram.com/mathematica/ref/GeoDestination.html"&gt;GeoDestination&lt;/a&gt; function, a perfect circle can be created.&lt;/p&gt;  &lt;p&gt;Polygon@Table[GeoDestination[GeoPosition[{39.17, -86.52 }], {5000, a}], {a, 0, 360, 10}][[All, 1, {2, 1}]] &lt;/p&gt;  &lt;p&gt;This line will generate a 36-sides polygon centered at 39.17, –86.52 with 5000 meters radius. Then export it to kml, you probably has to manually modify the kml file to set up the color styles. &lt;/p&gt;  &lt;p&gt;Here is an example, we use the radius to represent the vertical motion, 1 cm motion = 5000 meters on the ground.&lt;/p&gt;  &lt;p&gt;&lt;img style="display: inline" title="screenshot" alt="screenshot" src="http://lh6.ggpht.com/-HmbjPFymmzY/TeeXfk68RqI/AAAAAAAACGE/M1BTVPJ7RBk/screenshot%25255B5%25255D.png?imgmax=800" width="394" height="353" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8654100587669924362?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8654100587669924362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8654100587669924362' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8654100587669924362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8654100587669924362'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/06/how-to-make-circle-for-google-earth.html' title='How to make a circle for Google Earth'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/-HmbjPFymmzY/TeeXfk68RqI/AAAAAAAACGE/M1BTVPJ7RBk/s72-c/screenshot%25255B5%25255D.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3057514085573554666</id><published>2011-05-11T15:00:00.001-04:00</published><updated>2011-05-11T15:00:58.871-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Nonsense'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Fun with Texture</title><content type='html'>&lt;p&gt;Texture support is one major improvement in Mathematica 8.0. Sure, we can have some fun with it. Here is an example. We draw some polygons first.&lt;/p&gt;  &lt;p&gt;&lt;img style="display: inline" title="animalcorssing2" alt="animalcorssing2" src="http://lh3.ggpht.com/_0mA_T7sKsO4/Tcrc6UQnswI/AAAAAAAACFk/ylnxhWUb48s/animalcorssing2%5B7%5D.jpg?imgmax=800" width="355" height="408" /&gt;&lt;/p&gt;  &lt;p&gt;Then some textures are applied, we get the following image. The main trick is to use alpha channel to get this cut-out texture mapping effect. The original tree image has the alpha channel already, we can use it directly, Texture[ImageData[tree]] will do the trick, if you use Texture[tree], somehow it will not pick up the alpha channel. For the character image, it doesn’t has the alpha channel, we can set a alpha channel by the following command:&lt;/p&gt;  &lt;p&gt;SetAlphaChannel[im,    &lt;br /&gt; ChanVeseBinarize[ColorNegate@im] // FillingTransform ]&lt;/p&gt;  &lt;p&gt;&lt;img style="display: inline" title="animalcorssing" alt="animalcorssing" src="http://lh4.ggpht.com/_0mA_T7sKsO4/Tcrc6hE7_yI/AAAAAAAACFo/KcdX9zjfXQs/animalcorssing%5B6%5D.jpg?imgmax=800" width="442" height="466" /&gt;&lt;/p&gt;  &lt;p&gt;By the way, the character is &lt;a href="http://en.wikipedia.org/wiki/Tom_Nook"&gt;Tom Nook&lt;/a&gt;: &amp;quot;This isn't fat, I've just lined my insides with money.&amp;quot;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.box.net/shared/kbojp5y36s"&gt;Download the notebook&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3057514085573554666?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3057514085573554666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3057514085573554666' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3057514085573554666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3057514085573554666'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/05/fun-with-texture.html' title='Fun with Texture'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/Tcrc6UQnswI/AAAAAAAACFk/ylnxhWUb48s/s72-c/animalcorssing2%5B7%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8172487781421920503</id><published>2011-05-09T08:51:00.001-04:00</published><updated>2011-05-09T08:52:29.891-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Top 10 Box Office Movies Wallpaper Generator</title><content type='html'>&lt;p&gt;I saw a script &lt;a href="http://www.webupd8.org/2011/03/automatically-generate-top-10-box.html"&gt;IMPloader&lt;/a&gt; that fetches the posters for the top 10 Box Office movies of the week from &lt;a href="http://www.impawards.com/"&gt;http://www.impawards.com/&lt;/a&gt;, and automatically generates a wallpaper, it is requires Ruby, imagemagick and wget. If you are running Window, you probably don’t want to install these packages. We can do it with Mathematica with ImageAssemble and ImagePad functions introduced in 8.0.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/TcfjNJuE3MI/AAAAAAAACFM/onY74AEWDUg/s1600-h/movieposters_code%5B4%5D.png"&gt;&lt;img style="display: inline" title="movieposters_code" alt="movieposters_code" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TcfjNgEVeZI/AAAAAAAACFQ/TFxDoWZfh88/movieposters_code_thumb%5B2%5D.png?imgmax=800" width="603" height="196" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/TcfjNzTyeMI/AAAAAAAACFc/02Vz8vwmQN4/s1600-h/movieposters%5B13%5D.jpg"&gt;&lt;img style="display: inline" title="movieposters" alt="movieposters" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TcfjOLm73OI/AAAAAAAACFg/lNd1H5Fn51E/movieposters_thumb%5B11%5D.jpg?imgmax=800" width="608" height="394" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.box.net/shared/3407y84cbm"&gt;Download the notebook: movieposters.nb&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8172487781421920503?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8172487781421920503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8172487781421920503' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8172487781421920503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8172487781421920503'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/05/top-10-box-office-movies-wallpaper.html' title='Top 10 Box Office Movies Wallpaper Generator'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/TcfjNgEVeZI/AAAAAAAACFQ/TFxDoWZfh88/s72-c/movieposters_code_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2257100380868487631</id><published>2011-04-29T12:31:00.001-04:00</published><updated>2011-04-29T12:37:47.788-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Control Google Earth from Manipulate</title><content type='html'>&lt;p&gt;One reader asks: &lt;strong&gt;could one drive Google Earth from a set of controls within a Manipulate?&lt;/strong&gt; The answer is yes, however, I only know how to do it with Windows platform through &lt;a href="http://earth.google.com/comapi/index.html"&gt;Google Earth COM API&lt;/a&gt;. In the past, this issue is covered in this post: &lt;a href="http://mathgis.blogspot.com/2009/06/control-google-earth-from-mathematica.html"&gt;Control Google Earth from Mathematica&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The example here is very simple, rotate the camera from Manipulate.&lt;/p&gt;  &lt;p&gt;Needs[&amp;quot;NETLink`&amp;quot;]    &lt;br /&gt;InstallNET[];     &lt;br /&gt;(* start up goolge earth *)     &lt;br /&gt;ge = CreateCOMObject[&amp;quot;GoogleEarth.ApplicationGE&amp;quot;];     &lt;br /&gt;(* get the camera object *)     &lt;br /&gt;cam = ge@GetCamera[0]     &lt;br /&gt;(* define a function to rotate the camera *)     &lt;br /&gt;runcam[{lat_, lon_}] := Module[{},     &lt;br /&gt;&amp;#160;&amp;#160; cam@FocusPointLongitude = lon;     &lt;br /&gt;&amp;#160;&amp;#160; cam@FocusPointLatitude = lat;     &lt;br /&gt;&amp;#160;&amp;#160; ge@SetCamera[cam, 2]];&lt;/p&gt;  &lt;p&gt;Manipulate[    &lt;br /&gt;runcam[{lat, lon}]; {lat, lon}, {lat, -50, 50}, {lon, -180, 180}]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/Tbrn_FfK7jI/AAAAAAAACFE/4vDbOaRb_NE/s1600-h/googleearthcontrol%5B4%5D.png"&gt;&lt;img style="display: inline" title="googleearthcontrol" alt="googleearthcontrol" src="http://lh4.ggpht.com/_0mA_T7sKsO4/Tbrn_ronq5I/AAAAAAAACFI/BDm19csFoc8/googleearthcontrol_thumb%5B2%5D.png?imgmax=800" width="513" height="278" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2257100380868487631?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2257100380868487631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2257100380868487631' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2257100380868487631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2257100380868487631'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/04/control-google-earth-from-manipulate.html' title='Control Google Earth from Manipulate'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/Tbrn_ronq5I/AAAAAAAACFI/BDm19csFoc8/s72-c/googleearthcontrol_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3540503119529541201</id><published>2011-04-26T10:20:00.001-04:00</published><updated>2011-04-26T12:56:39.442-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Visualize underground structures with texture mapping</title><content type='html'>&lt;p&gt;&lt;a href="https://www.cresis.ku.edu/data"&gt;The Center for Remote Sensing of Ice Sheets (CReSIS)&lt;/a&gt; has many radar images which show underground ice bed elevations both in north pole and south pole regions.&lt;/p&gt;  &lt;p&gt;In the following image, the red line marks the ice bed underground (6000 actually means 6000 m under the earth surface). Radar signal is acquired from the plane, each image has the flight path information (red line in the second image).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/TbbUq8L6NOI/AAAAAAAACEU/YafOF_dGIKQ/s1600-h/20091228_02_014_061152_2echo_picks%5B7%5D.png"&gt;&lt;img style="display: inline" title="20091228_02_014_061152_2echo_picks" alt="20091228_02_014_061152_2echo_picks" src="http://lh6.ggpht.com/_0mA_T7sKsO4/TbbUrL3zM5I/AAAAAAAACEY/8XeYAGolpAY/20091228_02_014_061152_2echo_picks_thumb%5B9%5D.png?imgmax=800" width="434" height="350" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/TbbUrgWLS4I/AAAAAAAACEc/dvHxqC8wccE/s1600-h/20091228_02_014_061152_0maps%5B6%5D.png"&gt;&lt;img style="display: inline" title="20091228_02_014_061152_0maps" alt="20091228_02_014_061152_0maps" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TbbUsOr49DI/AAAAAAAACEg/3KHxRidT-80/20091228_02_014_061152_0maps_thumb%5B8%5D.png?imgmax=800" width="430" height="359" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The task here is to combine flight path and radar image to display 3D underground information directly. It can be achieved in the following two steps with Mathematica 8’s texture support:&lt;/p&gt;  &lt;p&gt;f = BSplineFunction[flightpath]; (* flight path {{x1,y1}, ..{xn, yn}} *)&lt;/p&gt;  &lt;p&gt;ParametricPlot3D[Flatten@{f[x], z}, {x, 0, 1}, {z, -6000, 1000},    &lt;br /&gt;BoxRatios -&amp;gt; 1, BoundaryStyle -&amp;gt; Green, Mesh -&amp;gt; None, Axes -&amp;gt; None,     &lt;br /&gt;PlotStyle -&amp;gt; {Texture[radarimage]}, Lighting -&amp;gt; &amp;quot;Neutral&amp;quot;, ImageSize -&amp;gt; 600]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/TbbXNbsXmsI/AAAAAAAACE0/Y41Rz7Vp-ls/s1600-h/viewtexture%5B5%5D.png"&gt;&lt;img style="display: inline" title="viewtexture" alt="viewtexture" src="http://lh4.ggpht.com/_0mA_T7sKsO4/TbbXNl9jhgI/AAAAAAAACE4/_9XxIENnv_w/viewtexture_thumb%5B2%5D.png?imgmax=800" width="512" height="560" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The radar image has to be cropped in advance, and we only keep part as deep as 6000 meters. There are some rough parts on the image, especially close to the boundaries (check out the update for the solution), the general quality is good enough. We can make the same thing for another radar image, then put them together, make the following product to show the intersection. It is not perfect solution, however, it is nice to have something in just several lines.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/TbbUs92TYvI/AAAAAAAACEs/PrU4tj0LRBQ/s1600-h/viewtexture3%5B5%5D.png"&gt;&lt;img style="display: inline" title="viewtexture3" alt="viewtexture3" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TbbUtdprvOI/AAAAAAAACEw/FuooQxXzYPE/viewtexture3_thumb%5B3%5D.png?imgmax=800" width="524" height="395" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;No notebook this time.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Updates: Someone asks how to get rid of zig-zag boundaries.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;It can be done with two options, one is PlotPoints, the other MaxRecursion, check the ParameterPlot3D documentation for the details.&lt;/p&gt;  &lt;p&gt;For example,&amp;#160; MaxRecursion –&amp;gt; 4&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/Tbb5RUOrXeI/AAAAAAAACE8/OaGbYRb89Ag/s1600-h/viewtexture%5B4%5D.png"&gt;&lt;img style="display: inline" title="viewtexture" alt="viewtexture" src="http://lh4.ggpht.com/_0mA_T7sKsO4/Tbb5RpQf_FI/AAAAAAAACFA/ndjMTk15gvg/viewtexture_thumb%5B2%5D.png?imgmax=800" width="439" height="425" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3540503119529541201?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3540503119529541201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3540503119529541201' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3540503119529541201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3540503119529541201'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/04/visualize-underground-structures-with.html' title='Visualize underground structures with texture mapping'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/TbbUrL3zM5I/AAAAAAAACEY/8XeYAGolpAY/s72-c/20091228_02_014_061152_2echo_picks_thumb%5B9%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1523250112459713856</id><published>2011-03-14T09:33:00.001-04:00</published><updated>2011-03-14T09:33:00.204-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Pi Day</title><content type='html'>&lt;p&gt;Reading: &lt;a href="http://www-history.mcs.st-andrews.ac.uk/HistTopics/Pi_through_the_ages.html"&gt;A history of Pi&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I found the old notebook to generate Pi T-shirt design.&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="fox" border="0" alt="fox" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TX4ZCxYJa5I/AAAAAAAACEA/nhCabmD3yMU/fox%5B4%5D.png?imgmax=800" width="411" height="348" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.box.net/shared/bs6m72ca9k"&gt;Download Notebook&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1523250112459713856?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1523250112459713856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1523250112459713856' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1523250112459713856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1523250112459713856'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/03/pi-day.html' title='Pi Day'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/TX4ZCxYJa5I/AAAAAAAACEA/nhCabmD3yMU/s72-c/fox%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1215592501424604203</id><published>2011-03-11T12:45:00.001-05:00</published><updated>2011-03-11T12:45:24.170-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Mathematica and Spatial Database</title><content type='html'>&lt;p&gt;&lt;strong&gt;Warning: this post uses undocumented Mathematica command and modifies the Mathematica installation. Don't try this at home.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;For any GIS software, evaluating spatial relationships, such as equal, disjoint, within, intersects, etc., is a fundamental requirement. Also, R-tree support is a must for any large spatial data set. Currently, these sets of functions are not built in Mathematica. It is difficult to perform complex GIS analysis inside Mathematica. One way is to call external libraries through Mathlink/Jlink. Another way is connecting to a spatial database, such as PostGreSQL, Oracle Spatial through database connection. Spatial database? What about &lt;a href="http://www.gaia-gis.it/spatialite/"&gt;Spatialite&lt;/a&gt;, it is a complete spatail DBMS built as an extension to the extreme light-weighted database &lt;a href="http://www.sqlite.org/"&gt;SQLite&lt;/a&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;From &lt;a href="http://dev.ragfield.com/2009/05/wolframalpha-tweet-analysis.html"&gt;this Wolfram|Alpha tweet analysis post&lt;/a&gt;, it shows Mathematica actually ship with SQlite.&lt;/p&gt;  &lt;p&gt;I installed the Mathematica 8 linux trail version.&lt;/p&gt;  &lt;p&gt;db = Database`OpenDatabase[&amp;quot;/tmp/test.sqlite&amp;quot;];    &lt;br /&gt;Database`QueryDatabase[db, &amp;quot;SELECT sqlite_version();&amp;quot;]     &lt;br /&gt;{{3.6.1}}&lt;/p&gt;  &lt;p&gt;Here is SQLite library from Mathematica    &lt;br /&gt;/usr/local/Wolfram/Mathematica/8.0/SystemFiles/Kernel/Binaries/Linux/libsqlite3.so&lt;/p&gt;  &lt;p&gt;For security reason, the dynamic loading extension is disabled. And we need to compile our own copy of libsqlite3.so. The detail is explained here: &lt;a href="http://www.gaia-gis.it/spatialite/spatialite-arch-2.3.1.html#trap"&gt;the pre-packaged 'libsqlite' trap.&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Grab the source code for SQLite website, build the new library with:&lt;/p&gt;  &lt;p&gt;CFLAGS=&amp;quot;-DSQLITE_ENABLE_LOAD_EXTENSION=1&amp;quot; ./configure&lt;/p&gt;  &lt;p&gt;then make a copy of the original libsqlite3.so, and overwrite it with the new version.&lt;/p&gt;  &lt;p&gt;Database`QueryDatabase[db, &amp;quot;SELECT sqlite_version();&amp;quot;]    &lt;br /&gt;{{3.7.5}} &lt;/p&gt;  &lt;p&gt;Then we can try with the Spatialite already installed:&lt;/p&gt;  &lt;p&gt;Database`QueryDatabase[db, &amp;quot;SELECT load_extension(‘/usr/lib/libspatialite.so’);&amp;quot;]   &lt;br /&gt;Database`QueryDatabase[db, &amp;quot;SELECT spatialite_version();&amp;quot;]     &lt;br /&gt;{{&amp;quot;2.4.0&amp;quot;}}&lt;/p&gt;  &lt;p&gt;Try a spatial SQL command:&lt;/p&gt;  &lt;p&gt;Database`QueryDatabase[db, &amp;quot;SELECT X(GeomFromText('POINT(-85 39)',4326));&amp;quot;]   &lt;br /&gt;{{-85.}}&lt;/p&gt;  &lt;p&gt;Wow, it is working! &lt;/p&gt;  &lt;p&gt;Here is &lt;a href="http://www.gaia-gis.it/spatialite/spatialite-tutorial-2.3.1.html"&gt;a tutorial on Spatialite&lt;/a&gt;, you can get the idea of what kind of functions are supported by Spatialite. If you are familiar with the spatial database, you can build a rather functional GIS system inside Mathematica with the support of Spatialite.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1215592501424604203?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1215592501424604203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1215592501424604203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1215592501424604203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1215592501424604203'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/03/mathematica-and-spatial-database.html' title='Mathematica and Spatial Database'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8034695778853750531</id><published>2011-02-04T13:15:00.001-05:00</published><updated>2011-02-04T13:15:40.924-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Create simple DEM from Google Map</title><content type='html'>&lt;p&gt;With texture support in Mathematica 8.0, we can create the simple DEM with image overlay by combing the functions from two previous posts &lt;a href="http://mathgis.blogspot.com/2010/11/plotting-on-google-static-map.html"&gt;Google Static Map&lt;/a&gt; and &lt;a href="http://mathgis.blogspot.com/2010/03/extract-elevation-data-with-google.html"&gt;Google Elevation API&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="googleDEM" border="0" alt="googleDEM" src="http://lh4.ggpht.com/_0mA_T7sKsO4/TUxCLh41OPI/AAAAAAAACD0/zdP9mAq7118/googleDEM%5B11%5D.png?imgmax=800" width="636" height="422" /&gt;&lt;/p&gt;  &lt;p&gt;However, there is the &lt;a href="http://code.google.com/apis/maps/documentation/elevation/#Limits"&gt;usage limits on Google Elevation API&lt;/a&gt;. You’d better pull the dem once and export the data, otherwise, you may hit the daily limits very quickly.&lt;/p&gt;  &lt;p&gt;Here is an example on displaying earthquake data with the dem, the red line outlines the fault plane.&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="LagunaSalada" border="0" alt="LagunaSalada" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TUxCMLga4gI/AAAAAAAACD4/Z9sdywjTwFk/LagunaSalada%5B7%5D.png?imgmax=800" width="547" height="602" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.box.net/shared/6hvk6dnze1"&gt;Download notebook&lt;/a&gt;. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8034695778853750531?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8034695778853750531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8034695778853750531' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8034695778853750531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8034695778853750531'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2011/02/create-simple-dem-from-google-map.html' title='Create simple DEM from Google Map'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/TUxCLh41OPI/AAAAAAAACD0/zdP9mAq7118/s72-c/googleDEM%5B11%5D.png?imgmax=800' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3277401798517071085</id><published>2010-12-21T09:55:00.001-05:00</published><updated>2010-12-21T09:55:05.732-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nonsense'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Happy Holiday!</title><content type='html'>&lt;p&gt;Happy Holiday!&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="imagelineofart" border="0" alt="imagelineofart" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TRC_yHewCKI/AAAAAAAACDk/Ii4kOOZX31k/imagelineofart%5B6%5D.png?imgmax=800" width="624" height="568" /&gt;&lt;/p&gt;  &lt;p&gt;Be a nice person in 2011, everyone will be happy.&lt;/p&gt;  &lt;p&gt;How to generate this image?&lt;/p&gt;  &lt;p&gt;First, find an image, then&lt;/p&gt; img2 = ColorConvert[img, &amp;quot;HSB&amp;quot;];   &lt;br /&gt;img3 = ImageData[img2][[All, All, 3]];   &lt;br /&gt;ListPlot[Table[img3[[i]]*10 - i, {i, 1, ImageDimensions[img][[2]], 3}],   &lt;br /&gt;PlotRange -&amp;gt; All, Axes -&amp;gt; None, Joined -&amp;gt; True, PlotStyle -&amp;gt; {{Black}, {Thick, Lighter[Black]}}, AspectRatio -&amp;gt; ImageAspectRatio[img]]      &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3277401798517071085?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3277401798517071085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3277401798517071085' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3277401798517071085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3277401798517071085'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/12/happy-holiday.html' title='Happy Holiday!'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/TRC_yHewCKI/AAAAAAAACDk/Ii4kOOZX31k/s72-c/imagelineofart%5B6%5D.png?imgmax=800' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-628954744946124115</id><published>2010-11-15T11:05:00.001-05:00</published><updated>2010-11-15T11:07:53.417-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Color-coded contour lines with Mathematica</title><content type='html'>&lt;p&gt;In ContourPlot, ContourStyle –&amp;gt; function can be used to color-code contour lines.For example, the number of contours is numC=20, then for each contour, the color is defined by a coloring function:&lt;/p&gt;  &lt;p&gt;ContourStyle -&amp;gt; Table[{ColorData[&amp;quot;Rainbow&amp;quot;, (i - 1)/(numC - 1)]}, {i, numC}]&lt;/p&gt;  &lt;p&gt;Of course, it is also necessary to set Contours –&amp;gt; numC.&lt;/p&gt;  &lt;p&gt;Here are the examples, the famous peaks function from Matlab is used.&lt;/p&gt;  &lt;p&gt;2D ContourPlot example:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="colorcodedcontourlines" border="0" alt="colorcodedcontourlines" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TOFaOHsp-3I/AAAAAAAACDE/nK1YZAF1Kyo/colorcodedcontourlines%5B6%5D.png?imgmax=800" width="364" height="364" /&gt;&lt;/p&gt;  &lt;p&gt;Turn 2D plot into the 3D one:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="colorcodedcontourlines1" border="0" alt="colorcodedcontourlines1" src="http://lh4.ggpht.com/_0mA_T7sKsO4/TOFa1qDAtwI/AAAAAAAACDY/SKvzQogtOfA/colorcodedcontourlines1%5B1%5D.png?imgmax=800" width="441" height="437" /&gt;&lt;/p&gt;  &lt;p&gt;Another 3D example:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="colorcodedcontourlines3" border="0" alt="colorcodedcontourlines3" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TOFaQ4UsP3I/AAAAAAAACDc/RkdMgHl8Gks/colorcodedcontourlines3%5B1%5D.png?imgmax=800" width="438" height="379" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.box.net/shared/gj45l44hmn"&gt;Download the notebook.&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-628954744946124115?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/628954744946124115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=628954744946124115' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/628954744946124115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/628954744946124115'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/11/color-coded-contour-lines-with.html' title='Color-coded contour lines with Mathematica'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/TOFaOHsp-3I/AAAAAAAACDE/nK1YZAF1Kyo/s72-c/colorcodedcontourlines%5B6%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8466333277839319240</id><published>2010-11-08T10:07:00.001-05:00</published><updated>2010-11-08T10:07:29.915-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Customizing DateListPlot with PlotMarkers</title><content type='html'>&lt;p&gt;This example shows you how to specific PlotMarkers for each point in a data set. The solution is quite simple, just partition the dataset into different series, each set only contains one point exactly: Partition[data, 1]. Then we can assign the different PlotMarkers for each point.&lt;/p&gt;  &lt;p&gt;Let’s download some weather data:&lt;/p&gt;  &lt;p&gt;data = WeatherData[$GeoLocation, &amp;quot;WindDirection&amp;quot;, {{2009, 1, 1}, {2009, 1, 5}}];    &lt;br /&gt;data = Select[data, FreeQ[#, {_, Missing[&amp;quot;NotAvailable&amp;quot;]}] &amp;amp;];&lt;/p&gt;  &lt;p&gt;We like to use arrows to represent wind directions:&lt;/p&gt;  &lt;p&gt;markers =    &lt;br /&gt;&amp;#160; Graphics[{Red, Arrow[{{0, 0}, -0.5 {Sin[#[[2]] Degree], Cos[#[[2]] Degree]}}],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; EdgeForm[], FaceForm[], Rectangle[{-1, -1}, {1, 1}]}] &amp;amp; /@ data;&lt;/p&gt;  &lt;p&gt;We put a invisible box around arrow to make sure that the markers are aligned by {0, 0}. &lt;/p&gt;  &lt;p&gt;newdata = data; newdata[[All, 2]] = 0;   &lt;br /&gt;g = DateListPlot[Partition[newdata, 1], PlotRange -&amp;gt; All, PlotMarkers -&amp;gt; markers, Axes -&amp;gt; {True, False}, FrameTicks -&amp;gt; {Automatic, None}]&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="1" border="0" alt="1" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TNgSLta-GUI/AAAAAAAACC4/8shBJqkl58M/1%5B4%5D.png?imgmax=800" width="444" height="296" /&gt;&lt;/p&gt;  &lt;p&gt;Let’s test another place: Tokyo, Japan&lt;/p&gt;  &lt;p&gt;Summer time:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="customplotmarker" border="0" alt="customplotmarker" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TNgSL9EjT1I/AAAAAAAACC8/_aM3NbqDBn4/customplotmarker%5B4%5D.png?imgmax=800" width="455" height="305" /&gt;&amp;#160;&lt;/p&gt;        &lt;p&gt;Winter time:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="customplotmarker1" border="0" alt="customplotmarker1" src="http://lh4.ggpht.com/_0mA_T7sKsO4/TNgSMEpv2lI/AAAAAAAACDA/1CqyUqsSRnY/customplotmarker1%5B4%5D.png?imgmax=800" width="455" height="306" /&gt;&lt;/p&gt;  &lt;p&gt;The pattern of winter “north” wind and the summer “south” wind is very clear, it is much better than just plotting points.&lt;/p&gt;  &lt;p&gt;No notebook, all the codes are here already. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8466333277839319240?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8466333277839319240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8466333277839319240' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8466333277839319240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8466333277839319240'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/11/customizing-datelistplot-with.html' title='Customizing DateListPlot with PlotMarkers'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/TNgSLta-GUI/AAAAAAAACC4/8shBJqkl58M/s72-c/1%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3494703559651025423</id><published>2010-11-01T12:53:00.001-04:00</published><updated>2010-11-01T12:55:32.848-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Plotting on Google static map</title><content type='html'>&lt;p&gt;We have given &lt;a href="http://mathgis.blogspot.com/2010/08/work-with-web-map-service-wms.html"&gt;an example on plotting with WMS&lt;/a&gt;. You may be wondering how we can do the similar thing with &lt;a href="http://code.google.com/apis/maps/documentation/staticmaps/"&gt;Google static map&lt;/a&gt;. It is very easy to use with Mathematica:&lt;/p&gt;  &lt;p&gt;googleMap[{lat_,lon_},{sizex_,sizey_},zoom_,maptype_]:=Import[&amp;quot;http://maps.google.com/maps/api/staticmap?sensor=false&amp;amp;center=&amp;quot;&amp;lt;&amp;gt;ToString[lat]&amp;lt;&amp;gt;&amp;quot;,&amp;quot;&amp;lt;&amp;gt;ToString[lon]&amp;lt;&amp;gt;&amp;quot;&amp;amp;zoom=&amp;quot;&amp;lt;&amp;gt;ToString[zoom]&amp;lt;&amp;gt;&amp;quot;&amp;amp;size=&amp;quot;&amp;lt;&amp;gt;ToString[sizex]&amp;lt;&amp;gt;&amp;quot;x&amp;quot;&amp;lt;&amp;gt;ToString[sizey]&amp;lt;&amp;gt;&amp;quot;&amp;amp;maptype=&amp;quot;&amp;lt;&amp;gt;maptype];&lt;/p&gt;  &lt;p&gt;Google map is based on &lt;a href="http://mathworld.wolfram.com/MercatorProjection.html"&gt;Mercator Projection&lt;/a&gt;. So the data has to be projected, rather than drawing (longitude, latitude) pairs directly. The scale on east-west (longitude) is constant with zoom level, and only latitude needs to be projected.&lt;/p&gt;  &lt;p&gt;(* convert lat to y *)    &lt;br /&gt;lat2y[lat_]:=0.5Log[(1+Sin[lat Degree])/(1-Sin[lat Degree])];     &lt;br /&gt;(* convert y to lat *)     &lt;br /&gt;y2lat[y_]:=Gudermannian[y]*180/Pi;&lt;/p&gt;  &lt;p&gt;We have the data in pairs of (longitude, latitude) which lie in a bounding box ((lon1,lat1), (lon2, lat2)), and to plot them on a Google static map, we need: 1. find the center of the map; 2. find the right zoom level; 3. find the proper map size; 4. project the data: (longitude, lat2y[latitude])&lt;/p&gt;  &lt;p&gt;I will skip the details, if you are interested into the mathematics, check out these two posts, : &lt;a href="http://crantastic.org/packages/RgoogleMaps"&gt;R-Google Map&lt;/a&gt; and &lt;a href="http://googlemapscashnow.com/how-to-make-google-static-maps-interactive.html"&gt;How to make Google static maps interactive&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Here are two examples:&lt;/p&gt;  &lt;p&gt;coords = CountryData[&amp;quot;Australia&amp;quot;, &amp;quot;Coordinates&amp;quot;];    &lt;br /&gt;(* only project latitude *)     &lt;br /&gt;Map[{#[[2]],lat2y[#[[1]]]}&amp;amp;, coords,{2}]]&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="plotongooglemap" border="0" alt="plotongooglemap" src="http://lh4.ggpht.com/_0mA_T7sKsO4/TM7wldM8BoI/AAAAAAAACCw/X-EfrXC7sK8/plotongooglemap%5B4%5D.png?imgmax=800" width="482" height="449" /&gt;&lt;/p&gt;  &lt;p&gt;In the second example, GIS data is imported from an XML file, it is from &lt;a href="http://mathgis.blogspot.com/2008/01/details-on-importing-gis-data.html"&gt;the post before Mathematica 7.0 released&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="plotongooglemap1" border="0" alt="plotongooglemap1" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TM7wl053LTI/AAAAAAAACC0/QzPEgCnaUB4/plotongooglemap1%5B4%5D.png?imgmax=800" width="332" height="538" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.wolfram.com/2010/09/01/twisted-pictures/"&gt;Mathematica 8 has the texture function&lt;/a&gt;, so we can import static Google map as the texture, it will be easy to create complex 3D GIS visualization. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.box.net/shared/p5zkegfrav"&gt;Download the notebook&lt;/a&gt; for detail.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3494703559651025423?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3494703559651025423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3494703559651025423' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3494703559651025423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3494703559651025423'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/11/plotting-on-google-static-map.html' title='Plotting on Google static map'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/TM7wldM8BoI/AAAAAAAACCw/X-EfrXC7sK8/s72-c/plotongooglemap%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5155402821531896173</id><published>2010-10-26T17:20:00.001-04:00</published><updated>2010-10-27T10:28:04.251-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Processing comic images for e-reader</title><content type='html'>&lt;p&gt;First, this post probably falls into the category of “just because you can do it doesn’t mean you should” with Mathematica. &lt;/p&gt;  &lt;p&gt;Here is the job: the comic is in cbz/cbr format, and images are too large for the e-reader usually with 800 by 600 resolutions (the actual usable space is even smaller). So you like to do three things with these images: 1.cut white margins, 2. resize, 3. increase contrast if image is not clear enough. It can be done with three Mathematica commands: ImageCrop, ImageResize and ImageAdjust. &lt;/p&gt;  &lt;p&gt;One line example: &lt;/p&gt;  &lt;p&gt;Export[#,    &lt;br /&gt;&amp;#160; ImageAdjust[     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ImageResize[     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ImageCrop[Import[&amp;quot;test.cbz&amp;quot;, {&amp;quot;ZIP&amp;quot;, #}]], {584, 714}],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 0.2]] &amp;amp; /@ (Import[&amp;quot;test.cbz&amp;quot;, &amp;quot;ZIP&amp;quot;])&lt;/p&gt;  &lt;p&gt;If it is in cbr format, it has to be unpacked first.&lt;/p&gt;  &lt;p&gt;Actually under&amp;#160; the certain situation, this may come in handy. There are more and more comics in epub format made for iPad. And epub is basically a zip file contains html/css and images. The following line returns the image file names inside epub.&amp;#160; &lt;/p&gt;  &lt;p&gt;Select[Import[&amp;quot;test.epub&amp;quot;,&amp;quot;ZIP&amp;quot;], StringMatchQ[#,__~~&amp;quot;.jpg&amp;quot;, IgnoreCase-&amp;gt;True]&amp;amp;]&lt;/p&gt;  &lt;p&gt;Then the images can be changed into grayscale if necessary and re-formatted for e-reader. Just dump the images back into epub afterward.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5155402821531896173?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5155402821531896173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5155402821531896173' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5155402821531896173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5155402821531896173'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/10/processing-comic-images-for-e-reader.html' title='Processing comic images for e-reader'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6229796354369710378</id><published>2010-09-29T15:58:00.001-04:00</published><updated>2010-10-27T10:34:55.616-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Tips: Import MATLAB MAT-files</title><content type='html'>&lt;p&gt;You want to import the “.mat” file:&lt;/p&gt;  &lt;p&gt;Import[“Helheim.mat”]&lt;/p&gt;  &lt;p&gt;Import::fmterr: Cannot import data as MAT format. &amp;gt;&amp;gt;&lt;/p&gt;  &lt;p&gt;Don’t panic. Since the version 7.3 (2006b), Matlab actually saves mat files using the HDF5 format by default. So pretty much every mat file you work with nowadays is in HDF5 format. Let’s try it again.&lt;/p&gt;  &lt;p&gt;Import[&amp;quot;Helheim.mat&amp;quot;, &amp;quot;HDF5&amp;quot;]&lt;/p&gt;  &lt;p&gt;{&amp;quot;/Data&amp;quot;, &amp;quot;/Depth&amp;quot;, &amp;quot;/Distance&amp;quot;, &amp;quot;/Latitude&amp;quot;, &amp;quot;/Longitude&amp;quot;,&amp;#160; &amp;quot;/UTC_time&amp;quot;}&lt;/p&gt;  &lt;p&gt;data = Import[&amp;quot;Helheim.mat&amp;quot;, {&amp;quot;HDF5&amp;quot;, &amp;quot;Datasets&amp;quot;, &amp;quot;/Data&amp;quot;}];&lt;/p&gt;  &lt;p&gt;Then we can generate a beautiful plot in Mathematica.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/TKOaZCIJdUI/AAAAAAAACCo/SPh_ai2XCXE/s1600-h/viewmat%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="viewmat" border="0" alt="viewmat" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TKOaZhrXezI/AAAAAAAACCs/4fVjw_-s1uY/viewmat_thumb%5B4%5D.png?imgmax=800" width="361" height="275" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;For who may wonder what this image is, it is the radar image shows underground ice-thickness, more information can be found at &lt;a href="https://www.cresis.ku.edu/data"&gt;The Center for Remote Sensing of Ice Sheets (CReSIS)&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6229796354369710378?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6229796354369710378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6229796354369710378' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6229796354369710378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6229796354369710378'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/09/tips-import-matlab-mat-files.html' title='Tips: Import MATLAB MAT-files'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/TKOaZhrXezI/AAAAAAAACCs/4fVjw_-s1uY/s72-c/viewmat_thumb%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2361138186333649197</id><published>2010-08-25T20:47:00.001-04:00</published><updated>2010-08-25T22:24:40.879-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='CountryData'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Work with Web Map Service (WMS)</title><content type='html'>&lt;p&gt;&lt;a href="hhttp://en.wikipedia.org/wiki/Web_Map_Service"&gt;Web Map Service (WMS)&lt;/a&gt; is is a standard protocol for serving geo-referenced map images over the Internet. &lt;a href="http://onearth.jpl.nasa.gov/"&gt;JPL OneEarth&lt;/a&gt; is used as the data source here. &lt;/p&gt;  &lt;p&gt;All the datasets that exist on OneEarth server are documented for WMS clients in an XML &lt;a href="http://onearth.jpl.nasa.gov/wms.cgi?request=GetCapabilities"&gt;Capabilities file&lt;/a&gt;, which contains information about the &lt;i&gt;layers&lt;/i&gt;, which correspond to datasets, and the &lt;i&gt;styles&lt;/i&gt; associated with them.&lt;/p&gt;  &lt;p&gt;The base url is &lt;a title="http://wms.jpl.nasa.gov/wms.cgi?" href="http://wms.jpl.nasa.gov/wms.cgi"&gt;http://wms.jpl.nasa.gov/wms.cgi?&lt;/a&gt;, to request the image, some parameters are required: layers, srs, width, height, bbox, format, styles. Click the following url, it returns an satellite image from Blue Marble Next Generation, a MODIS-derived 500m true color earth dataset showing seasonal dynamics. styles is used to specify the month. Check OneEarth website for the details.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://wms.jpl.nasa.gov/wms.cgi?REQUEST=GetMap&amp;amp;layers=BMNG&amp;amp;srs=EPSG:4326&amp;amp;width=300&amp;amp;height=300&amp;amp;bbox=112,-44,154,-10&amp;amp;format=image/jpeg&amp;amp;styles=Jan" target="_blank"&gt;http://wms.jpl.nasa.gov/wms.cgi?REQUEST=GetMap&amp;amp;layers=BMNG&amp;amp;srs=EPSG:4326&amp;amp;width=300&amp;amp;height=300&amp;amp;bbox=112,-44,154,-10&amp;amp;format=image/jpeg&amp;amp;styles=Jan&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In Mathematica, image is imported with Import[wms_url]. However, once the image is imported, it loses the geo-reference information, and we need move the image back to its right position (bbox parameter).&lt;/p&gt;  &lt;p&gt;The trick is using Raster function to convert image to a graphic object with the right coordinates.&lt;/p&gt;  &lt;p&gt;raster = Raster[Reverse[ImageData[img]], {{112, -44}, {154, -10}}];&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_0mA_T7sKsO4/THW5qlkz_SI/AAAAAAAACCE/V8CGaOPQgt0/image%5B5%5D.png?imgmax=800" width="395" height="395" /&gt;&lt;/p&gt;  &lt;p&gt;I borrow the example from this &lt;a href="http://blog.wolfram.com/2009/01/13/visualizing-weather-patterns-in-mathematica-7/" target="_blank"&gt;weatherdata blog entry&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/THW5sihV6PI/AAAAAAAACCI/kODX8f6rgmg/s1600-h/image2%5B13%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image2" border="0" alt="image2" src="http://lh6.ggpht.com/_0mA_T7sKsO4/THW5uF0QgNI/AAAAAAAACCM/Pfrx2R8bmHY/image2_thumb%5B11%5D.png?imgmax=800" width="420" height="346" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The imported image works perfectly with the data from Mathematica. &lt;/p&gt;  &lt;p&gt;Mathematica Notebook: &lt;a href="http://www.box.net/shared/yxq04kxc2c" target="_blank"&gt;wmsimage.nb&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2361138186333649197?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2361138186333649197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2361138186333649197' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2361138186333649197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2361138186333649197'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/08/work-with-web-map-service-wms.html' title='Work with Web Map Service (WMS)'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/THW5qlkz_SI/AAAAAAAACCE/V8CGaOPQgt0/s72-c/image%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5897057112024882993</id><published>2010-08-20T12:44:00.001-04:00</published><updated>2010-08-20T12:45:02.120-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CityData'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Visualize weather pattern with random walk</title><content type='html'>&lt;p&gt;When talking about the “good” weather, the daily temperature change is important, slow steady change from day to day is much better than sudden temperature increase or drop. &lt;/p&gt;  &lt;p&gt;Here is the daily mean temperature for Bloomington, Indiana. &lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="bloomington" border="0" alt="bloomington" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TG6w1dot7yI/AAAAAAAACBA/ywfG-6XyBlA/bloomington%5B5%5D.png?imgmax=800" width="471" height="323" /&gt; &lt;/p&gt;  &lt;p&gt;We define a piecewise function to classify the day to day temperature change. x is (T – Tprevious day), y is the threshold to define the weather change: 1 ~ no change, 2 ~ cold move, 3 ~ mild cold, 4 ~ mild hot, 5 ~ hot move. &lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="piecewise" border="0" alt="piecewise" src="http://lh3.ggpht.com/_0mA_T7sKsO4/TG6w1kFaFZI/AAAAAAAACBE/ndbHlgRxBHU/piecewise%5B4%5D.png?imgmax=800" width="234" height="154" /&gt; &lt;/p&gt;  &lt;p&gt;Then we can apply the same random walk trick used in the post &lt;a href="http://mathgis.blogspot.com/2009/08/visualize-irrational-number-as-random.html"&gt;Visualize irrational number as random walk&lt;/a&gt;. The classification results are mapped into the moves: 1 ~ no move {0, 0}, 2 ~ move south {0, –1}, 2 ~ move west {-1, 0}, 3 ~ move east {1, 0}, 4 ~ move north {0, 1}. Then we can get a random walk image (the green dot is starting point {0, 0}, the red one is the end).&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="bloomingtonwalk" border="0" alt="bloomingtonwalk" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TG6w1_nfbaI/AAAAAAAACBI/MTRPj8WfMOE/bloomingtonwalk%5B6%5D.png?imgmax=800" width="528" height="148" /&gt; &lt;/p&gt;  &lt;p&gt;This is probably nothing interesting. However, we can use it to compare the patterns among different cities. Here is the results from Washington, Columbus, Indianapolis, Kansas City, Denver. The threshold is 3.5 degree. This shows the certain pattern among cities from ocean to inland. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/TG6w2cWfQiI/AAAAAAAACBc/w5SZ1-LpPOg/s1600-h/cities%5B14%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="cities" border="0" alt="cities" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TG6w2m1cMcI/AAAAAAAACBg/q_3cq_4sVBw/cities_thumb%5B12%5D.png?imgmax=800" width="540" height="198" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When we compare the cities across the ocean, a different pattern is shown.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/TG6w3OYtudI/AAAAAAAACBk/33S8gneNeEk/s1600-h/cities2%5B13%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="cities2" border="0" alt="cities2" src="http://lh4.ggpht.com/_0mA_T7sKsO4/TG6w3gvPJYI/AAAAAAAACBo/Ae4GKAaPA3I/cities2_thumb%5B11%5D.png?imgmax=800" width="546" height="231" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Down the &lt;a href="http://www.box.net/shared/lon9u7ozjj"&gt;weatherwalk.nb&lt;/a&gt; for the detail.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5897057112024882993?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5897057112024882993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5897057112024882993' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5897057112024882993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5897057112024882993'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/08/visualize-weather-pattern-with-random.html' title='Visualize weather pattern with random walk'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/TG6w1dot7yI/AAAAAAAACBA/ywfG-6XyBlA/s72-c/bloomington%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6623672911140981199</id><published>2010-04-19T23:19:00.001-04:00</published><updated>2010-04-19T23:22:02.400-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GraphPlot'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>Play with Bibliographic Data</title><content type='html'>&lt;p&gt;I’ve got the publication list of a research institute. There are more than 1400 entries, exported in xml format from Endnote. As a data mining project, there are plenty of things you can do with the data. Let’s assume&amp;#160; we are interested in the relationships among researchers and groups. Can we check this out quickly in Mathematica?&lt;/p&gt;  &lt;p&gt;First, extract the data:&lt;/p&gt;  &lt;p&gt;in the xml, for each publication, the author list is stored as the following:&lt;/p&gt;  &lt;p&gt;&amp;lt;authors&amp;gt;   &lt;br /&gt; &amp;lt;author&amp;gt;    &lt;br /&gt;&amp;#160; &amp;lt;style face=&amp;quot;normal&amp;quot; font=&amp;quot;default&amp;quot; size=&amp;quot;100%&amp;quot;&amp;gt;Paul, N.&amp;lt;/style&amp;gt;    &lt;br /&gt; &amp;lt;/author&amp;gt;    &lt;br /&gt; &amp;lt;author&amp;gt;    &lt;br /&gt;&amp;#160; &amp;lt;style face=&amp;quot;normal&amp;quot; font=&amp;quot;default&amp;quot; size=&amp;quot;100%&amp;quot;&amp;gt;Cao, B.&amp;lt;/style&amp;gt;    &lt;br /&gt; &amp;lt;/author&amp;gt;    &lt;br /&gt;… &amp;lt;/authors&amp;gt;&lt;/p&gt;  &lt;p&gt;xml = Import[&amp;quot;Bib.xml&amp;quot;]; &lt;/p&gt;  &lt;p&gt;authors = Cases[xml, XMLElement[&amp;quot;authors&amp;quot;, _, authors_] -&amp;gt; authors, Infinity];&lt;/p&gt;  &lt;p&gt;names = Flatten@Cases[#, XMLElement[&amp;quot;author&amp;quot;, _, {___, XMLElement[&amp;quot;style&amp;quot;, _, name_]}] –&amp;gt; name] &amp;amp; /@ authors;&lt;/p&gt;  &lt;p&gt;What we get here is the lists of authors for each publication.&lt;/p&gt;  &lt;p&gt;Let’ see the relationship between number of authors and number of publications.&lt;/p&gt;  &lt;p&gt;Sort[Tally[Length[#] &amp;amp; /@ names], #1[[1]] &amp;lt; #2[[1]] &amp;amp;]&lt;/p&gt;  &lt;p&gt;{{1, 265}, {2, 280}, {3, 320}, {4, 224}, {5, 94}, {6, 85}, {7,    &lt;br /&gt;&amp;#160; 39}, {8, 22}, {9, 20}, {10, 14}, {11, 11}, {12, 14}, {13, 5}, {14,     &lt;br /&gt;&amp;#160; 3}, {15, 5}, {18, 1}, {19, 1}, {20, 1}}&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="xml" border="0" alt="xml" src="http://lh6.ggpht.com/_0mA_T7sKsO4/S80dLPBUl7I/AAAAAAAAB-8/mSE2RvvJUxE/xml%5B5%5D.png?imgmax=800" width="424" height="257" /&gt; &lt;/p&gt;  &lt;p&gt;We can see that most of publications have no more than 4 authors. &lt;/p&gt;  &lt;p&gt;Next step, we like to check out the internal relationships among authors. We need to generate a network for authors. For example, if a publication has 4 authors {A, B, C, D}, the network is defined as a circle:&lt;/p&gt;  &lt;p&gt;Flatten@(Partition[Append[authors, authors[[1]]], 2, 1] /. {x_, y_} :&amp;gt; {x -&amp;gt; y})&lt;/p&gt;  &lt;p&gt;{A -&amp;gt; B, B -&amp;gt; C, C -&amp;gt; D, D -&amp;gt; A}&lt;/p&gt;  &lt;p&gt;For all the publications, we get the following network:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_0mA_T7sKsO4/S80dLzA9O-I/AAAAAAAAB_A/n7UZRI_BL9c/s1600-h/xml2%5B12%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="xml2" border="0" alt="xml2" src="http://lh3.ggpht.com/_0mA_T7sKsO4/S80dMUgsWAI/AAAAAAAAB_E/dttQjwLKTLs/xml2_thumb%5B10%5D.png?imgmax=800" width="440" height="462" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;There are two large research groups inside this institute. Then re-draw the graph with top 10 contributors, it confirms the information. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/S80dNFbiYjI/AAAAAAAAB_I/9YvgPP0lLyQ/s1600-h/xml3%5B6%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="xml3" border="0" alt="xml3" src="http://lh5.ggpht.com/_0mA_T7sKsO4/S80dNrW9YrI/AAAAAAAAB_M/BNhf0APs4mg/xml3_thumb%5B4%5D.png?imgmax=800" width="440" height="473" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;No too bad with 10 minutes coding.&lt;/p&gt;  &lt;p&gt;I will not release the notebook this time, since I may not have the right to distribute the data. Sorry about it.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6623672911140981199?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6623672911140981199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6623672911140981199' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6623672911140981199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6623672911140981199'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/04/play-with-bibliographic-data.html' title='Play with Bibliographic Data'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/S80dLPBUl7I/AAAAAAAAB-8/mSE2RvvJUxE/s72-c/xml%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3877086998075829281</id><published>2010-03-25T15:03:00.001-04:00</published><updated>2010-09-13T11:33:02.369-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Extract elevation data with Google Elevation Service</title><content type='html'>&lt;p&gt;In the previous post: &lt;a href="http://mathgis.blogspot.com/2009/07/extract-elevation-data-from-google.html"&gt;Extract elevation data from Google Earth&lt;/a&gt;, Google Earth COM API is used, it only works on Windows platform. Google Map now has &lt;a href="http://code.google.com/apis/maps/documentation/elevation/"&gt;Elevation Web Service&lt;/a&gt;, it is quite easy to do it with new API. The new service does not require a Maps API key. The basic form is &lt;/p&gt;  &lt;p&gt;“&lt;code&gt;http://maps.google.com/maps/api/elevation/&lt;i&gt;outputFormat&lt;/i&gt;?&lt;i&gt;parameters&lt;/i&gt;&lt;/code&gt;”&lt;/p&gt;  &lt;p&gt;For output format,&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;code&gt;/json&lt;/code&gt; returns results in &lt;a href="http://en.wikipedia.org/wiki/JSON"&gt;JavaScript Object Notation&lt;/a&gt; (JSON). &lt;/li&gt;    &lt;li&gt;&lt;code&gt;/xml&lt;/code&gt; returns results in XML, wrapped within a &lt;code&gt;&amp;lt;ElevationResponse&amp;gt;&lt;/code&gt; node. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;JSON is easy to parse, this is a sample query:    &lt;br /&gt;&lt;font face="Courier New"&gt;json=Import[&amp;quot;http://maps.google.com/maps/api/elevation/json?locations=39.7391536,-104.9847034&amp;amp;sensor=false&amp;quot;]&lt;/font&gt;&lt;/p&gt;  &lt;pre&gt;{&lt;br /&gt;&amp;#160; &amp;quot;status&amp;quot;: &amp;quot;OK&amp;quot;,&lt;br /&gt;&amp;#160; &amp;quot;results&amp;quot;: [ {&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;quot;location&amp;quot;: {&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;lat&amp;quot;: 39.7391536,&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;lng&amp;quot;: -104.9847034&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; },&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;quot;elevation&amp;quot;: 1608.8402100&lt;br /&gt;&amp;#160; } ]&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;ToExpression@StringCases[json, NumberString]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;{39.7392,-104.985,1608.84}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here is the example output:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GoogleEvelvationService0" border="0" alt="GoogleEvelvationService0" src="http://lh4.ggpht.com/_0mA_T7sKsO4/S6uzd1dFh-I/AAAAAAAAB-w/o7nU09ZT1Wo/GoogleEvelvationService0%5B6%5D.png?imgmax=800" width="340" height="341" /&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Path elevation example:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GoogleEvelvationService" border="0" alt="GoogleEvelvationService" src="http://lh3.ggpht.com/_0mA_T7sKsO4/S6uzeX46zFI/AAAAAAAAB-0/R-PM4tqVtpc/GoogleEvelvationService%5B8%5D.png?imgmax=800" width="352" height="224" /&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;DEM + Path:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GoogleEvelvationService2" border="0" alt="GoogleEvelvationService2" src="http://lh3.ggpht.com/_0mA_T7sKsO4/S6uzfYf6LdI/AAAAAAAAB-4/QH1Cy4FDJYQ/GoogleEvelvationService2%5B6%5D.png?imgmax=800" width="411" height="306" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Grab the &lt;a href="http://www.box.net/shared/vksidq960d"&gt;GoogleElevationService.nb&lt;/a&gt; for detail.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Update: answer the comments&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You may have the trouble with the notebook. Sometimes ListPlot3D runs too slow and even crashes Mathematica. You can switch to ListPlotPoint3D.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;ListPointPlot3D[dem[[All, {2, 1, 3}]], ColorFunction -&amp;gt; &amp;quot;Rainbow&amp;quot;]&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here is the example with 100 by 100 DEM.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="GoogleElevationService" border="0" alt="GoogleElevationService" src="http://lh5.ggpht.com/_0mA_T7sKsO4/TI5DlllAZVI/AAAAAAAACCk/1uL4hFAoxhg/GoogleElevationService%5B9%5D.png?imgmax=800" width="437" height="319" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3877086998075829281?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3877086998075829281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3877086998075829281' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3877086998075829281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3877086998075829281'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/03/extract-elevation-data-with-google.html' title='Extract elevation data with Google Elevation Service'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/S6uzd1dFh-I/AAAAAAAAB-w/o7nU09ZT1Wo/s72-c/GoogleEvelvationService0%5B6%5D.png?imgmax=800' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2377562535506561935</id><published>2010-01-26T19:16:00.001-05:00</published><updated>2010-01-26T19:16:07.443-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>More on Heatmap</title><content type='html'>&lt;p&gt;A reader asks about &lt;a href="http://flowingdata.com/2010/01/21/how-to-make-a-heatmap-a-quick-and-easy-solution/"&gt;this heatmap post on Flowing Data&lt;/a&gt;. Sure, we can do it easily with ArrayPlot. Grab &lt;a href="http://www.box.net/shared/19yt7mpp8n"&gt;the notebook here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;data = Import[&amp;quot;ppg2008.csv&amp;quot;];&lt;/p&gt;  &lt;p&gt;Grid[data] &lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Capture" border="0" alt="Capture" src="http://lh4.ggpht.com/_0mA_T7sKsO4/S1-FwBg435I/AAAAAAAAB9w/PD63uxl0Jcw/Capture%5B4%5D.png?imgmax=800" width="484" height="263" /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;numbers = data[[2 ;; All, 2 ;; All]]; (* this is the data for heatmap *)   &lt;br /&gt;playernames = data[[2 ;; All, 1]]; (* for the labels *)    &lt;br /&gt;statnames = data[[1, 2 ;; All]]; (* for the labels *)&lt;/p&gt;  &lt;p&gt;Then we need to scale the each column separately to [0,1].&lt;/p&gt;  &lt;p&gt;newnumber = Transpose[Rescale[#] &amp;amp; /@ (Transpose[numbers])];&lt;/p&gt;  &lt;p&gt;Then you can generate a simple heatmap simply by ArrayPlot[newnumber].&lt;/p&gt;  &lt;p&gt;Of course, we like to add the labels with FrameTicks option. FrameTicks-&amp;gt;{{left,right},{bottom,top}}&amp;#160; mark options specified separately for each edge.&amp;#160; &lt;/p&gt;  &lt;p&gt;Transpose[{Range[Length[playernames]], playernames}] generate the list {{1, “player1”} … {50, “player50”}} to label the player names.&lt;/p&gt;  &lt;p&gt;Transpose[{Range[Length[statnames]], Map[Rotate[#, 60 Degree] &amp;amp;, statnames]}] with this line, we can rotate the labels at the same time.&lt;/p&gt;  &lt;p&gt;Here is the final product, click to see the full graphic.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/S1-FwhkNvSI/AAAAAAAAB90/St6RBzeHWOM/s1600-h/NBAHeatmap%5B6%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="NBAHeatmap" border="0" alt="NBAHeatmap" src="http://lh4.ggpht.com/_0mA_T7sKsO4/S1-Fxl-6iiI/AAAAAAAAB94/fyX2gDQu81o/NBAHeatmap_thumb%5B4%5D.png?imgmax=800" width="456" height="417" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2377562535506561935?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2377562535506561935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2377562535506561935' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2377562535506561935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2377562535506561935'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/01/more-on-heatmap.html' title='More on Heatmap'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/S1-FwBg435I/AAAAAAAAB9w/PD63uxl0Jcw/s72-c/Capture%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1606394431313344878</id><published>2010-01-12T12:26:00.001-05:00</published><updated>2010-01-12T12:39:17.928-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Charting time series as calendar heat maps</title><content type='html'>&lt;p&gt;I haven’t updated this blog for a while. I am working on one Matlab project right now. It is kind of difficult for me to work with Matlab and Mathematica at the same time. &lt;/p&gt;  &lt;p&gt;There is an interesting post &lt;a href="http://blog.revolution-computing.com/2009/11/charting-time-series-as-calendar-heat-maps-in-r.html"&gt;Charting time series as calendar heat maps in R&lt;/a&gt;. The original idea from SAS &lt;a href="http://blog.revolution-computing.com/2009/09/analysis-of-airline-performance.html"&gt;Analysis of airline performance&lt;/a&gt;. I create a simple version in Mathematica. The tricky part is to generate the background grid.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="yeargid" border="0" alt="yeargid" src="http://lh6.ggpht.com/_0mA_T7sKsO4/S0yzxUFgGMI/AAAAAAAAB9s/HPoY8UGPAQo/yeargid%5B1%5D.png?imgmax=800" width="509" height="96" /&gt; &lt;/p&gt;  &lt;p&gt;The code I use is from an old tutorial of &lt;a href="http://documents.wolfram.com/mathematica/Demos/Notebooks/CalendarMaker.html"&gt;Making a Calendar&lt;/a&gt;. For each month, the boundary is defined by 8 points, marked out by darker line. The monthly grids are shifted to the right positions to form a yearly grid. Once you figure out this part, the rest is just straightforward.&lt;/p&gt;  &lt;p&gt;I use the stock as the example, this&amp;#160; is actually not the best data set for this type of visualization. &lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="aapl2008" border="0" alt="aapl2008" src="http://lh6.ggpht.com/_0mA_T7sKsO4/S0yws6rS5zI/AAAAAAAAB9g/J1k-qpeKUbY/aapl2008%5B6%5D.png?imgmax=800" width="443" height="305" /&gt; &lt;/p&gt;  &lt;p&gt;Calendar heatmap:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/S0ywtPI_-0I/AAAAAAAAB9k/37rvQuAcLBI/s1600-h/calendarheatmap%5B8%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="calendarheatmap" border="0" alt="calendarheatmap" src="http://lh5.ggpht.com/_0mA_T7sKsO4/S0ywtY_7eKI/AAAAAAAAB9o/LiGWwqKp1M0/calendarheatmap_thumb%5B6%5D.png?imgmax=800" width="495" height="115" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Download the file &lt;a href="http://www.box.net/shared/obhjz7y91b"&gt;calendarheatmap.nb&lt;/a&gt; for the detail.&lt;/p&gt;  &lt;p&gt;By the way, you can do whatever you like with the materials posted on this blog, there is no copyright problem.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1606394431313344878?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1606394431313344878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1606394431313344878' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1606394431313344878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1606394431313344878'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2010/01/charting-time-series-as-calendar-heat.html' title='Charting time series as calendar heat maps'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/S0yzxUFgGMI/AAAAAAAAB9s/HPoY8UGPAQo/s72-c/yeargid%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-7409432628749831255</id><published>2009-11-13T16:38:00.001-05:00</published><updated>2009-11-13T16:38:11.132-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><title type='text'>Make a US county thematic map using Mathematica</title><content type='html'>&lt;p&gt;I read a blog entry &lt;a href="http://flowingdata.com/2009/11/12/how-to-make-a-us-county-thematic-map-using-free-tools/"&gt;How to Make a US County Thematic Map Using Free Tools&lt;/a&gt;. The idea is to use Python script to modify the style settings in SVG file to make the most recent unemployment map. Mathematica can’t import SVG file directly, however, SVG file is in XML format, it is very easy to extract the necessary data from SVG file. If you are not sure what’s going here, please refer to the original blog.&lt;/p&gt;  &lt;p&gt;All the files are zipped together, just unzip it, run the notebook. &lt;a href="http://www.box.net/shared/2psadibutn"&gt;Download it here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/Sv3RwAYy9kI/AAAAAAAAB9E/XvwZZ5CFtVw/s1600-h/usamap%5B14%5D.png"&gt;&lt;img style="display: inline" title="usamap" alt="usamap" src="http://lh6.ggpht.com/_0mA_T7sKsO4/Sv3RwtrKTsI/AAAAAAAAB9M/QvrIg1rdXWw/usamap_thumb%5B12%5D.png?imgmax=800" width="455" height="309" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-7409432628749831255?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/7409432628749831255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=7409432628749831255' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7409432628749831255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7409432628749831255'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/11/make-us-county-thematic-map-using.html' title='Make a US county thematic map using Mathematica'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/Sv3RwtrKTsI/AAAAAAAAB9M/QvrIg1rdXWw/s72-c/usamap_thumb%5B12%5D.png?imgmax=800' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8067175485275448897</id><published>2009-11-02T16:02:00.001-05:00</published><updated>2009-11-25T09:24:56.352-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>User-defined color themes</title><content type='html'>&lt;p&gt;With &lt;a href="http://reference.wolfram.com/mathematica/ref/Blend.html"&gt;Blend&lt;/a&gt; function, it is quite simple to use user-defined color themes.&lt;/p&gt;  &lt;p&gt;Blend[{col&lt;sub&gt;1&lt;/sub&gt;, col&lt;sub&gt;2&lt;/sub&gt;, col&lt;sub&gt;3&lt;/sub&gt;, ...}, x]: linearly interpolates between colors col&lt;sub&gt;i&lt;/sub&gt; as x varies from 0 to 1.&lt;/p&gt;  &lt;p&gt;We like to use the following color theme:&lt;/p&gt;  &lt;p&gt;c = {{37, 57, 175}, {40, 127, 251}, {50, 190, 255}, {106, 235,    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 255}, {138, 236, 174}, {205, 255, 162}, {240, 236, 121}, {255,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; 189, 87}, {255, 161, 68}, {255, 186, 133}, {255, 255, 255}};&lt;/p&gt;  &lt;p&gt;colors = RGBColor[#/255] &amp;amp; /@ c;&lt;/p&gt;  &lt;p&gt;This shows the each color in the theme: &lt;/p&gt;  &lt;p&gt;Graphics[Table[{EdgeForm[Black], FaceForm[colors[[i]]],    &lt;br /&gt;&amp;#160;&amp;#160; Rectangle[{i, 0}, {i + 1, 1}]}, {i, 1, Length[colors]}]]&lt;/p&gt; &lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Colordata" border="0" alt="Colordata" src="http://lh3.ggpht.com/_0mA_T7sKsO4/Su9I5NHzpfI/AAAAAAAAB8o/o5p9cyKQhrk/Colordata%5B5%5D.png?imgmax=800" width="360" height="46" /&gt;   &lt;p&gt;Check the color theme with Blend function:&lt;/p&gt;  &lt;p&gt;DensityPlot[x, {x, 0, Length[c]}, {y, 0, 1}, AspectRatio -&amp;gt; Automatic,    &lt;br /&gt;&amp;#160; FrameTicks -&amp;gt; None, ColorFunction -&amp;gt; (Blend[colors, #] &amp;amp;),     &lt;br /&gt;PlotRangePadding -&amp;gt; None]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Colordata2" border="0" alt="Colordata2" src="http://lh4.ggpht.com/_0mA_T7sKsO4/Su9I6WpjV6I/AAAAAAAAB8s/VC7Ifia-v3E/Colordata2%5B5%5D.png?imgmax=800" width="360" height="34" /&gt; &lt;/p&gt;  &lt;p&gt;Then you probably notice how to use it in your own plot, &lt;/p&gt;  &lt;p&gt;ColorFunction -&amp;gt; (Blend[colors, #] &amp;amp;)&lt;/p&gt;  &lt;p&gt;Test the color theme with the data:&lt;/p&gt;  &lt;p&gt;ReliefPlot[data, ColorFunction -&amp;gt; (Blend[colors, #] &amp;amp;)]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/Su9I6ug2xaI/AAAAAAAAB8w/lN70v0rwrKo/s1600-h/Colordata3%5B6%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Colordata3" border="0" alt="Colordata3" src="http://lh6.ggpht.com/_0mA_T7sKsO4/Su9I7XKdJNI/AAAAAAAAB80/dHNGumFKGyc/Colordata3_thumb%5B4%5D.png?imgmax=800" width="233" height="275" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Maybe the ligher color is better.&lt;/p&gt;  &lt;p&gt;lightercolors = Lighter[#] &amp;amp; /@ colors;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/Su9I7-0UahI/AAAAAAAAB84/CtlQPsHhnWM/s1600-h/Colordata5%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Colordata5" border="0" alt="Colordata5" src="http://lh6.ggpht.com/_0mA_T7sKsO4/Su9I8Xf5l4I/AAAAAAAAB88/19uyO1AIbZ4/Colordata5_thumb%5B2%5D.png?imgmax=800" width="233" height="277" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Just for fun, let’s play the color theme with an existing image. &lt;/p&gt;  &lt;p&gt;img=ImageData[ColorConvert[place_any_image_here, ”Grayscale”]];&lt;/p&gt;  &lt;p&gt;ArrayPlot[img, ColorFunction -&amp;gt; (Blend[darkercolors, #] &amp;amp;)]&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8067175485275448897?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8067175485275448897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8067175485275448897' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8067175485275448897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8067175485275448897'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/11/user-defined-color-themes.html' title='User-defined color themes'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/Su9I5NHzpfI/AAAAAAAAB8o/o5p9cyKQhrk/s72-c/Colordata%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5780907162459192803</id><published>2009-10-20T13:20:00.001-04:00</published><updated>2009-10-21T16:48:54.673-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GraphPlot'/><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Wikipedia Page Analysis</title><content type='html'>&lt;p&gt;Wikipedia has lots of scientific information, however, due to its nature, it is still not considered as a research resource.&amp;#160; This doesn’t mean it has to be ignored. I have checked some pages related with various topics in GIS field. Most of them are well-written, the information are actually quite accurate, several contributors are the professionals in the field. In this post, I like to check some metadata information of&amp;#160; &lt;a href="http://en.wikipedia.org/wiki/Mathematica"&gt;“Mathematica” Page on Wikipedia&lt;/a&gt;, it may gives us some ideas about its quality. &lt;/p&gt;  &lt;p&gt;Tools we need: &lt;a href="http://en.wikipedia.org/w/api.php"&gt;Mediawiki API&lt;/a&gt; and Mathematica. There are plenty examples on how to use Mediawiki api. Basic procedure is to use Import[queryurl,”XML”], then parse xml to get the information we need.&lt;/p&gt;  &lt;p&gt;Page revision history:&lt;/p&gt;  &lt;p&gt;(* import&amp;#160; contributor and timestamp *)&lt;/p&gt;  &lt;p&gt;url = &amp;quot;http://en.wikipedia.org/w/api.php?action=query&amp;amp;prop=revisions&amp;amp;\    &lt;br /&gt;titles=Mathematica&amp;amp;rvprop=user|timestamp&amp;amp;rvlimit=500&amp;amp;redirects$rvuser&amp;amp;\     &lt;br /&gt;format=xml&amp;quot;;&lt;/p&gt;  &lt;p&gt;xml = Import[url, &amp;quot;XML&amp;quot;];    &lt;br /&gt;rawdata= Cases[xml, XMLElement[&amp;quot;rev&amp;quot;, w_, _] :&amp;gt; w, Infinity];     &lt;br /&gt;data = {&amp;quot;user&amp;quot;, &amp;quot;timestamp&amp;quot;} /. rawdata;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/St3xU5b097I/AAAAAAAAB8A/M9Dg1iZ7_qo/s1600-h/1%5B7%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1" border="0" alt="1" src="http://lh6.ggpht.com/_0mA_T7sKsO4/St3xVm3KbYI/AAAAAAAAB8E/MNyRInoQlU8/1_thumb%5B5%5D.png?imgmax=800" width="448" height="304" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/St3xV0CiYRI/AAAAAAAAB8I/IxH4WiNmCCk/s1600-h/2%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2" border="0" alt="2" src="http://lh4.ggpht.com/_0mA_T7sKsO4/St3xWQPJqRI/AAAAAAAAB8M/fjZKKNVjQqo/2_thumb%5B2%5D.png?imgmax=800" width="456" height="314" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;This page is constantly revised, we probably can assume the information on “Mathematica” page is up-to-date.&lt;/p&gt;  &lt;p&gt;The information on the contributors is also interesting.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/St3xWx2MddI/AAAAAAAAB8Q/EEb0PZehRgM/s1600-h/3%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3" border="0" alt="3" src="http://lh6.ggpht.com/_0mA_T7sKsO4/St3xXIn8v-I/AAAAAAAAB8U/jyjBGQbBE8E/3_thumb%5B3%5D.png?imgmax=800" width="499" height="283" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;We can dig out more information on the contributors:&lt;/p&gt;  &lt;p&gt;(* import paged edited by each user *)&lt;/p&gt;  &lt;p&gt;userpages[usr_] :=    &lt;br /&gt;&amp;#160; Module[{url, uxml, udata, unicase},     &lt;br /&gt;&amp;#160;&amp;#160; url = &amp;quot;http://en.wikipedia.org/w/api.php?action=query&amp;amp;list=\     &lt;br /&gt;usercontribs&amp;amp;uclimit=500&amp;amp;format=xml&amp;amp;ucuser=&amp;quot; &amp;lt;&amp;gt; usr;     &lt;br /&gt;&amp;#160;&amp;#160; uxml = Import[url, &amp;quot;XML&amp;quot;];     &lt;br /&gt;&amp;#160;&amp;#160; udata = Cases[uxml, XMLElement[&amp;quot;item&amp;quot;, w_, _] :&amp;gt; w, Infinity];     &lt;br /&gt;&amp;#160;&amp;#160; unicase = DeleteCases[Union[&amp;quot;title&amp;quot; /. udata ],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; x_ /; (StringMatchQ[x, &amp;quot;User talk:&amp;quot; ~~ __] || StringMatchQ[x, &amp;quot;Talk:&amp;quot; ~~ __] || StringMatchQ[x, &amp;quot;User:&amp;quot; ~~ __])]; Map[usr -&amp;gt; # &amp;amp;, unicase]];&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/St3xXhq4OPI/AAAAAAAAB8Y/6KVHLDTIn6M/s1600-h/4%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="4" border="0" alt="4" src="http://lh4.ggpht.com/_0mA_T7sKsO4/St3xX1BDGLI/AAAAAAAAB8c/kwQxTreAjpY/4_thumb%5B2%5D.png?imgmax=800" width="467" height="292" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The common pages edited by these top5 contributors:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/St3xYeshBpI/AAAAAAAAB8g/IvuScj8QlK8/s1600-h/5%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="5" border="0" alt="5" src="http://lh6.ggpht.com/_0mA_T7sKsO4/St3xY1ptITI/AAAAAAAAB8k/-AQiATkDt1Y/5_thumb%5B2%5D.png?imgmax=800" width="401" height="333" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;From the pages they have edited, they have worked on several topics closely related with Mathematica. This looks good, we may say they probably know what they are doing. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.box.net/shared/9nz3c80zxg"&gt;&lt;font color="#333333"&gt;Download &lt;/font&gt;&lt;strong&gt;Wikipedia Notebook&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&amp;#160;&lt;/strong&gt;for the details. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5780907162459192803?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5780907162459192803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5780907162459192803' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5780907162459192803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5780907162459192803'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/10/wikipedia-page-analysis.html' title='Wikipedia Page Analysis'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/St3xVm3KbYI/AAAAAAAAB8E/MNyRInoQlU8/s72-c/1_thumb%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2347824803298124456</id><published>2009-10-15T23:46:00.001-04:00</published><updated>2009-10-15T23:46:18.662-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Mathematica 7 on Windows 7</title><content type='html'>&lt;p&gt;We just updated our machine from Windows Vista to Windows 7. I re-installed Mathematica 7 and tested with several notebooks. I didn’t notice any difference on performance.&lt;/p&gt;  &lt;p&gt;You can re-use the license file from Vista.&lt;/p&gt;  &lt;p&gt;C:\Users\user_name\AppData\Roaming\Mathematica\Licensing\mathpass&lt;/p&gt;  &lt;p&gt;One feature I tested is &lt;a href="http://reference.wolfram.com/mathematica/tutorial/HandwrittenMathRecognition.html"&gt;Handwritten Math Recognition in Windows 7&lt;/a&gt;. It works very well with some simple on-screen drawings. If you use a tablet PC, this may be quite convenient in classroom.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="handwriting" border="0" alt="handwriting" src="http://lh5.ggpht.com/_0mA_T7sKsO4/StfsioefvKI/AAAAAAAAB78/aPoMYadmrw4/handwriting%5B13%5D.png?imgmax=800" width="359" height="407" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2347824803298124456?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2347824803298124456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2347824803298124456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2347824803298124456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2347824803298124456'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/10/mathematica-7-on-windows-7.html' title='Mathematica 7 on Windows 7'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/StfsioefvKI/AAAAAAAAB78/aPoMYadmrw4/s72-c/handwriting%5B13%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5015683027568600213</id><published>2009-09-23T12:19:00.001-04:00</published><updated>2009-09-23T12:19:39.561-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Monitor Mathematica computation with email</title><content type='html'>&lt;p&gt;One of the new features in Mathematica 7.0 is allowing the &lt;a href="http://www.wolfram.com/products/mathematica/newin7/content/IntegratedProgrammaticEmail/"&gt;sending of email&lt;/a&gt; directly from&amp;#160; any Mathematica program. It turns out very convenient for the certain situation. We have some computation tasks take long time to finish, so we&amp;#160; let it run on the server. The problem is that once a while I have to ssh to the server to check the outputs to make sure nothing wrong with the computation. Now with the email function, I can get the update immediately for each computation step. This is really helpful, especially now days you can check the email almost everywhere.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/SrpKmTfn8DI/AAAAAAAAB70/o43P_zg-7ak/s1600-h/Picture%201%5B12%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Picture 1" border="0" alt="Picture 1" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SrpKmlFBlTI/AAAAAAAAB74/pM9wWC3nfDQ/Picture%201_thumb%5B10%5D.png?imgmax=800" width="283" height="328" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If you don’t need to check the detail, sending the update &lt;a href="http://blog.wolfram.com/2009/04/30/twittering-with-mathematica/"&gt;through the twitter&lt;/a&gt; is probably more cool.&lt;/p&gt;  &lt;p&gt;One thing I am not sure is that how to catch the error. If there is an error raised during the computation, the math kernel can automatically send out the email with the error message, this function will be perfect.&lt;/p&gt;  &lt;p&gt;By the way, this week I am working on an algorithm related with the Traveling Salesman Problem. If you check &lt;a href="http://mathworld.wolfram.com/TravelingSalesmanProblem.html"&gt;TSP on MathWolrd&lt;/a&gt;, download the notebook, you will notice it is created by a newer version of Mathematica. Open the file with any text editor, you will see:&lt;/p&gt;  &lt;p&gt;(* CreatedBy='Mathematica 8.0' *). &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5015683027568600213?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5015683027568600213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5015683027568600213' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5015683027568600213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5015683027568600213'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/09/monitor-mathematica-computation-with.html' title='Monitor Mathematica computation with email'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/SrpKmlFBlTI/AAAAAAAAB74/pM9wWC3nfDQ/s72-c/Picture%201_thumb%5B10%5D.png?imgmax=800' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1328922049975208999</id><published>2009-08-25T22:26:00.001-04:00</published><updated>2009-08-27T10:45:47.165-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nonsense'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Visualize irrational number as random walk</title><content type='html'>&lt;p&gt;Irrational numbers have decimal expansions that neither terminate nor become periodic. So we can get unlimited “random walk” steps from an irrational numbers.&lt;/p&gt;  &lt;p&gt;With the following code, the first 10000 digits of Sqrt[2] is presented as a random walk by converting it in base 4. 0, 1, 2 and 3 digit in base 4 represent 4 directions. Starting point is the green dot, the red one is the ending point.&lt;/p&gt;  &lt;p&gt;x = N[Sqrt[2], 10000];    &lt;br /&gt;walk = First@ RealDigits[x, 4];     &lt;br /&gt;rn = FoldList[Plus, {0, 0}, {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}[[# + 1]] &amp;amp; /@ walk];     &lt;br /&gt;Graphics[{Line[rn], PointSize[Large], Green, Point[First@rn], Red, Point[Last@rn]}]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="randomwalk1" border="0" alt="randomwalk1" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SpSdNCwWD5I/AAAAAAAAB7U/EX0gg7g1KfU/randomwalk1%5B11%5D.png?imgmax=800" width="202" height="413" /&gt;&lt;/p&gt;  &lt;p&gt;We can also display it with ArrayPlot by constructing a sparse array.&lt;/p&gt;  &lt;p&gt;(* shift the moves to {1,1} *)&lt;/p&gt;  &lt;p&gt;minx = Min[rn[[All, 1]]];    &lt;br /&gt;miny = Min[rn[[All, 2]]];     &lt;br /&gt;m = # + {-minx + 1, -miny + 1} &amp;amp; /@ rn;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;(* sparse array *)&lt;/p&gt;  &lt;p&gt;tt = Tally[m];    &lt;br /&gt;cd = SparseArray[tt[[All, 1]] -&amp;gt; tt[[All, 2]]];     &lt;br /&gt;cd = Transpose[cd];     &lt;br /&gt;ArrayPlot[cd, ColorFunction -&amp;gt; &amp;quot;Rainbow&amp;quot;, DataReversed -&amp;gt; True, ColorRules -&amp;gt; {0 -&amp;gt; White}]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="randomwalk2" border="0" alt="randomwalk2" src="http://lh4.ggpht.com/_0mA_T7sKsO4/SpSdNR8e1bI/AAAAAAAAB7Y/6tidfK1F2HY/randomwalk2%5B5%5D.png?imgmax=800" width="185" height="376" /&gt;&lt;/p&gt;  &lt;p&gt;Let’s visualize Sqrt[2], e, Pi in their first 50000 digits. It seems there are some similarities among these images.&lt;/p&gt;  &lt;p&gt;Sqrt[2]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2" border="0" alt="2" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SpSdOLIVj9I/AAAAAAAAB7c/xkkqLNtthhs/2%5B5%5D.png?imgmax=800" width="405" height="429" /&gt; &lt;/p&gt;  &lt;p&gt;Pi&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Pi" border="0" alt="Pi" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SpSdOzlSzHI/AAAAAAAAB7g/0wEQhI7Pq8w/Pi%5B6%5D.png?imgmax=800" width="474" height="272" /&gt;&lt;/p&gt;  &lt;p&gt;e&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="e" border="0" alt="e" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SpSdPfVwhdI/AAAAAAAAB7k/kbSO7I5ury0/e%5B6%5D.png?imgmax=800" width="405" height="458" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.blogger.com/profile/11470397333812090637"&gt;DrMajorBob&lt;/a&gt; said... in comments:&lt;/p&gt;  &lt;p&gt;Here's a 3D version:&lt;/p&gt;  &lt;p&gt;x = N[Sqrt[2], 10000];    &lt;br /&gt;walk = First@RealDigits[x, 6];     &lt;br /&gt;rn = FoldList[ Plus, {0, 0, 0}, {{0, 1, 0}, {1, 0, 0}, {0, -1, 0}, {-1, 0, 0}, {0, 0, 1}, {0, 0, -1}}[[# + 1]] &amp;amp; /@ walk ];     &lt;br /&gt;Graphics3D[{Line[rn], PointSize[Large], Green, Point[First@rn], Red, Point[Last@rn]}]&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3d" border="0" alt="3d" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SpXe0YwMUPI/AAAAAAAAB7o/dzQCJrBXoHE/3d%5B5%5D.png?imgmax=800" width="359" height="355" /&gt; &lt;/p&gt;  &lt;p&gt;You can also try non-irrational number, e.g. 121/5^10&lt;/p&gt;  &lt;p&gt;Thanks.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Visualize genome sequence. I know nothing about it, it probably totally meaningless.&lt;/p&gt;  &lt;p&gt;GenePlot[g_] := Module[{cs, rn}, walk = Characters[GenomeData [g, &amp;quot;FullSequence&amp;quot;]] /. {&amp;quot;A&amp;quot; -&amp;gt; 1,&amp;#160; &amp;quot;T&amp;quot; -&amp;gt; 2, &amp;quot;G&amp;quot; -&amp;gt; 3, &amp;quot;C&amp;quot; -&amp;gt; 4};    &lt;br /&gt;&amp;#160; rn = FoldList[Plus, {0, 0}, {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}[[#]] &amp;amp; /@ walk];     &lt;br /&gt;&amp;#160; Graphics[{Line[rn], PointSize[Large], Green, Point[First@rn], Red, Point[Last@rn]}, Frame -&amp;gt; True, FrameTicks -&amp;gt; None] ]&lt;/p&gt;  &lt;p&gt;GenePlot[&amp;quot;DDK4&amp;quot;]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="geneplot" border="0" alt="geneplot" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SpacGW1fRwI/AAAAAAAAB7s/7-vXQvth2K4/geneplot%5B5%5D.png?imgmax=800" width="360" height="345" /&gt; &lt;/p&gt;  &lt;p&gt;GenePlot[&amp;quot;DKK3&amp;quot;]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="geneplot2" border="0" alt="geneplot2" src="http://lh4.ggpht.com/_0mA_T7sKsO4/SpacGmwTVsI/AAAAAAAAB7w/dDFE-yjUdyQ/geneplot2%5B5%5D.png?imgmax=800" width="356" height="229" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1328922049975208999?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1328922049975208999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1328922049975208999' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1328922049975208999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1328922049975208999'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/08/visualize-irrational-number-as-random.html' title='Visualize irrational number as random walk'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/SpSdNCwWD5I/AAAAAAAAB7U/EX0gg7g1KfU/s72-c/randomwalk1%5B11%5D.png?imgmax=800' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8841829835491682372</id><published>2009-08-12T11:30:00.001-04:00</published><updated>2009-08-12T11:30:57.147-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Display a plot by clicking a button</title><content type='html'>&lt;p&gt;Ok, this seems to be very easy in Mathematica.&lt;/p&gt;  &lt;p&gt;Button[&amp;quot;Show me a plot&amp;quot;, Show[Plot[Sin[x], {x, -Pi, Pi}]]]&lt;/p&gt;  &lt;p&gt;Then you click the button, nothing happens.&lt;/p&gt;  &lt;p&gt;Button[&amp;quot;Show me a plot&amp;quot;, Print[Plot[Sin[x], {x, -Pi, Pi}]]]&lt;/p&gt;  &lt;p&gt;This line will do the job. Or use the following line:&lt;/p&gt;  &lt;p&gt;Show[Plot[Sin[x], {x, -Pi, Pi}],    &lt;br /&gt;DisplayFunction -&amp;gt; (Button[&amp;quot;Show me a plot&amp;quot;, Print[#]] &amp;amp;)]&lt;/p&gt;  &lt;p&gt;The key here is to use “Print” rather than “Show”. It isn’t clearly explained in the “ref/Button”. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8841829835491682372?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8841829835491682372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8841829835491682372' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8841829835491682372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8841829835491682372'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/08/display-plot-by-clicking-button.html' title='Display a plot by clicking a button'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2488061700534317359</id><published>2009-08-07T15:59:00.001-04:00</published><updated>2009-08-07T15:59:59.763-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='GraphPlot'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>View weighted graph with GraphPlot</title><content type='html'>&lt;p&gt;Here is a simple example on how to customizing Graphplot. We like to use GraphPlot to visualize the number of people who commute into or out Monroe county from/to its neighbor counties. &lt;/p&gt;  &lt;p&gt;g={{&amp;quot;Owen&amp;quot; -&amp;gt; &amp;quot;Monroe&amp;quot;, 2813}, {&amp;quot;Greene&amp;quot; -&amp;gt; &amp;quot;Monroe&amp;quot;,    &lt;br /&gt;&amp;#160; 3788}, {&amp;quot;Lawrence&amp;quot; -&amp;gt; &amp;quot;Monroe&amp;quot;, 4022}, {&amp;quot;Jackson&amp;quot; -&amp;gt; &amp;quot;Monroe&amp;quot;,     &lt;br /&gt;&amp;#160; 85}, {&amp;quot;Brown&amp;quot; -&amp;gt; &amp;quot;Monroe&amp;quot;, 689}, {&amp;quot;Morgan&amp;quot; -&amp;gt; &amp;quot;Monroe&amp;quot;,     &lt;br /&gt;&amp;#160; 821}, {&amp;quot;Monroe&amp;quot; -&amp;gt; &amp;quot;Owen&amp;quot;, 676}, {&amp;quot;Monroe&amp;quot; -&amp;gt; &amp;quot;Greene&amp;quot;,     &lt;br /&gt;&amp;#160; 207}, {&amp;quot;Monroe&amp;quot; -&amp;gt; &amp;quot;Lawrence&amp;quot;, 679}, {&amp;quot;Monroe&amp;quot; -&amp;gt; &amp;quot;Brown&amp;quot;,     &lt;br /&gt;&amp;#160; 303}, {&amp;quot;Monroe&amp;quot; -&amp;gt; &amp;quot;Morgan&amp;quot;, 617}}&lt;/p&gt;  &lt;p&gt;vercoor={&amp;quot;Monroe&amp;quot; -&amp;gt; {-86.529, 39.1621}, &amp;quot;Owen&amp;quot; -&amp;gt; {-86.7642, 39.2868}, &amp;quot;Greene&amp;quot; -&amp;gt; {-86.9403, 39.0246},&amp;#160; &amp;quot;Lawrence&amp;quot; –&amp;gt; {&amp;#160; -86.4923,&amp;#160; 38.8627}, &amp;quot;Jackson&amp;quot; -&amp;gt; {-86.0462, 38.8798},&amp;#160; &amp;quot;Brown&amp;quot; -&amp;gt; {-86.2382, 39.203}, &amp;quot;Morgan&amp;quot; -&amp;gt; {-86.4238, 39.4233}}&lt;/p&gt;  &lt;p&gt;First try:&lt;/p&gt;  &lt;p&gt;GraphPlot[g, VertexLabeling -&amp;gt; True, VertexCoordinateRules -&amp;gt; vercoor]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="graphplot1" border="0" alt="graphplot1" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SnyHnbD10jI/AAAAAAAAB4w/aQ6aO4As3Gk/graphplot1%5B5%5D.png?imgmax=800" width="500" height="314" /&gt;&lt;/p&gt;  &lt;p&gt;Using arrow to indicate in/out seems to be a good idea. We use EdgeRenderingFunction in second try:&lt;/p&gt;  &lt;p&gt;GraphPlot[g, VertexLabeling -&amp;gt; True,    &lt;br /&gt;EdgeRenderingFunction -&amp;gt; (Arrow[#1, 0.05] &amp;amp;),     &lt;br /&gt;VertexCoordinateRules -&amp;gt; vercoor]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="graphplot2" border="0" alt="graphplot2" src="http://lh4.ggpht.com/_0mA_T7sKsO4/SnyHns6FINI/AAAAAAAAB40/XMwSDWhr6Ac/graphplot2%5B5%5D.png?imgmax=800" width="500" height="314" /&gt; &lt;/p&gt;  &lt;p&gt;However, the labels on the edge is lost. We can handle it in EdgeRenderingFunction.&lt;/p&gt;  &lt;p&gt;GraphPlot[g, VertexLabeling -&amp;gt; True,    &lt;br /&gt;EdgeRenderingFunction -&amp;gt; ({Text[#3, Mean[#1]], Arrow[#1, 0.05]} &amp;amp;),&amp;#160; VertexCoordinateRules -&amp;gt; vercoor]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="graphplot3" border="0" alt="graphplot3" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SnyHn52FubI/AAAAAAAAB44/e9kfeLUt7-0/graphplot3%5B5%5D.png?imgmax=800" width="500" height="314" /&gt; &lt;/p&gt;  &lt;p&gt;The graph is still difficult to read, the commuting pattern isn’t clear at a glance. We further update EdgeRenderingFunction and use the line color and thickness to show the pattern.&lt;/p&gt;  &lt;p&gt;GraphPlot[g,    &lt;br /&gt;EdgeRenderingFunction -&amp;gt; ({If[#2[[1]] == &amp;quot;Monroe&amp;quot;, Red, Blue],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; AbsoluteThickness[0.5 + #3/500], Arrowheads[0.02 + #3/120000],&amp;#160; Arrow[#1, 0.05]} &amp;amp;), VertexLabeling -&amp;gt; True,     &lt;br /&gt;VertexCoordinateRules -&amp;gt; vercoor]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="graphplot4" border="0" alt="graphplot4" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SnyHoZq_uBI/AAAAAAAAB48/oI0JWbHLgK0/graphplot4%5B5%5D.png?imgmax=800" width="500" height="314" /&gt; &lt;/p&gt;  &lt;p&gt;In the last try, we use VertexRenderingFunction to make the label more clear.&lt;/p&gt;  &lt;p&gt;GraphPlot[g,    &lt;br /&gt;EdgeRenderingFunction -&amp;gt; ({If[#2[[1]] == &amp;quot;Monroe&amp;quot;, Red, Blue],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; AbsoluteThickness[0.5 + #3/500], Arrowheads[0.02 + #3/120000], Arrow[#1, 0.06]} &amp;amp;), VertexLabeling -&amp;gt; True,     &lt;br /&gt;VertexCoordinateRules -&amp;gt; vercoor,     &lt;br /&gt;VertexRenderingFunction -&amp;gt; ({Text[Style[#2, 14, Bold], #2 /. vercoor, Background -&amp;gt; White]} &amp;amp;)]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="graphplot5" border="0" alt="graphplot5" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SnyHo_CHLWI/AAAAAAAAB5M/7IpTLiW04ds/graphplot5%5B6%5D.png?imgmax=800" width="500" height="314" /&gt; &lt;/p&gt;  &lt;p&gt;Import the shapefile, then you get a map:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="graphplot6" border="0" alt="graphplot6" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SnyHpHeGSiI/AAAAAAAAB5I/pLcXGaRpDUo/graphplot6%5B5%5D.png?imgmax=800" width="500" height="334" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2488061700534317359?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2488061700534317359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2488061700534317359' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2488061700534317359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2488061700534317359'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/08/view-weighted-graph-with-graphplot.html' title='View weighted graph with GraphPlot'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/SnyHnbD10jI/AAAAAAAAB4w/aQ6aO4As3Gk/s72-c/graphplot1%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1023374350593480462</id><published>2009-07-29T14:06:00.001-04:00</published><updated>2009-07-29T14:07:36.269-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='FinancialData'/><title type='text'>View stock market seasonality</title><content type='html'>&lt;p&gt;A reader asks about &lt;a href="http://www.seasonalcharts.com/"&gt;the seasonal chart&lt;/a&gt;. Here is a simpler version.&lt;/p&gt;  &lt;p&gt;The seasonality is defined as the percent change from the beginning of year to the end of each month.&lt;/p&gt;  &lt;p&gt;monthlychange[stock_, year_] :=    &lt;br /&gt;Module[{data, firstdateprice, endofmonthprice},     &lt;br /&gt;&amp;#160; data = FinancialData[stock, &amp;quot;Close&amp;quot;, {{year, 1, 1}, {year, 12, 31}}];     &lt;br /&gt;&amp;#160; data = Map[Flatten[#] &amp;amp;, data]; firstdateprice = data[[1, 4]];     &lt;br /&gt;&amp;#160; endofmonthprice = Table[Last@Select[data, #[[2]] == i &amp;amp;][[All, 4]], {i, 12}]; (endofmonthprice/firstdateprice - 1)*100]&lt;/p&gt;  &lt;p&gt;This will give you the monthly change of AAPL in the year of 2008.&lt;/p&gt;  &lt;p&gt;monthlychange[&amp;quot;AAPL&amp;quot;, 2008]&lt;/p&gt;  &lt;p&gt;For multiple years, the average seasonality:&lt;/p&gt;  &lt;p&gt;mc = monthlychange[&amp;quot;AAPL&amp;quot;, #] &amp;amp; /@ Range[2000, 2008];&lt;/p&gt;  &lt;p&gt;Mean@mc&lt;/p&gt;  &lt;p&gt;For APPL, the following graph shows the average seasonality from 2000 – 2008. According to this graph, it is probably a good idea to hold the stock through Oct and Nov before selling it.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="seasonality" border="0" alt="seasonality" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SnCPjwgCJ_I/AAAAAAAAB4U/OtyW03SoJy4/seasonality%5B6%5D.png?imgmax=800" width="470" height="303" /&gt; &lt;/p&gt;  &lt;p&gt;This is a graph shows the seasonality year by year.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_0mA_T7sKsO4/SnCPkZ2gnTI/AAAAAAAAB4g/yjD0UWyPpmg/s1600-h/seasonality2%5B7%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="seasonality2" border="0" alt="seasonality2" src="http://lh4.ggpht.com/_0mA_T7sKsO4/SnCPkr2tJhI/AAAAAAAAB4k/9mponW-YP6U/seasonality2_thumb%5B5%5D.png?imgmax=800" width="450" height="261" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1023374350593480462?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1023374350593480462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1023374350593480462' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1023374350593480462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1023374350593480462'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/07/view-stock-market-seasonality.html' title='View stock market seasonality'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/SnCPjwgCJ_I/AAAAAAAAB4U/OtyW03SoJy4/s72-c/seasonality%5B6%5D.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1538006610409163013</id><published>2009-07-28T15:14:00.001-04:00</published><updated>2009-07-28T15:14:03.692-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='FinancialData'/><title type='text'>View stock market with heatmap</title><content type='html'>&lt;p&gt;There is &lt;a href="http://screening.nasdaq.com/heatmaps/heatmap_100.asp"&gt;a heatmap tool&lt;/a&gt; which let you view the stock price change at a glance. It can be recreated with Mathematica in several lines of code.&lt;/p&gt;  &lt;p&gt;Let’s pull the data by format {“symbol”, price change}&lt;/p&gt;  &lt;p&gt;stockdata={#,(FinancialData[#]/FinancialData[#,&amp;quot;Close&amp;quot;]-1)*100 }&amp;amp; /@FinancialData[&amp;quot;^DJI&amp;quot;,&amp;quot;Members&amp;quot;];&lt;/p&gt;  &lt;p&gt;Then we need to represent the price change by color: Green means up, Red mean down, and the deeper the color, the bigger the change.&lt;/p&gt;  &lt;p&gt;max = Max[Abs[stockdata[[All, 2]]]]; (* max change *)&lt;/p&gt;  &lt;p&gt;GraphicsGrid[Partition[Graphics[{If[#[[2]]&amp;gt;=0.0,Blend[{White,Green},Rescale[#[[2]], {0,max}]], Blend[{Red,White}, Rescale[#[[2]],{-max,0}]]], Rectangle[], Black,Text[Style[#[[1]]&amp;lt;&amp;gt;&amp;quot;\n&amp;quot;&amp;lt;&amp;gt;ToString[NumberForm[#[[2]],{3,2}]]&amp;lt;&amp;gt;&amp;quot;%&amp;quot;, Medium,Bold], {0.5,0.5}]}] &amp;amp;/@ stockdata, 6 ]]&lt;/p&gt;  &lt;p&gt;The key function is if the price change is &amp;gt;0, then rescale the change in range (0, max) and get it’s color in Blend[{White, Green}]; if the price change is &amp;lt;0, then rescale the change in range (-max, 0) and use Blend[{Red, White}] to get the right color.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HeatMap1" border="0" alt="HeatMap1" src="http://lh5.ggpht.com/_0mA_T7sKsO4/Sm9N-AfxwII/AAAAAAAAB4I/90vzDixJsLM/HeatMap1%5B7%5D.png?imgmax=800" width="518" height="454" /&gt; &lt;/p&gt;  &lt;p&gt;In the ascending order:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HeatMap2" border="0" alt="HeatMap2" src="http://lh5.ggpht.com/_0mA_T7sKsO4/Sm9N-elMCTI/AAAAAAAAB4M/lvo93mcw0lY/HeatMap2%5B5%5D.png?imgmax=800" width="513" height="450" /&gt; &lt;/p&gt;  &lt;p&gt;We can try other representations, too. For example, we can use the size of disk to represent the change.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="HeatMap3" border="0" alt="HeatMap3" src="http://lh5.ggpht.com/_0mA_T7sKsO4/Sm9N-vV379I/AAAAAAAAB4Q/kpPV0rWeIfk/HeatMap3%5B5%5D.png?imgmax=800" width="523" height="459" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1538006610409163013?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1538006610409163013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1538006610409163013' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1538006610409163013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1538006610409163013'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/07/view-stock-market-with-heatmap.html' title='View stock market with heatmap'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/Sm9N-AfxwII/AAAAAAAAB4I/90vzDixJsLM/s72-c/HeatMap1%5B7%5D.png?imgmax=800' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-4084167475370699312</id><published>2009-07-16T16:12:00.001-04:00</published><updated>2009-07-16T16:12:12.524-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Read binary file with ByteOrdering option</title><content type='html'>&lt;p&gt;This is probably a very trivial problem for the ones who work on both PC and Unix platforms. I download a small DEM (478 rows by 399 columns) stored as Int16 binary from &lt;a href="http://www.ngdc.noaa.gov/mgg/topo/globe.html"&gt;The Gloabal Land 1-km Base Elevation Project&lt;/a&gt;. The range of elevation is 99 ~ 397 meters.&lt;/p&gt;  &lt;p&gt;Then in an Apple Power Mac G5:&lt;/p&gt;  &lt;p&gt;data = BinaryReadList[&amp;quot;mydata.bin&amp;quot;, Table[&amp;quot;Integer16&amp;quot;, {399}],&amp;#160; 478];&lt;/p&gt;  &lt;p&gt;ArrayPlot[data, PlotRange -&amp;gt; {99,&amp;#160; 397}]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="dem2" border="0" alt="dem2" src="http://lh6.ggpht.com/_0mA_T7sKsO4/Sl-Jmsq0YZI/AAAAAAAAB3o/fP9ap3q_2Fg/dem2%5B5%5D.png?imgmax=800" width="360" height="428" /&gt; &lt;/p&gt;  &lt;p&gt;Obviously, something wrong with the numeric value loaded from the binary file. It turns out the binary is using little endian. However, the Power Mac is using big endian. You can check your system with &lt;a href="http://reference.wolfram.com/mathematica/ref/$ByteOrdering.html"&gt;$ByteOrdering&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Read the data again with the right ByteOrdering option.&lt;/p&gt;  &lt;p&gt;data = BinaryReadList[&amp;quot;mydata.bin&amp;quot;, Table[&amp;quot;Integer16&amp;quot;, {399}],&amp;#160; 478, ByteOrdering-&amp;gt;-1];&lt;/p&gt;  &lt;p&gt;ArrayPlot[data, ColorFunction-&amp;gt;&amp;quot;Rainbow&amp;quot;,&amp;#160; PlotRange -&amp;gt; {99,&amp;#160; 397}]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="dem1" border="0" alt="dem1" src="http://lh6.ggpht.com/_0mA_T7sKsO4/Sl-JmypTiDI/AAAAAAAAB3s/T6l3OiHjrk8/dem1%5B5%5D.png?imgmax=800" width="360" height="428" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-4084167475370699312?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/4084167475370699312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=4084167475370699312' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4084167475370699312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4084167475370699312'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/07/read-binary-file-with-byteordering.html' title='Read binary file with ByteOrdering option'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/Sl-Jmsq0YZI/AAAAAAAAB3o/fP9ap3q_2Fg/s72-c/dem2%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5236753928998687799</id><published>2009-07-09T10:51:00.001-04:00</published><updated>2009-07-09T10:51:19.223-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Extract elevation data from Google Earth</title><content type='html'>&lt;p&gt;In Google Earth COM API, there is a function: &lt;a href="http://earth.google.com/comapi/interfaceIApplicationGE.html#843687cd860174963e6c8306024be92f"&gt;GetPointOnTerrainFromScreenCoords&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Given an screen_x and screen_y, it returns IPointOnTerrainGE object, which gives out the {Latitude, Longitude, Altitude}&lt;/p&gt;  &lt;p&gt;Screen coordinates range from (-1, –1) to (+1, +1)&lt;/p&gt;  &lt;p&gt;(&lt;code&gt;-1&lt;/code&gt;, &lt;code&gt;-1&lt;/code&gt;) - bottom left hand corner of the screen. (&lt;code&gt;0&lt;/code&gt;,&lt;code&gt;0&lt;/code&gt;) - center of the screen. (&lt;code&gt;1&lt;/code&gt;, &lt;code&gt;1&lt;/code&gt;) - top right hand corner of the screen. &lt;/p&gt;  &lt;p&gt;Let’s use this function in Mathematica to extract elevation data.&lt;/p&gt;  &lt;p&gt;First, zoom Google Earth into a testing place &lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="googleearth" border="0" alt="googleearth" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SlYD41WBZcI/AAAAAAAAB3c/9llGhfH_Gl8/googleearth%5B9%5D.png?imgmax=800" width="415" height="371" /&gt; &lt;/p&gt;  &lt;p&gt;Then in Mathematica:&lt;/p&gt;  &lt;p&gt;Needs[&amp;quot;NETLink`&amp;quot;]    &lt;br /&gt;InstallNet[]     &lt;br /&gt;ge = CreateCOMObject[&amp;quot;GoogleEarth.ApplicationGE&amp;quot;];&lt;/p&gt;  &lt;p&gt;getAltitude[x_, y_] :=    &lt;br /&gt;&amp;#160; Module[{pv},     &lt;br /&gt;&amp;#160;&amp;#160; pv = ge@GetPointOnTerrainFromScreenCoords[x, y]; {pv@Longitude, pv@Latitude, pv@Altitude}];&lt;/p&gt;  &lt;p&gt;(* extract 50 by 50 grids around the center of the screen *)    &lt;br /&gt;dem = Table[     &lt;br /&gt;&amp;#160;&amp;#160; getAltitude[x, y], {x, -0.5, 0.5, 0.02}, {y, -0.5, 0.5, 0.02}];&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="dem" border="0" alt="dem" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SlYD5YfBUqI/AAAAAAAAB3g/CKQ7xUDbtos/dem%5B13%5D.png?imgmax=800" width="474" height="309" /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Next situation: Given a list of {Latitude, Longitude}, how can we get the corresponding elevations for each location? &lt;/p&gt;  &lt;p&gt;The tip is to use the camera control to move the center of screen to the given&amp;#160; {Latitude, Longitude}.&lt;/p&gt;  &lt;p&gt;cam = ge@GetCamera[1];&lt;/p&gt;  &lt;p&gt;getAltitudebyLatLon[{lat_, Lon_}] :=    &lt;br /&gt; Module[{pv}, cam@FocusPointLongitude = Lon;    &lt;br /&gt;&amp;#160; cam@FocusPointLatitude = lat; cam@Range = 8000; ge@SetCamera[cam, 5];    &lt;br /&gt;&amp;#160; pv = ge@GetPointOnTerrainFromScreenCoords[0, 0]; pv@Altitude]&lt;/p&gt;  &lt;p&gt;cam@Range is the control of “eye alt”, it is in meters.&lt;/p&gt;  &lt;p&gt;It comes very handy for extracting the cross-profile. &lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="GoolgeEarth2" border="0" alt="GoolgeEarth2" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SlYD5pSwgDI/AAAAAAAAB3k/_EOwO7ndDsk/GoolgeEarth2%5B6%5D.png?imgmax=800" width="453" height="285" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5236753928998687799?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5236753928998687799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5236753928998687799' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5236753928998687799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5236753928998687799'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/07/extract-elevation-data-from-google.html' title='Extract elevation data from Google Earth'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/SlYD41WBZcI/AAAAAAAAB3c/9llGhfH_Gl8/s72-c/googleearth%5B9%5D.png?imgmax=800' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-7290900920358890546</id><published>2009-06-19T17:50:00.001-04:00</published><updated>2009-06-19T17:50:16.190-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='CountryData'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Control Google Earth from Mathematica</title><content type='html'>&lt;p&gt;This is for Windows platform only. With Mathematica’s .NET link and &lt;a href="http://earth.google.com/comapi/"&gt;Google Earth COM API&lt;/a&gt;, we can control Google Earth’s camera and add features directly from Matheamtica.&lt;/p&gt;  &lt;p&gt;There is an example of planning a shortest tour through every country of the world in &lt;a href="http://reference.wolfram.com/mathematica/ref/FindShortestTour.html"&gt;Document: FindShortestTour&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;SC[{lat_,lon_}]:=r {Cos[lon \[Degree]] Cos[lat \[Degree]],Sin[lon \[Degree]] Cos[lat \[Degree]],Sin[lat \[Degree]]};    &lt;br /&gt;r=6378.7;     &lt;br /&gt;places=CountryData[&amp;quot;Countries&amp;quot;];     &lt;br /&gt;centers=Map[CountryData[#,&amp;quot;CenterCoordinates&amp;quot;]&amp;amp;,places];     &lt;br /&gt;distfun[{lat1_,lon1_},{lat2_,lon2_}]:=VectorAngle[SC[{lat1,lon1}],SC[{lat2,lon2}]] r;     &lt;br /&gt;{dist,route}=FindShortestTour[centers,DistanceFunction-&amp;gt;distfun];&lt;/p&gt; &lt;!--CRLF--&gt;  &lt;p&gt;Let’s view this example in Google Earth:&lt;/p&gt;  &lt;p&gt;Needs[&amp;quot;NETLink`&amp;quot;]    &lt;br /&gt;InstallNET[];&lt;/p&gt;  &lt;p&gt;(* startup google earth *)    &lt;br /&gt;ge = CreateCOMObject[&amp;quot;GoogleEarth.ApplicationGE&amp;quot;];&lt;/p&gt;  &lt;p&gt;(* load path file already generated *)    &lt;br /&gt;ge@OpenKmlFile[&amp;quot;d:/temp/test2.kml&amp;quot;,1]&lt;/p&gt;  &lt;p&gt;(* get the camera object *)    &lt;br /&gt;cam=ge@GetCamera[1];&lt;/p&gt;  &lt;p&gt;(* funcion to ratate the camera *)    &lt;br /&gt;runcam[{lat_,lon_}]:=Module[{},     &lt;br /&gt;cam@FocusPointLongitude=lon;     &lt;br /&gt;cam@FocusPointLatitude=lat;     &lt;br /&gt;ge@SetCamera[cam,2]];&lt;/p&gt;  &lt;p&gt;(* let's see the movie *)    &lt;br /&gt;runcam[#]&amp;amp;/@ centers[[route]];&lt;/p&gt;  &lt;p&gt;Here is a low quality video.&lt;/p&gt; &lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/qrDvzrHNMtE&amp;amp;hl=en&amp;amp;fs=1&amp;amp;rel=0"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/qrDvzrHNMtE&amp;amp;hl=en&amp;amp;fs=1&amp;amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Here is &lt;a href="http://www.box.net/shared/dxekhvhsia"&gt;test2.kml&lt;/a&gt; for the shortest path&lt;/p&gt;  &lt;p&gt;Here is the recorded tour (&lt;a href="http://www.box.net/shared/sd7vq55lv1"&gt;shortestrout.kmz&lt;/a&gt;) in Google Earth&lt;/p&gt;  &lt;p&gt;First load test2.kml to Google Earth, then double click ShortestRoute.kmz to view the animation.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-7290900920358890546?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/7290900920358890546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=7290900920358890546' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7290900920358890546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7290900920358890546'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/06/control-google-earth-from-mathematica.html' title='Control Google Earth from Mathematica'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1922052804441386769</id><published>2009-06-17T15:48:00.001-04:00</published><updated>2009-06-17T15:48:32.006-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='CityData'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Mathematica 7: Export ESRI shapefile</title><content type='html'>&lt;p&gt;One way to achieve this goal is by using the spatial database. Oracle and PostgreSQL have excellent supports of spatial data types. All you need to do is to connect the database in Mathematica and insert the data into the spatial database. There are tools come with databases allow you to dump the data into a shapefile. If you need a light-weighted spatial database, you can try &lt;a href="http://www.gaia-gis.it/spatialite/"&gt;SpatiaLite&lt;/a&gt;, it is based on popular SQLite. &lt;/p&gt;  &lt;p&gt;For Windows platform, download the followings first:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.gaia-gis.it/spatialite/binaries.html"&gt;spatialite-tools&lt;/a&gt; and &lt;a href="http://www.gaia-gis.it/spatialite/resources.html"&gt;init_spatialite-2.3.sql&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;upzip them and copy spatialite.exe and init_spatialite-2.3.sql into the same folder.&lt;/p&gt;  &lt;p&gt;In this example, we like to export the following information to a shape file: &lt;/p&gt;  &lt;p&gt;data={First[#], CityData[#,&amp;quot;Population&amp;quot;], CityData[#,&amp;quot;Longitude&amp;quot;], CityData[#,&amp;quot;Latitude&amp;quot;]} &amp;amp;/@ CityData [{All, &amp;quot;Indiana&amp;quot;, &amp;quot;UnitedStates&amp;quot;}];&lt;/p&gt;  &lt;p&gt;We need write some SQLs:&lt;/p&gt;  &lt;p&gt;CREATE TABLE Towns (Name TEXT, Population INTEGER);    &lt;br /&gt;SELECT AddGeometryColumn('Towns','LonLat', 4326,'Point',2);&lt;/p&gt;  &lt;p&gt;4326 means&amp;#160; EPSG 4326, the coordinate reference system of WGS84(longitude, latitude) pair coordinates in degrees.&lt;/p&gt;  &lt;p&gt;To Insert the data:&lt;/p&gt;  &lt;p&gt;INSERT INTO Towns (Name, Population, LonLat) Values ('Indianapolis', 784118, GeomFromText ('Point(-86.1477 39.7909)', 4326));&lt;/p&gt;  &lt;p&gt;In Mathematica, this will create all the “INSERT” statements&lt;/p&gt;  &lt;p&gt;str=&amp;quot;INSERT INTO Towns (Name, Population, LonLat) Values ('v1', v2, GeomFromText('Point(v3 v4)',4326));&amp;quot;&lt;/p&gt;  &lt;p&gt;strs=StringReplace[str, {&amp;quot;v1&amp;quot;-&amp;gt;#[[1]], &amp;quot;v2&amp;quot;-&amp;gt;ToString[#[[2]]],&amp;quot;v3&amp;quot;-&amp;gt;ToString[#[[3]]], &amp;quot;v4&amp;quot;-&amp;gt;ToString[#[[4]]]}] &amp;amp;/@ data;&lt;/p&gt;  &lt;p&gt;Export[&amp;quot;insert.txt&amp;quot;, strs]&lt;/p&gt;  &lt;p&gt;Then we can put all the SQL statements together into one file (test.sql):&lt;/p&gt;  &lt;p&gt;BEGIN;    &lt;br /&gt;CREATE TABLE Towns (Name TEXT, Population INTEGER);     &lt;br /&gt;SELECT AddGeometryColumn('Towns','LonLat', 4326,'Point',2);     &lt;br /&gt;… INSERT INTO commands is here …     &lt;br /&gt;COMMIT; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;In window command line mode:&lt;/p&gt;  &lt;p&gt;spatialite.exe -init init_spatialite-2.3.sql test.sqlite &amp;lt; test.sql&lt;/p&gt;  &lt;p&gt;So far, we have got all the data from Mathematica into the table Towns in test.sqlite.&lt;/p&gt;  &lt;p&gt;run: spatialite.exe test.sqlite, and check if the records inside are right, then dump the shapefile:&lt;/p&gt;  &lt;p&gt;.dump Towns LonLat towns_shp ASCII POINT;&lt;/p&gt;  &lt;p&gt;Import the town_shp.shp back into Mathametica:&lt;/p&gt;  &lt;p&gt;Show[Import[&amp;quot;towns_shp.shp&amp;quot;], Frame -&amp;gt; True, FrameTicks -&amp;gt; Automatic]&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="towns" border="0" alt="towns" src="http://lh4.ggpht.com/_0mA_T7sKsO4/SjlIj29XR2I/AAAAAAAAB10/agU3enfnF4w/towns%5B5%5D.png?imgmax=800" width="360" height="432" /&gt; &lt;/p&gt;  &lt;p&gt;More information: &lt;a href="http://www.gaia-gis.it/spatialite/spatialite-tutorial-2.3.0.html"&gt;SpatiaLite Tutorial&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you are not comfortable with command-line tools, there is a &lt;a href="http://www.gaia-gis.it/spatialite/binaries.html"&gt;GUI tool for SpatiaLite&lt;/a&gt;. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1922052804441386769?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1922052804441386769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1922052804441386769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1922052804441386769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1922052804441386769'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/06/mathematica-7-export-esri-shapefile.html' title='Mathematica 7: Export ESRI shapefile'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/SjlIj29XR2I/AAAAAAAAB10/agU3enfnF4w/s72-c/towns%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8003648384580521112</id><published>2009-03-24T12:45:00.001-04:00</published><updated>2009-03-24T12:45:04.462-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='CityData'/><title type='text'>Testing the new map with Mathematica</title><content type='html'>&lt;p&gt;Generally speaking, when dealing with GIS data, you probably shouldn’t put Mathematica in top of your list.&amp;#160; However, when you want to develop a new algorithm or visualization, Mathamtica is a good choice to test the prototype.&lt;/p&gt;  &lt;p&gt;Here is an example: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/SckOCfOiCsI/AAAAAAAAB1k/Q93BRKg8yFc/s1600-h/newmap01%5B5%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="newmap01" border="0" alt="newmap01" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SckODIKbHHI/AAAAAAAAB1o/voJbcd6eTL4/newmap01_thumb%5B3%5D.png?imgmax=800" width="260" height="243" /&gt;&lt;/a&gt;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;The same map in the “forest” looking.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/SckODTi-9KI/AAAAAAAAB1s/AFUWLlG4tw8/s1600-h/newmap2%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="newmap2" border="0" alt="newmap2" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SckODxv-yLI/AAAAAAAAB1w/bG8nFuW-nn4/newmap2_thumb%5B2%5D.png?imgmax=800" width="260" height="120" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8003648384580521112?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8003648384580521112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8003648384580521112' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8003648384580521112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8003648384580521112'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/03/testing-new-map-with-mathematica.html' title='Testing the new map with Mathematica'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/SckODIKbHHI/AAAAAAAAB1o/voJbcd6eTL4/s72-c/newmap01_thumb%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-4751142313874725004</id><published>2009-03-09T20:49:00.001-04:00</published><updated>2009-03-09T20:49:53.274-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Color Blend</title><content type='html'>&lt;p&gt;Rainbow&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/SbW5JX5uQOI/AAAAAAAAB1M/KVsQqMeFkBs/s1600-h/3341674073_f431bdb189%5B5%5D.jpg"&gt;&lt;img title="3341674073_f431bdb189" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="260" alt="3341674073_f431bdb189" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SbW5KOoHmmI/AAAAAAAAB1Q/epupDMzlk4o/3341674073_f431bdb189_thumb%5B3%5D.jpg?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Pastel&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/SbW5KvXn3xI/AAAAAAAAB1U/Xlq6xn9T_lA/s1600-h/3342509102_b1ee3bbd8e%5B4%5D.jpg"&gt;&lt;img title="3342509102_b1ee3bbd8e" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="260" alt="3342509102_b1ee3bbd8e" src="http://lh4.ggpht.com/_0mA_T7sKsO4/SbW5LHY2KGI/AAAAAAAAB1Y/u0OJ7lgjOM4/3342509102_b1ee3bbd8e_thumb%5B2%5D.jpg?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Fruit Punch&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/SbW5Lr4E21I/AAAAAAAAB1c/_VIfyu6lL1k/s1600-h/3341674137_6898beb9aa%5B4%5D.jpg"&gt;&lt;img title="3341674137_6898beb9aa" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="260" alt="3341674137_6898beb9aa" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SbW5MJdro5I/AAAAAAAAB1g/gWFSeOsFPrA/3341674137_6898beb9aa_thumb%5B2%5D.jpg?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-4751142313874725004?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/4751142313874725004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=4751142313874725004' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4751142313874725004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4751142313874725004'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/03/color-blend.html' title='Color Blend'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/SbW5KOoHmmI/AAAAAAAAB1Q/epupDMzlk4o/s72-c/3341674073_f431bdb189_thumb%5B3%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3867055211328426929</id><published>2009-03-07T11:03:00.001-05:00</published><updated>2009-03-07T11:03:01.194-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Tip: processing large data sets</title><content type='html'>&lt;p&gt;When deal with large data sets, ReadList is more efficient than Import. &lt;/p&gt;  &lt;p&gt;From documentation:&lt;/p&gt;  &lt;p&gt;If file is not already open for reading, &lt;a href="http://reference.wolfram.com/mathematica/ref/ReadList.html"&gt;ReadList&lt;/a&gt; opens it, then closes it when it is finished. If the file is already open, &lt;a href="http://reference.wolfram.com/mathematica/ref/ReadList.html"&gt;ReadList&lt;/a&gt; does not close it at the end.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://reference.wolfram.com/mathematica/ref/ReadList.html"&gt;ReadList&lt;/a&gt;[stream] reads from an open input stream, as returned by &lt;a href="http://reference.wolfram.com/mathematica/ref/OpenRead.html"&gt;OpenRead&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;So we can use OpenRead to open the file, then use ReadList to load large data sets piece by piece.&lt;/p&gt;  &lt;p&gt;str = OpenRead[datafile]&lt;/p&gt;  &lt;p&gt;(* the first number in our data file is the total number of points *)&lt;/p&gt;  &lt;p&gt;ReadList[str, Number, 1] &lt;/p&gt;  &lt;p&gt;{17581099}&lt;/p&gt;  &lt;p&gt;Then we can read the real data in much smaller pieces every time, otherwise it may not have enough memory to run the processing algorithm. &lt;/p&gt;  &lt;p&gt;Here is the example&lt;/p&gt;  &lt;p&gt;(* read first 5 records *)&lt;/p&gt;  &lt;p&gt;ReadList[str, Number, 7*5, RecordLists -&amp;gt; True] // MatrixForm&lt;/p&gt;  &lt;p&gt;&lt;img title="data1" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="72" alt="data1" src="http://lh4.ggpht.com/_0mA_T7sKsO4/SbKasmqT7OI/AAAAAAAAB1E/qANPk_dcf58/data1%5B6%5D.png?imgmax=800" width="311" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;(* read the next 5 records *)&lt;/p&gt;  &lt;p&gt;ReadList[str, Number, 7*5, RecordLists -&amp;gt; True] // MatrixForm&lt;/p&gt;  &lt;p&gt;&lt;img title="data2" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="72" alt="data2" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SbKatFgXifI/AAAAAAAAB1I/kIIYYiRl3dw/data2%5B5%5D.png?imgmax=800" width="311" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;At the end, close the file by&lt;/p&gt;  &lt;p&gt;Close[str]&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3867055211328426929?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3867055211328426929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3867055211328426929' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3867055211328426929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3867055211328426929'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/03/tip-processing-large-data-sets.html' title='Tip: processing large data sets'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/SbKasmqT7OI/AAAAAAAAB1E/qANPk_dcf58/s72-c/data1%5B6%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1274832554261798901</id><published>2009-02-27T10:02:00.001-05:00</published><updated>2009-02-27T10:02:36.826-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Antialiasing in 3D graphics</title><content type='html'>&lt;p&gt;From documentation, this is a new feature in Mathematica 7.0:&lt;/p&gt;  &lt;p&gt;“For 3D graphics, the operation of &lt;a href="http://reference.wolfram.com/mathematica/ref/Antialiasing.html"&gt;Antialiasing&lt;/a&gt; can depend on the particular graphics hardware you are using. &lt;a href="http://reference.wolfram.com/mathematica/ref/Antialiasing.html"&gt;Antialiasing&lt;/a&gt; is &lt;u&gt;disabled&lt;/u&gt; unless Allow Antialiasing is set in the Preferences dialog.”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/SagAh6R1XlI/AAAAAAAAB0s/ibrZWM7Rwng/s1600-h/2%5B4%5D.png"&gt;&lt;img title="2" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="232" alt="2" src="http://lh4.ggpht.com/_0mA_T7sKsO4/SagAiB0D_MI/AAAAAAAAB0w/mav-DmttMI4/2_thumb%5B2%5D.png?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;See the difference:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/SagAipRw7HI/AAAAAAAAB00/_ZkrU9pSyZo/s1600-h/3%5B5%5D.png"&gt;&lt;img title="3" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="190" alt="3" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SagAi6bLgtI/AAAAAAAAB04/Mvy72r3F2yM/3_thumb%5B3%5D.png?imgmax=800" width="322" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you use a laptop with the integrated on-board&amp;#160; video, antialiasing in 3D may not be supported at all. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1274832554261798901?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1274832554261798901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1274832554261798901' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1274832554261798901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1274832554261798901'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/02/antialiasing-in-3d-graphics.html' title='Antialiasing in 3D graphics'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/SagAiB0D_MI/AAAAAAAAB0w/mav-DmttMI4/s72-c/2_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8914795468756580951</id><published>2009-02-25T21:29:00.001-05:00</published><updated>2009-02-25T21:29:38.395-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>A Bunny and many cuboids</title><content type='html'>&lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/SaX-fYdm8TI/AAAAAAAAB0c/DUkTASSW_cs/s1600-h/slide0%5B7%5D.png"&gt;&lt;img title="slide0" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="239" alt="slide0" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SaX-gUakwzI/AAAAAAAAB0g/ZYcqZhUBrb4/slide0_thumb%5B5%5D.png?imgmax=800" width="420" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/SaX-i57EtPI/AAAAAAAAB0k/m9K44veq6aI/s1600-h/Slide1%5B5%5D.png"&gt;&lt;img title="Slide1" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="320" alt="Slide1" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SaX-kWa3M8I/AAAAAAAAB0o/FKcJSw9iNng/Slide1_thumb%5B3%5D.png?imgmax=800" width="420" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8914795468756580951?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8914795468756580951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8914795468756580951' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8914795468756580951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8914795468756580951'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/02/bunny-and-many-cuboids.html' title='A Bunny and many cuboids'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_0mA_T7sKsO4/SaX-gUakwzI/AAAAAAAAB0g/ZYcqZhUBrb4/s72-c/slide0_thumb%5B5%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3283428487660009415</id><published>2009-02-22T20:12:00.001-05:00</published><updated>2009-02-22T20:36:03.576-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nonsense'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Counting coins with image processing</title><content type='html'>&lt;p&gt;Today I read a paper about automatically counting trees from satellite image, that makes me remember the coin-counting example from image processing class which I took many years ago.&lt;/p&gt;  &lt;p&gt;I put some coins on the back of the mouse pad, snap a photo with the web camera.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_0mA_T7sKsO4/SaH38ISE7vI/AAAAAAAABzw/ynAqa8pD-UY/s1600-h/picanom-picture-01-2009-02-22%5B10%5D.jpg"&gt;&lt;img title="picanom-picture-01-2009-02-22" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="179" alt="picanom-picture-01-2009-02-22" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SaH38j6VEcI/AAAAAAAABz0/tOtLOqKczlE/picanom-picture-01-2009-02-22_thumb%5B2%5D.jpg?imgmax=800" width="240" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;img2 = Binarize[img]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/SaH381nKKhI/AAAAAAAABz4/j_UwOcfsFBQ/s1600-h/countcoin2%5B3%5D.png"&gt;&lt;img title="countcoin2" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="179" alt="countcoin2" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SaH39RWQFmI/AAAAAAAABz8/Bg0hzDye5CA/countcoin2_thumb%5B1%5D.png?imgmax=800" width="240" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;img3 = ArrayPlot[MorphologicalComponents[img2]]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/SaH3956gjtI/AAAAAAAAB0A/hXgD4CY7Jsw/s1600-h/countcoin3%5B5%5D.png"&gt;&lt;img title="countcoin3" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="181" alt="countcoin3" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SaH3-D3vXBI/AAAAAAAAB0E/Bohgfs-vNY0/countcoin3_thumb%5B3%5D.png?imgmax=800" width="240" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now let’s do the counting.&lt;/p&gt;  &lt;p&gt;cd = Tally[Flatten[MorphologicalComponents[img2]]]&lt;/p&gt;  &lt;p&gt;{{0, 162643}, {1, 7600}, {2, 7633}, {3, 7369}, {4, 4309}, {5,    &lt;br /&gt;&amp;#160; 7679}, {6, 5868}, {7, 5883}, {8, 4082}}&lt;/p&gt;  &lt;p&gt;(* pick the image region which is possible for the coins *)&lt;/p&gt;  &lt;p&gt;cd2 = Select[cd[[All, 2]], # &amp;gt; 500 &amp;amp;&amp;amp; # &amp;lt; 10000 &amp;amp;]&lt;/p&gt;  &lt;p&gt;ListPlot[cd2, PlotStyle -&amp;gt; {PointSize[Large]}]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_0mA_T7sKsO4/SaH3-fhH3vI/AAAAAAAAB0I/HM2GqV1nSeA/s1600-h/countcoin4%5B3%5D.png"&gt;&lt;img title="countcoin4" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="151" alt="countcoin4" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SaH3-9cKQdI/AAAAAAAAB0M/r0cb2bUEQhA/countcoin4_thumb%5B1%5D.png?imgmax=800" width="240" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Clearly, there are three different groups of coins&lt;/p&gt;  &lt;p&gt;Total[Map[Length, Sort[FindClusters[cd2]]] {5, 10, 25}]&lt;/p&gt;  &lt;p&gt;130&lt;/p&gt;  &lt;p&gt;Using $xxxx Mathematica to counting coins is kind of stupid itself, however, there are plenty of engineering applications actually do the very similar things in more complex situations.&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3283428487660009415?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3283428487660009415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3283428487660009415' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3283428487660009415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3283428487660009415'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/02/counting-coins-with-image-processing.html' title='Counting coins with image processing'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/SaH38j6VEcI/AAAAAAAABz0/tOtLOqKczlE/s72-c/picanom-picture-01-2009-02-22_thumb%5B2%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8308491587627414598</id><published>2009-02-16T16:06:00.001-05:00</published><updated>2009-02-16T16:06:02.595-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Howto: Display 2D plot in 3D</title><content type='html'>&lt;p&gt;In GIS field, sometimes we like to stack several 2D plots together and display them inside a 3D box. For Mathematica, we need to define a function to convert a 2D plot into a 3D graphic object. I will use a small Geotiff as an example, you can &lt;a href="http://www.box.net/shared/gtukps23nx"&gt;download it here&lt;/a&gt; if you like to try the code.&lt;/p&gt;  &lt;p&gt;(*get the ElevationRange, then import data *)&lt;/p&gt;  &lt;p&gt;Import[&amp;quot;smalldem.tif&amp;quot;, {&amp;quot;Geotiff&amp;quot;, &amp;quot;ElevationRange&amp;quot;}]&lt;/p&gt;  &lt;p&gt;data = Import[&amp;quot;smalldem.tif&amp;quot;, {&amp;quot;Geotiff&amp;quot;, &amp;quot;Data&amp;quot;}];&lt;/p&gt;  &lt;p&gt;Then we a create the contour plot with 100 feet contours&lt;/p&gt;  &lt;p&gt;c1=ListContourPlot[data,MaxPlotPoints-&amp;gt;30,Contours-&amp;gt;Function[Range[650,850,100]],ColorFunction-&amp;gt;”DarkTerrain”,PlotRange-&amp;gt;{640,850}]&lt;/p&gt;  &lt;p&gt;Here the function we need to convert 2D plot into 3D&lt;/p&gt;  &lt;p&gt;to3d[plot_,height_,opacity_]:=Module[{newplot}, newplot = First@Graphics[plot];newplot=N@newplot /. {x_?AtomQ,y_?AtomQ}-&amp;gt;{x,y, height} ;    &lt;br /&gt;newplot /. GraphicsComplex[xx__]-&amp;gt;{Opacity[opacity], GraphicsComplex[xx]}];&lt;/p&gt;  &lt;p&gt;This function has three parameters: 2D plot, height, and opacity&lt;/p&gt;  &lt;p&gt;Let’s create two more contour plots with 50 and 20 feet contours respectively. Then we can stack them together by setting them in different heights.&lt;/p&gt;  &lt;p&gt;Show[{Graphics3D[to3d[c1,30,0.75]]}, Graphics3D[to3d[c2,20,0.75]], Graphics3D[to3d[c3,10,0.75]], Lighting-&amp;gt;&amp;quot;Neutral&amp;quot;, BoxRatios-&amp;gt;{1,1,0.8},Axes-&amp;gt;True]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_0mA_T7sKsO4/SZnVMlr6V5I/AAAAAAAABzY/t-gEtIGGlgg/s1600-h/listcontourplot02%5B6%5D.png"&gt;&lt;img title="listcontourplot02" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="237" alt="listcontourplot02" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SZnVNHTDAYI/AAAAAAAABzc/1Tac_75SR8w/listcontourplot02_thumb%5B4%5D.png?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Then we like to stack the original geotiff at the very bottom. This time we need to convert the raster into 3D. I use the example you can find in &lt;a href="http://reference.wolfram.com/mathematica/ref/ListPlot3D.html"&gt;Listplot3D&lt;/a&gt; (check the section of “Neat Examples”).&lt;/p&gt;  &lt;p&gt;r1=ReliefPlot[data,ColorFunction-&amp;gt;colorf,ImagePadding-&amp;gt;None, Frame-&amp;gt;False, ImageSize-&amp;gt;{800,800}];&lt;/p&gt;  &lt;p&gt;pic = Reverse[ImageData[r1]];&lt;/p&gt;  &lt;p&gt;bg=ListPlot3D[Table[1,{x,1,800,5},{y,1,800,5}],Mesh-&amp;gt;None, VertexColors-&amp;gt;{pic[[1;;800;;5,1;;800;;5]]},DataRange-&amp;gt;{{1,800},{1,800}}, Lighting-&amp;gt;&amp;quot;Neutral&amp;quot;]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/SZnVNSPI3cI/AAAAAAAABzg/n7vzP7rdBAg/s1600-h/listcontourplot03%5B4%5D.png"&gt;&lt;img title="listcontourplot03" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="212" alt="listcontourplot03" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SZnVN2uO7yI/AAAAAAAABzk/vU8zQIg5ZNY/listcontourplot03_thumb%5B2%5D.png?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The final product:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/SZnVODYKZYI/AAAAAAAABzo/lLWNbMa182o/s1600-h/listcontourplot01%5B9%5D.png"&gt;&lt;img title="listcontourplot01" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="260" alt="listcontourplot01" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SZnVOWPivxI/AAAAAAAABzs/-6RHkxrl3jk/listcontourplot01_thumb%5B7%5D.png?imgmax=800" width="202" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Here is &lt;a href="http://www.box.net/shared/z5brmtcxkn"&gt;the complete notebook&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8308491587627414598?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8308491587627414598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8308491587627414598' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8308491587627414598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8308491587627414598'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/02/howto-display-2d-plot-in-3d.html' title='Howto: Display 2D plot in 3D'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/SZnVNHTDAYI/AAAAAAAABzc/1Tac_75SR8w/s72-c/listcontourplot02_thumb%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-7972372419631680898</id><published>2009-02-13T16:40:00.001-05:00</published><updated>2009-02-13T17:33:46.427-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Display large DEM with MaxPlotPoints</title><content type='html'>&lt;p&gt;&lt;a href="http://reference.wolfram.com/mathematica/ref/MaxPlotPoints.html"&gt;MaxPlotPoints&lt;/a&gt; is a very useful option when works with large DEM.&lt;/p&gt;  &lt;p&gt;dem=Import[tif,{&amp;quot;GeoTIFF&amp;quot;,&amp;quot;Data&amp;quot;}];    &lt;br /&gt;Dimensions[dem]     &lt;br /&gt;{2825, 5075}&lt;/p&gt;  &lt;p&gt;Try ReliefPlot[dem], it takes a very long processing time in my not-up-to-date computer, on the other hand, with limited monitor resolutions, it doesn’t make sense to draw every point of this DEM.&lt;/p&gt;  &lt;p&gt;Let’s first try:&lt;/p&gt;  &lt;p&gt;ReliefPlot[dem, MaxPlotPoints –&amp;gt; 25]&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img title="dem01" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="230" alt="dem01" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SZX1SK1IyQI/AAAAAAAABzQ/axFj9DOyHHs/dem01%5B6%5D.png?imgmax=800" width="400" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Not quite good, the pixel is in rectangle shape rather than square, then with the small adjustment:&lt;/p&gt;  &lt;p&gt;ReliefPlot[dem, MaxPlotPoints -&amp;gt; {50, 25}]&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img title="dem02" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="230" alt="dem02" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SZX1SRPs62I/AAAAAAAABzU/Yaw7ei78CrM/dem02%5B6%5D.png?imgmax=800" width="400" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;ReliefPlot[dem, MaxPlotPoints -&amp;gt; {1000, 500},    &lt;br /&gt;ColorFunction -&amp;gt; &amp;quot;GreenBrownTerrain&amp;quot;]&lt;/p&gt;  &lt;p&gt;Click to see the large image, please ignore the left part, it is a quality issue from the DEM data source.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/SZXs3of3s5I/AAAAAAAAByo/Z01P0w2TfyU/s1600-h/dem05%5B6%5D.png"&gt;&lt;img title="dem05" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="250" alt="dem05" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SZXs4djye7I/AAAAAAAABys/qOQ2JF01hpQ/dem05_thumb%5B4%5D.png?imgmax=800" width="420" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The same rule goes with ListPlot3D, if you want to get a 3D version.&lt;/p&gt;  &lt;p&gt;ListPlot3D[dem, MaxPlotPoints -&amp;gt; {600, 300}, Mesh -&amp;gt; None,    &lt;br /&gt;Axes -&amp;gt; None, ColorFunction -&amp;gt; &amp;quot;GreenBrownTerrain&amp;quot;,     &lt;br /&gt;BoxRatios -&amp;gt; {2, 1, 0.2}, ImageSize -&amp;gt; 1200]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_0mA_T7sKsO4/SZXs5XUjAnI/AAAAAAAAByw/uT1V-YtP6J0/s1600-h/idem06%5B5%5D.png"&gt;&lt;img title="idem06" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="243" alt="idem06" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SZXs51A6diI/AAAAAAAABy0/mjIEWxQhinU/idem06_thumb%5B3%5D.png?imgmax=800" width="420" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-7972372419631680898?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/7972372419631680898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=7972372419631680898' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7972372419631680898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7972372419631680898'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/02/display-large-dem-with-maxplotpoints.html' title='Display large DEM with MaxPlotPoints'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/SZX1SK1IyQI/AAAAAAAABzQ/axFj9DOyHHs/s72-c/dem01%5B6%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1430725300295750602</id><published>2009-02-11T17:18:00.002-05:00</published><updated>2009-02-16T16:58:10.447-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Import water data from National Weather Service</title><content type='html'>&lt;p&gt;Besides real-time water data from USGS in the previous post, we like to import more data from &lt;a href="http://www.weather.gov/ahps/"&gt;National Weather Service&lt;/a&gt;, it has the forecast data on water stage.&lt;/p&gt;  &lt;p&gt;The data is distributed in XML format.&lt;/p&gt;  &lt;p&gt;NWSxml=Import[&lt;a href="http://www.crh.noaa.gov/ahps2/xml/nori3_hgirg.xml"&gt;http://www.crh.noaa.gov/ahps2/xml/nori3_hgirg.xml&lt;/a&gt;];&lt;/p&gt;  &lt;p&gt;(* function to extract data from xml *)&lt;/p&gt;  &lt;p&gt;extractdata[xml_,group_]:=Module[{dataxml,groupdata},dataxml=Cases[NWSxml,XMLElement[group,_,_],Infinity];  &lt;br /&gt;groupdata=Transpose[Cases[dataxml,XMLElement["datum",{},{___,XMLElement[#,_,{x_}],___}]:&amp;gt;x,Infinity]&amp;amp;/@{"valid","primary","secondary"}];   &lt;br /&gt;groupdata /. {x_,y_,z_}:&amp;gt; {StringReplace[StringDrop[x,-9],{"T"-&amp;gt;" "}],ToExpression[y],ToExpression[z]*1000}];&lt;/p&gt;  &lt;p&gt;(* extract data*)&lt;/p&gt;  &lt;p&gt;observeddata = extractdata[NWSxml, "observed"];   &lt;br /&gt;forecastdata = extractdata[NWSxml, "forecast"];&lt;/p&gt;  &lt;p&gt;(* produce the graph *)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_0mA_T7sKsO4/SZNOp6mJM4I/AAAAAAAABvs/3S-I6WZNnAw/s1600-h/importNWSxml%5B13%5D.png"&gt;&lt;img title="importNWSxml" style="border: 0px none ; display: inline;" alt="importNWSxml" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SZNOqTQtEuI/AAAAAAAABvw/A50VVy8bHxQ/importNWSxml_thumb%5B11%5D.png?imgmax=800" width="327" border="0" height="235" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Flood stage is at 11.0 feet, it seems the white river may be in the flood stage in next several days.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1430725300295750602?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1430725300295750602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1430725300295750602' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1430725300295750602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1430725300295750602'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/02/import-water-data-from-national-weather.html' title='Import water data from National Weather Service'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/SZNOqTQtEuI/AAAAAAAABvw/A50VVy8bHxQ/s72-c/importNWSxml_thumb%5B11%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5484753304764157551</id><published>2009-02-10T22:54:00.003-05:00</published><updated>2009-02-11T14:20:06.456-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Import USGS national real-time water data</title><content type='html'>&lt;p&gt;The built-in real-time weather data in Mathematica 7.0 is wonderful. You may be interested in importing more related data.&lt;/p&gt;  &lt;p&gt;USGS has web-interface for &lt;a href="http://waterdata.usgs.gov/nwis/rt"&gt;Daily Streamflow Conditions&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Here is the simple steps from importing Gauge height and Discharge data&lt;/p&gt;  &lt;p&gt;USGS 03353800 White Lick Creek at Mooresville, IN&lt;/p&gt;  &lt;p&gt;(*import html as plain text *)&lt;/p&gt;  &lt;p&gt;rawdata=Import[“&lt;a href="http://waterdata.usgs.gov/nwis/uv?cb_00060=on&amp;amp;cb_00065=on&amp;amp;format=html&amp;amp;period=7&amp;amp;site_no=03353800"&gt;http://waterd&lt;/a&gt;&lt;a href="http://waterdata.usgs.gov/nwis/uv?cb_00060=on&amp;amp;cb_00065=on&amp;amp;format=html&amp;amp;period=7&amp;amp;site_no=03353800"&gt;ata.usgs.gov/nwis/uv?cb_00060=on&amp;amp;cb_00065=on&amp;amp;format=html&amp;amp;period=7&amp;amp;site_no=03353800&lt;/a&gt;”];&lt;/p&gt;  &lt;p&gt;(* extract table information *)&lt;/p&gt;  &lt;p&gt;rawdata=StringReplace[rawdata,","-&amp;gt;""];&lt;br /&gt;result=StringCases[rawdata,x:DatePattern[{"Month","/","Day","/","Year"," ","Hour",":","Minute"}]~~Whitespace~~y:NumberString~~Whitespace~~z:NumberString:&amp;gt;{x,ToExpression[y],ToExpression[z]}];&lt;/p&gt;  &lt;p&gt;(*draw graph*)&lt;/p&gt;  &lt;p&gt;DateListPlot[result[[All,1;;2]],PlotStyle-&amp;gt;{Blue, PointSize[Medium]},PlotLabel-&amp;gt;"Site: 03353800",Joined-&amp;gt;True,Filling-&amp;gt;Bottom,FrameLabel-&amp;gt;{"Time","Gage Height (feet)"},DateFunction:&amp;gt;(DateList[{#,{"Month","/","Day","/","Year"," ","Hour",":","Minute"}}]&amp;amp;),DateTicksFormat-&amp;gt;{"MonthShort","/","Day"," ","Hour",":","Minute"}]&lt;/p&gt;  &lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/SZMkwXppRDI/AAAAAAAABvk/eZolTmgWL4A/s1600-h/discharge.png"&gt;&lt;img style="cursor: pointer; width: 360px; height: 262px;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/SZMkwXppRDI/AAAAAAAABvk/eZolTmgWL4A/s400/discharge.png" alt="" id="BLOGGER_PHOTO_ID_5301621599746212914" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;By the way, the code is tested in Mathematica 6.0.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5484753304764157551?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5484753304764157551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5484753304764157551' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5484753304764157551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5484753304764157551'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/02/import-usgs-national-real-time-water.html' title='Import USGS national real-time water data'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0mA_T7sKsO4/SZMkwXppRDI/AAAAAAAABvk/eZolTmgWL4A/s72-c/discharge.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-509849509402690904</id><published>2009-01-05T00:14:00.001-05:00</published><updated>2009-01-05T00:25:48.292-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='CountryData'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Create the map with a image background</title><content type='html'>&lt;p&gt;Here is something you can do with Mathematica 7.0 Image Processing&lt;/p&gt;  &lt;p&gt;Here is a good picture of&amp;#160; &lt;a href="http://www.flickr.com/photos/knzfan/551482252/"&gt;American Flag&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;img title="Flag" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="333" alt="Flag" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SWGXGRi3oFI/AAAAAAAABqM/arvsd71N2d8/Flag%5B5%5D.jpg?imgmax=800" width="500" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Then create a mask for it and add them together:&lt;/p&gt;  &lt;p&gt;mask= Graphics[{Black, CountryData[&amp;quot;UnitedStates&amp;quot;, {&amp;quot;Polygon&amp;quot;, &amp;quot;Mercator&amp;quot;}]}, ImageSize -&amp;gt; {500, 335}]&lt;/p&gt;  &lt;p&gt;flagImage = ImageAdd[img, mask]&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img title="AmericanFlagMap" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="333" alt="AmericanFlagMap" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SWGXICU4duI/AAAAAAAABqQ/LUDOEiyhjVA/AmericanFlagMap%5B12%5D.png?imgmax=800" width="500" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Then create another new image with the boundary:&lt;/p&gt;  &lt;p&gt;bgk = Graphics[{FaceForm[], EdgeForm[{Black}], CountryData[&amp;quot;UnitedStates&amp;quot;, {&amp;quot;Polygon&amp;quot;, &amp;quot;Mercator&amp;quot;}]}, ImageSize -&amp;gt; {500, 335}]&lt;/p&gt;  &lt;p&gt;ImageMultiply[bgk, flagImage]&lt;/p&gt;  &lt;p&gt;&lt;img title="AmericanFlagMap2" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="335" alt="AmericanFlagMap2" src="http://lh3.ggpht.com/_0mA_T7sKsO4/SWGXJh5X0kI/AAAAAAAABqU/T_Yr_hItcr8/AmericanFlagMap2%5B5%5D.png?imgmax=800" width="500" border="0" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-509849509402690904?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/509849509402690904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=509849509402690904' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/509849509402690904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/509849509402690904'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2009/01/create-map-with-image-background.html' title='Create the map with a image background'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/SWGXGRi3oFI/AAAAAAAABqM/arvsd71N2d8/s72-c/Flag%5B5%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-7420160317214941206</id><published>2008-12-31T22:07:00.001-05:00</published><updated>2009-01-01T02:56:33.719-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>How to grab photos from Flickr</title><content type='html'>&lt;p&gt;Happy new year 2009!&lt;/p&gt;  &lt;p&gt;I have a post about &lt;a href="http://mathgis.blogspot.com/2008/01/play-with-images-flickr.html"&gt;make a Flickr image wall with Mathematica&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;First, you need get some basic knowledge about &lt;a href="http://www.flickr.com/services/api/"&gt;Flickr API&lt;/a&gt;, &lt;a href="http://www.flickr.com/services/api/misc.urls.html"&gt;Photo Source Url&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The coding is very simple, just play with it, then you can modify it to try something new.&lt;/p&gt;  &lt;p&gt;catxml = Import[    &lt;br /&gt;&amp;#160;&amp;#160; &amp;quot;http://www.flickr.com/services/rest/?method=flickr.groups.pools.getphotos&amp;amp;api_key=your_API_key&amp;amp;group_id=75601600@N00&amp;amp;per_page=500&amp;amp;page=1&amp;amp;safe_search=1&amp;quot;, &amp;quot;XML&amp;quot;];&lt;/p&gt;  &lt;p&gt;This line will do the query from Flickr group &lt;a href="http://www.flickr.com/groups/notmycat/"&gt;Somebody else's cat&lt;/a&gt;, return 500 images’ meta data&lt;/p&gt;  &lt;p&gt;cats = Cases[catxml, XMLElement[&amp;quot;photo&amp;quot;, id_, {}] :&amp;gt; id, Infinity];    &lt;br /&gt;ids = #[[All, 2]] &amp;amp; /@ cats;     &lt;br /&gt;ids = RandomSample[ids, 100];&lt;/p&gt;  &lt;p&gt;This three lines will extract 100 random photo ids&lt;/p&gt;  &lt;p&gt;cs=&amp;quot;http://farm&amp;quot;&amp;lt;&amp;gt;#[[5]]&amp;lt;&amp;gt;&amp;quot;.static.flickr.com/&amp;quot;&amp;lt;&amp;gt;#[[4]]&amp;lt;&amp;gt;&amp;quot;/&amp;quot;&amp;lt;&amp;gt;#[[1]]&amp;lt;&amp;gt;&amp;quot;_&amp;quot;&amp;lt;&amp;gt;#[[3]]&amp;lt;&amp;gt;&amp;quot;_s.jpg&amp;quot; &amp;amp;/@ids;    &lt;br /&gt;imgs=Import[#] &amp;amp; /@ cs;&lt;/p&gt;  &lt;p&gt;Then get the real url to each photo and import them. Here we use small size (75 by 75) “_s.jpg”&lt;/p&gt;  &lt;p&gt;ImageAssemble[Partition[imgs, 10]]&lt;/p&gt;  &lt;p&gt;Then put them together into one image&lt;/p&gt;  &lt;p&gt;So we finish it just in several lines.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_0mA_T7sKsO4/SVwzTXMY8eI/AAAAAAAABqE/y2XOtllQlbU/s1600-h/catswall%5B9%5D.png"&gt;&lt;img title="catswall" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="274" alt="catswall" src="http://lh5.ggpht.com/_0mA_T7sKsO4/SVwzVD9InnI/AAAAAAAABqI/--LMsOAof9M/catswall_thumb%5B7%5D.png?imgmax=800" width="274" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-7420160317214941206?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/7420160317214941206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=7420160317214941206' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7420160317214941206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7420160317214941206'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/12/how-to-grab-photos-from-flickr.html' title='How to grab photos from Flickr'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_0mA_T7sKsO4/SVwzVD9InnI/AAAAAAAABqI/--LMsOAof9M/s72-c/catswall_thumb%5B7%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1109058039146070396</id><published>2008-12-11T13:51:00.004-05:00</published><updated>2008-12-11T19:45:34.633-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>How to make a Ternary Plot</title><content type='html'>For the reader who are curious about the post on &lt;a href="http://mathgis.blogspot.com/2008/01/old-time-fun-ternary-plot.html"&gt;Ternary Plot&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/SUFi9yZWm1I/AAAAAAAABk8/8aOGUMBig6Q/s1600-h/Triangleplot.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 280px;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/SUFi9yZWm1I/AAAAAAAABk8/8aOGUMBig6Q/s320/Triangleplot.png" alt="" id="BLOGGER_PHOTO_ID_5278609051894586194" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The code is very simple, here is the &lt;a href="http://www.box.net/shared/4j088ypg41"&gt;mathematica notebook&lt;/a&gt;, and the &lt;a href="http://www.box.net/shared/muvufnf6ad"&gt;pdf version&lt;/a&gt; if the notebook somehow doesn't work.&lt;br /&gt;&lt;br /&gt;Sorry for the late reply, I seldom check the comments for the older posts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1109058039146070396?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1109058039146070396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1109058039146070396' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1109058039146070396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1109058039146070396'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/12/how-to-make-tenary-plot.html' title='How to make a Ternary Plot'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/SUFi9yZWm1I/AAAAAAAABk8/8aOGUMBig6Q/s72-c/Triangleplot.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-4304349554713628770</id><published>2008-12-07T13:02:00.001-05:00</published><updated>2008-12-07T13:02:47.465-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='CountryData'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Tip: create 3D Map</title><content type='html'>&lt;p&gt;Here is a simple explanation on how to create 3D map in the previous post. &lt;/p&gt;  &lt;p&gt;The key is to use Extrude function (I copied it somewhere): &lt;/p&gt;  &lt;p&gt;extrude[pts_, h_] := Module[{vb, vt, len = Length[pts], nh},    &lt;br /&gt;&amp;#160; If[! NumericQ[h], nh = 0., nh = N@h];     &lt;br /&gt;&amp;#160; vb = Table[{pts[[i, 1]], pts[[i, 2]], 0}, {i, len}];     &lt;br /&gt;&amp;#160; vt = Table[{pts[[i, 1]], pts[[i, 2]], nh}, {i, len}];     &lt;br /&gt;&amp;#160; GraphicsComplex[     &lt;br /&gt;&amp;#160;&amp;#160; Join[vb, vt], {Polygon[Range[len]],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Polygon[Append[     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Table[{i, i + 1, len + i + 1, len + i}, {i, len - 1}], {len, 1,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; len + 1, 2 len}]], Polygon[Range[len + 1, 2 len]]}]]&lt;/p&gt;  &lt;p&gt;Let's create a map to show per-capita oil consumption in South America.&lt;/p&gt;  &lt;p&gt;(* get the data *)&lt;/p&gt;  &lt;p&gt;(* Falkland Islands is removed *)&lt;/p&gt;  &lt;p&gt;mapdata = {First@CountryData[#, &amp;quot;Polygon&amp;quot;],    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CountryData[#, &amp;quot;OilConsumption&amp;quot;]/     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CountryData[#, &amp;quot;Population&amp;quot;]} &amp;amp; /@     &lt;br /&gt;&amp;#160;&amp;#160; DeleteCases[CountryData[&amp;quot;SouthAmerica&amp;quot;], &amp;quot;FalklandIslands&amp;quot;];     &lt;br /&gt;mapdata[[All, 2]] = Rescale[mapdata[[All, 2]]];&lt;/p&gt;  &lt;p&gt; (* 3D map *)&lt;/p&gt;  &lt;p&gt;Graphics3D[{EdgeForm[Darker[ColorData[&amp;quot;Rainbow&amp;quot;][#[[2]]]]],    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; FaceForm[ColorData[&amp;quot;Rainbow&amp;quot;][#[[2]]]],     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; extrude[#[[1, 1]], #[[2]]]} &amp;amp; /@ mapdata, Boxed -&amp;gt; False,     &lt;br /&gt;Lighting -&amp;gt; &amp;quot;Neutral&amp;quot;, BoxRatios -&amp;gt; {1, 1, 0.2}, ImageSize -&amp;gt; 800]&lt;/p&gt;  &lt;p&gt;The visual quality of 3D map is low, however, it is good enough for the classroom.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/STwPxAsAg2I/AAAAAAAABk0/PSzpxrnFwpI/s1600-h/3d-map%5B6%5D.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="260" alt="3d-map" src="http://lh6.ggpht.com/_0mA_T7sKsO4/STwPxpiX_GI/AAAAAAAABk4/FreqSjwDGWA/3d-map_thumb%5B4%5D.png?imgmax=800" width="253" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-4304349554713628770?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/4304349554713628770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=4304349554713628770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4304349554713628770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4304349554713628770'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/12/tip-create-3d-map.html' title='Tip: create 3D Map'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/STwPxpiX_GI/AAAAAAAABk4/FreqSjwDGWA/s72-c/3d-map_thumb%5B4%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8583665001962321765</id><published>2008-12-03T19:57:00.001-05:00</published><updated>2008-12-03T19:57:16.304-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Mathematica 7: import ESRI Shape file</title><content type='html'>&lt;p&gt;Finally, ESRI Shape file is supported in Mathematica 7: &lt;a href="http://reference.wolfram.com/mathematica/ref/format/SHP.html"&gt;Import[&amp;quot;dir/file.shp&amp;quot;]&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;However, I feel it is necessary to explain it in a little more detail for users who are not that familiar with Mathematica.&lt;/p&gt;  &lt;p&gt;Let's import a&amp;#160; shape file from &lt;a href="http://129.79.145.7/arcims/statewide_mxd/dload_page/reference.html"&gt;Indiana GIS Atlas&lt;/a&gt; which contains county boundaries.&lt;/p&gt;  &lt;p&gt;(*import data*)    &lt;br /&gt;data=First@Import[&amp;quot;&lt;a href="http://129.79.145.7/arcims/statewide_mxd/downloads/LANDSURVEY_COUNTY_POLY_IN.zip" ?="?"&gt;http://129.79.145.7/arcims/statewide_mxd/downloads/LANDSURVEY_COUNTY_POLY_IN.zip&amp;quot;&lt;/a&gt;, Data&amp;quot;];     &lt;br /&gt;(*check what is inside the data*)     &lt;br /&gt;data[[All, 1]]     &lt;br /&gt;{&amp;quot;LayerName&amp;quot;, &amp;quot;Geometry&amp;quot;, &amp;quot;Labels&amp;quot;, &amp;quot;LabeledData&amp;quot;}     &lt;br /&gt;(* check the field name in attribute table *)     &lt;br /&gt;&amp;quot;Labels&amp;quot; /. data     &lt;br /&gt;{&amp;quot;AREA&amp;quot;, &amp;quot;PERIMETER&amp;quot;, &amp;quot;NAME_U&amp;quot;, &amp;quot;NAME_L&amp;quot;, &amp;quot;NCAPC&amp;quot;}     &lt;br /&gt;(* attribute data is stored in &amp;quot;LabeldData&amp;quot; *)     &lt;br /&gt;area = &amp;quot;AREA&amp;quot; /. (&amp;quot;LabeledData&amp;quot; /. data);     &lt;br /&gt;area = Rescale[area];     &lt;br /&gt;(* get all the geometry *)     &lt;br /&gt;geometry = &amp;quot;Geometry&amp;quot; /. data;     &lt;br /&gt;(* put two data together *)     &lt;br /&gt;mapdata = Transpose[{geometry, area}];     &lt;br /&gt;(* generate the thematic map *)     &lt;br /&gt;Graphics[{EdgeForm[{Thick, Gray}], FaceForm[ColorData[&amp;quot;Rainbow&amp;quot;][#[[2]]]], #[[1]]} &amp;amp; /@ mapdata, Frame -&amp;gt; False, ImageSize -&amp;gt; 400]&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_0mA_T7sKsO4/STcq3yuKUqI/AAAAAAAABkk/BGt0hi2Zdwk/s1600-h/importshapefile%5B5%5D.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="260" alt="importshapefile" src="http://lh4.ggpht.com/_0mA_T7sKsO4/STcq4kfmqwI/AAAAAAAABko/eyIEkyK_x_4/importshapefile_thumb%5B3%5D.png?imgmax=800" width="178" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;With some extra efforts, a 3D version is generated.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_0mA_T7sKsO4/STcq6Juz0hI/AAAAAAAABks/9ffkXZQczLc/s1600-h/importshapefile3D%5B3%5D.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="214" alt="importshapefile3D" src="http://lh3.ggpht.com/_0mA_T7sKsO4/STcq6wTI0TI/AAAAAAAABkw/W3TQey2Vf20/importshapefile3D_thumb%5B1%5D.png?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8583665001962321765?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8583665001962321765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8583665001962321765' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8583665001962321765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8583665001962321765'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/12/mathematica-7-import-esri-shape-file.html' title='Mathematica 7: import ESRI Shape file'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_0mA_T7sKsO4/STcq4kfmqwI/AAAAAAAABko/eyIEkyK_x_4/s72-c/importshapefile_thumb%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-4158940378450439216</id><published>2008-11-24T23:34:00.001-05:00</published><updated>2008-11-24T23:34:13.035-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Extract font outlines</title><content type='html'>&lt;p&gt;I find this tip from the talk: &lt;a href="http://www.ims08.org/"&gt;Doing Physics with Mathematica 6 by Michael Trott&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;GCText[text_,tsize_]:= ImportString[ExportString[Cell[TextData[StyleBox[    &lt;br /&gt;text, FontWeight-&amp;gt;&amp;quot;Bold&amp;quot;,FontFamily-&amp;gt;&amp;quot;Helvetica&amp;quot;]], &amp;quot;Text&amp;quot;, tsize], &amp;quot;PDF&amp;quot;]][[1]]&lt;/p&gt;  &lt;p&gt;outlines =&amp;#160; (First /@ Cases[GCText[&amp;quot;ABC&amp;quot;, 20], _Polygon, Infinity]);&lt;/p&gt;  &lt;p&gt;Graphics3D[{FaceForm[],EdgeForm[Black],Polygon[Map[Append[#, 10]&amp;amp;, outlines, {-2}]]}];&lt;/p&gt;  &lt;p&gt;for fun:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="293" alt="image" src="http://lh6.ggpht.com/_0mA_T7sKsO4/SSuAQw7zNSI/AAAAAAAABjY/xuh09VCnhhw/image%5B12%5D.png?imgmax=800" width="509" border="0" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-4158940378450439216?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/4158940378450439216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=4158940378450439216' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4158940378450439216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4158940378450439216'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/11/extract-font-outlines.html' title='Extract font outlines'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_0mA_T7sKsO4/SSuAQw7zNSI/AAAAAAAABjY/xuh09VCnhhw/s72-c/image%5B12%5D.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5556552476130482259</id><published>2008-10-05T22:54:00.001-04:00</published><updated>2008-10-05T22:55:56.910-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>QHull for Mathematica</title><content type='html'>&lt;p&gt;&lt;a href="http://www.xcellerator.info/mPower/index.html"&gt;mPower.m&lt;/a&gt; is a &lt;i&gt;Mathematica&lt;/i&gt; package that interfaces with &lt;a href="http://www.qhull.org/"&gt;qhull&lt;/a&gt; binaries.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.xlr8r.info/mPower/install.html"&gt;Installation guide&lt;/a&gt; is not for windows platform.&lt;/p&gt;  &lt;p&gt;Here is the quick way to get it running on Windows Vista with Mathematica 6.0.&lt;/p&gt;  &lt;p&gt;1. download mPower.m, and put it into the &lt;code&gt;Applications&lt;/code&gt; subdirectory of &lt;code&gt;$UserBaseDirectory&lt;/code&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;In[1]:= $UserBaseDirectory&lt;/p&gt;  &lt;p&gt;Out[1]= C:\Users\...\AppData\Roaming\Mathematica&lt;/p&gt;  &lt;p&gt;2. download qhull for windows, put it into the folder C:\qhull&lt;/p&gt;  &lt;p&gt;3. open mPower.m, modify the following two lines,&lt;/p&gt;  &lt;p&gt;$QHULL=ToFileName[{$UserBaseDirectory, &amp;quot;Applications&amp;quot;, &amp;quot;qhull&amp;quot;, &amp;quot;src&amp;quot;}]&lt;/p&gt;  &lt;p&gt;to: $QHULL=&amp;quot;C:\\qhull\\&amp;quot;&lt;/p&gt;  &lt;p&gt;qhullFiles={&amp;quot;qconvex&amp;quot;,&amp;#160; &amp;quot;qdelaunay&amp;quot;, &amp;quot;qhalf&amp;quot;,&amp;quot;qhull&amp;quot;, &amp;quot;qvoronoi&amp;quot;};&lt;/p&gt;  &lt;p&gt;to: qhullFiles={&amp;quot;qconvex.exe&amp;quot;,&amp;#160; &amp;quot;qdelaunay.exe&amp;quot;, &amp;quot;qhalf.exe&amp;quot;,&amp;quot;qhull.exe&amp;quot;, \    &lt;br /&gt;&amp;quot;qvoronoi.exe&amp;quot;};&lt;/p&gt;  &lt;p&gt;4. then testing, ignore the warning on regtet and pwrvtx, we only need qhull&lt;/p&gt;  &lt;p&gt;&amp;lt;&amp;lt; &amp;quot;mPower.m&amp;quot;&lt;/p&gt;  &lt;p&gt;points = RandomReal[1, {10, 3}];&lt;/p&gt;  &lt;p&gt;ch = convexHull[points, convexHullFormat -&amp;gt; {facetNormals -&amp;gt; True, facets -&amp;gt; True}]&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks to the mPower developers&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5556552476130482259?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5556552476130482259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5556552476130482259' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5556552476130482259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5556552476130482259'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/10/qhull-for-mathematica.html' title='QHull for Mathematica'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8127698091115740849</id><published>2008-08-07T13:37:00.002-04:00</published><updated>2008-08-07T13:39:23.647-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='FinancialData'/><title type='text'>Financial Data: AAPL vs MSFT</title><content type='html'>&lt;p&gt;Technologically speaking, Apple and Microsoft are two quite different companies in many ways. We all know that in recently several years, Apple stock is very hot. Here is the stock price: APPL vs MSFT since 2004, the legend is not necessary for this graph.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;DateListPlot[{FinancialData["AAPL",{2004}], FinancialData["MSFT",{2004}]}, Joined-&amp;gt;True, Filling-&amp;gt;Bottom]&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/mathphobia/SJsywnZsiKI/AAAAAAAABR0/VXLamIJreWw/s1600-h/aaplvsmsft%5B8%5D.png"&gt;&lt;img style="border: 0px none ;" alt="aaplvsmsft" src="http://lh3.ggpht.com/mathphobia/SJsyw62g_hI/AAAAAAAABR4/LP8P6I7kMk8/aaplvsmsft_thumb%5B6%5D.png?imgmax=800" width="260" border="0" height="178" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://google.com/insights/search/#"&gt;Google Insights for Search&lt;/a&gt; gives another way to present it.&lt;/p&gt;  &lt;p&gt;Google search volume index for "AAPL" since 2004&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/mathphobia/SJsyxH6o4QI/AAAAAAAABR8/auY08580Pe4/s1600-h/aapl%5B3%5D.jpg"&gt;&lt;img style="border: 0px none ;" alt="aapl" src="http://lh5.ggpht.com/mathphobia/SJsyxtWnksI/AAAAAAAABSA/APYI3lYPXX4/aapl_thumb%5B1%5D.jpg?imgmax=800" width="260" border="0" height="170" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Google search volume index for "MSFT" since 2004&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/mathphobia/SJsyx0FVvYI/AAAAAAAABSE/FpKKmc4ike0/s1600-h/msft%5B3%5D.jpg"&gt;&lt;img style="border: 0px none ;" alt="msft" src="http://lh4.ggpht.com/mathphobia/SJsyyR4_QPI/AAAAAAAABSI/aPWY3WPKZ_g/msft_thumb%5B1%5D.jpg?imgmax=800" width="260" border="0" height="170" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8127698091115740849?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8127698091115740849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8127698091115740849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8127698091115740849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8127698091115740849'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/08/financial-data-aapl-vs-msft.html' title='Financial Data: AAPL vs MSFT'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/mathphobia/SJsyw62g_hI/AAAAAAAABR4/LP8P6I7kMk8/s72-c/aaplvsmsft_thumb%5B6%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2002594669797011956</id><published>2008-08-06T14:49:00.001-04:00</published><updated>2008-08-06T14:49:24.765-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>How to extract points from a plot</title><content type='html'>&lt;p&gt;&lt;em&gt;pts=Cases[theplot, x_GraphicsType:&amp;gt;First@x, Infinity];&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Example 1:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;g=Plot[Sin[x],{x,0,2Pi}];     &lt;br /&gt;pts=Cases[g,x_Line:&amp;gt;First@x,Infinity];      &lt;br /&gt;ListPlot[pts]&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/mathphobia/SJnyL2Q3i9I/AAAAAAAABRU/u4dezlUtuRQ/s1600-h/image%5B7%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="163" alt="image" src="http://lh4.ggpht.com/mathphobia/SJnyMAPi0NI/AAAAAAAABRY/uWu1YMZLFOU/image_thumb%5B3%5D.png?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;em&gt;&lt;/em&gt;  &lt;p&gt;Example 2:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;g=Plot3D[Cos[x]+Cos[y],{x,0,4Pi},{y,0,4Pi}];     &lt;br /&gt;pts=Cases[g,x_GraphicsComplex:&amp;gt;First@x,Infinity];      &lt;br /&gt;ListPointPlot3D[pts]&lt;/em&gt;&lt;/p&gt; &lt;a href="http://lh6.ggpht.com/mathphobia/SJnyMtNOsdI/AAAAAAAABRc/n2SN8dlzuAg/s1600-h/image%5B11%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="214" alt="image" src="http://lh6.ggpht.com/mathphobia/SJnyNJLsWYI/AAAAAAAABRg/FVwSMidUMLE/image_thumb%5B5%5D.png?imgmax=800" width="260" border="0" /&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2002594669797011956?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2002594669797011956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2002594669797011956' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2002594669797011956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2002594669797011956'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/08/how-to-extract-points-from-plot.html' title='How to extract points from a plot'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/mathphobia/SJnyMAPi0NI/AAAAAAAABRY/uWu1YMZLFOU/s72-c/image_thumb%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-4866857248959306919</id><published>2008-07-16T09:56:00.001-04:00</published><updated>2008-07-16T09:56:32.410-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Wolfram Screencast Gallery</title><content type='html'>&lt;p&gt;There are some very impressive&amp;#160; presentations in &lt;a href="http://www.wolfram.com/broadcast/screencasts/"&gt;Screencast Gallery&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;I watched &lt;a href="http://www.wolfram.com/broadcast/screencasts/theo/spinthariscope/"&gt;Spinthariscope&lt;/a&gt; by Theodore Gray. This simple shape editor is particularly interesting.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/mathphobia/SH3-AtlT-II/AAAAAAAABQE/_exMtqghth4/s1600-h/image%5B7%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="99" alt="image" src="http://lh6.ggpht.com/mathphobia/SH3-C4-90tI/AAAAAAAABQI/X0YqB4dxcuE/image_thumb%5B3%5D.png?imgmax=800" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/mathphobia/SH3-Df5HWRI/AAAAAAAABQM/Q1fLknWBN7A/s1600-h/image%5B4%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="240" alt="image" src="http://lh5.ggpht.com/mathphobia/SH3-D-xsMPI/AAAAAAAABQQ/QyYsbgDOc2I/image_thumb%5B2%5D.png?imgmax=800" width="235" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-4866857248959306919?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/4866857248959306919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=4866857248959306919' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4866857248959306919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4866857248959306919'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/07/wolfram-screencast-gallery.html' title='Wolfram Screencast Gallery'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/mathphobia/SH3-C4-90tI/AAAAAAAABQI/X0YqB4dxcuE/s72-c/image_thumb%5B3%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6440016537033178801</id><published>2008-07-11T09:41:00.003-04:00</published><updated>2008-07-11T13:25:14.792-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Fun with Gamepad</title><content type='html'>&lt;p&gt;We have a cheap Logitech gamepad (less than 10$ from Target).&lt;/p&gt;  &lt;p&gt;&lt;em&gt;ControllerInformation[]&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Controller Device 3: Logitech(R) Precision(TM) Gamepad   &lt;br /&gt;Raw Product Name    "Logitech(R) Precision(TM) Gamepad"    &lt;br /&gt;Raw Product ID    49690    &lt;br /&gt;Device Type    Windows DirectInput Device    &lt;br /&gt;Raw Controller Type    Joystick    &lt;br /&gt;Mathematica Controls       22 controls    &lt;br /&gt;Raw Controls       12 controls &lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Using gamepad to rotate 3D graphics is very smooth, and can jump to top view from x, y, z directions when you hold down different buttons. It seems not supported to zoom a 3D graphic with gamepad.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://reference.wolfram.com/mathematica/guide/GamepadAndDeviceInterface.html"&gt;Gamepad &amp;amp; Device Interface&lt;/a&gt; for the details.&lt;/p&gt;  &lt;p&gt;Google Earth is another application to play nicely with gamepad.&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Update&lt;/span&gt;: See &lt;a href="http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/f4852ad574255f28/327d534fb27a0156?lnk=gst&amp;amp;q=chris+hill+zoom+3d+graphic#327d534fb27a0156" rel="nofollow"&gt;here&lt;/a&gt; for enabling zoom function with gamepad. Thanks.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6440016537033178801?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6440016537033178801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6440016537033178801' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6440016537033178801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6440016537033178801'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/07/fun-with-gamepad.html' title='Fun with Gamepad'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-841957880899259826</id><published>2008-07-09T11:22:00.001-04:00</published><updated>2008-07-09T11:22:06.975-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Standard Extra Packages</title><content type='html'>&lt;p&gt;See here &lt;a href="http://reference.wolfram.com/mathematica/guide/StandardExtraPackages.html"&gt;Mathematica 6.0 Standard Extra Packages&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It gives out a very helpful overview on packages not loaded by default.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-841957880899259826?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/841957880899259826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=841957880899259826' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/841957880899259826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/841957880899259826'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/07/standard-extra-packages.html' title='Standard Extra Packages'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-9106441602461041448</id><published>2008-06-15T17:10:00.003-04:00</published><updated>2008-06-15T17:16:43.173-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>T-Thirt design: Pi  with rainbow color scheme</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/SFWFg-KbZSI/AAAAAAAABD4/UptRGhwdjHY/s1600-h/PiTThirt.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/SFWFg-KbZSI/AAAAAAAABD4/UptRGhwdjHY/s400/PiTThirt.png" alt="" id="BLOGGER_PHOTO_ID_5212218945240261922" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Functions used: Rasterize, Grid&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-9106441602461041448?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/9106441602461041448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=9106441602461041448' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/9106441602461041448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/9106441602461041448'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/06/t-thirt-design.html' title='T-Thirt design: Pi  with rainbow color scheme'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/SFWFg-KbZSI/AAAAAAAABD4/UptRGhwdjHY/s72-c/PiTThirt.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1228456780263143773</id><published>2008-05-08T10:57:00.004-04:00</published><updated>2008-05-08T11:00:09.445-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nonsense'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Something hidden</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/SCMVBJOurOI/AAAAAAAABCg/X-XTN1oIAeo/s1600-h/happy.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/SCMVBJOurOI/AAAAAAAABCg/X-XTN1oIAeo/s400/happy.png" alt="" id="BLOGGER_PHOTO_ID_5198021504317435106" border="0" /&gt;&lt;/a&gt;No idea? Look at the one:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/SCMVNJOurPI/AAAAAAAABCo/Ypt7rG9tToY/s1600-h/unhappy.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/SCMVNJOurPI/AAAAAAAABCo/Ypt7rG9tToY/s400/unhappy.png" alt="" id="BLOGGER_PHOTO_ID_5198021710475865330" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1228456780263143773?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1228456780263143773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1228456780263143773' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1228456780263143773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1228456780263143773'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/05/something-hidden.html' title='Something hidden'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0mA_T7sKsO4/SCMVBJOurOI/AAAAAAAABCg/X-XTN1oIAeo/s72-c/happy.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6038838793923690521</id><published>2008-05-04T18:13:00.001-04:00</published><updated>2008-05-04T18:14:58.064-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Rasterize</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/SB41Ua8ZF4I/AAAAAAAABCA/6B6kCG488uU/s1600-h/RasterizeG.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/SB41Ua8ZF4I/AAAAAAAABCA/6B6kCG488uU/s400/RasterizeG.png" alt="" id="BLOGGER_PHOTO_ID_5196649644978411394" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6038838793923690521?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6038838793923690521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6038838793923690521' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6038838793923690521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6038838793923690521'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/05/rasterize.html' title='Rasterize'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0mA_T7sKsO4/SB41Ua8ZF4I/AAAAAAAABCA/6B6kCG488uU/s72-c/RasterizeG.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-4516136487794439555</id><published>2008-05-03T22:42:00.007-04:00</published><updated>2008-05-06T13:34:30.344-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Self random walk on sphere</title><content type='html'>Self random on sphere lattice (longitude, latitude).&lt;br /&gt;(red -- starting point, green -- ending point)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/SB0jJa8ZF0I/AAAAAAAABBg/iXSRDd1aAhA/s1600-h/randomwalk2d.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/SB0jJa8ZF0I/AAAAAAAABBg/iXSRDd1aAhA/s400/randomwalk2d.png" alt="" id="BLOGGER_PHOTO_ID_5196348189813839682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Draw on a sphere:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/SB0jWK8ZF1I/AAAAAAAABBo/FWNLqekgXRk/s1600-h/randomwalkonsphere.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/SB0jWK8ZF1I/AAAAAAAABBo/FWNLqekgXRk/s400/randomwalkonsphere.png" alt="" id="BLOGGER_PHOTO_ID_5196348408857171794" border="0" /&gt;&lt;/a&gt;Self avoid version:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/SB0jhq8ZF2I/AAAAAAAABBw/gVipSNvh5eQ/s1600-h/selfrandomwalk2d.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/SB0jhq8ZF2I/AAAAAAAABBw/gVipSNvh5eQ/s400/selfrandomwalk2d.png" alt="" id="BLOGGER_PHOTO_ID_5196348606425667426" border="0" /&gt;&lt;/a&gt;The longest horizontal lines indicate the jumps between -180 and 180.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/SB0kBq8ZF3I/AAAAAAAABB4/xXwMjfVwd98/s1600-h/selfrandomwalk.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/SB0kBq8ZF3I/AAAAAAAABB4/xXwMjfVwd98/s400/selfrandomwalk.png" alt="" id="BLOGGER_PHOTO_ID_5196349156181481330" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-4516136487794439555?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/4516136487794439555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=4516136487794439555' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4516136487794439555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4516136487794439555'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/05/self-random-walk-on-sphere.html' title='Self random walk on sphere'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/SB0jJa8ZF0I/AAAAAAAABBg/iXSRDd1aAhA/s72-c/randomwalk2d.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2617938996316253207</id><published>2008-04-27T15:35:00.002-04:00</published><updated>2008-04-27T15:36:37.266-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Opacity</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/SBTVp68ZFzI/AAAAAAAABBA/OiYGbRJ0wcg/s1600-h/opacity.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/SBTVp68ZFzI/AAAAAAAABBA/OiYGbRJ0wcg/s400/opacity.png" alt="" id="BLOGGER_PHOTO_ID_5194011186438936370" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2617938996316253207?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2617938996316253207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2617938996316253207' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2617938996316253207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2617938996316253207'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/opacity.html' title='Opacity'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0mA_T7sKsO4/SBTVp68ZFzI/AAAAAAAABBA/OiYGbRJ0wcg/s72-c/opacity.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3416397561752777433</id><published>2008-04-21T11:49:00.005-04:00</published><updated>2008-04-21T14:43:56.844-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='CountryData'/><title type='text'>Nationality Name</title><content type='html'>For most counties, the nationality name usually in form of country name + suffix: -an, -ian, and -ese.&lt;br /&gt;China-&gt;Chinese, Japan-&gt;Japanese, are all the east Asian the "ese" people? Let's find out with Mathematica: &lt;span style="font-style: italic;"&gt;CountryData["Country", "NationalityName"]&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/SAy6YYBfYFI/AAAAAAAABA4/crJfKk8UU-8/s1600-h/countryname.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/SAy6YYBfYFI/AAAAAAAABA4/crJfKk8UU-8/s400/countryname.png" alt="" id="BLOGGER_PHOTO_ID_5191729398379667538" border="0" /&gt;&lt;/a&gt;From the above map, you can see it is not true at all, e.g. Korea-&gt;Korean, Thailand-&gt;Thai. Portugal-&gt;Portuguese is only "ese" country in Europe.&lt;br /&gt;&lt;br /&gt;One thing I hear quite often is that -ese means smaller and less power as opposite to -an and -ian, -ese is used by western colonist in an insulted way. I don't know how much historic truth in this claim.  Google search gives out the following:&lt;br /&gt;-ian  -an from Latin –ianus, meaning "native of", "relating to", or "belonging to"&lt;br /&gt;-ese from the Latin -ensis,  meaning "originating in"&lt;br /&gt;However, it is hard to know why some countries are with  "-ese", others are not.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3416397561752777433?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3416397561752777433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3416397561752777433' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3416397561752777433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3416397561752777433'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/nationality-name.html' title='Nationality Name'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0mA_T7sKsO4/SAy6YYBfYFI/AAAAAAAABA4/crJfKk8UU-8/s72-c/countryname.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3703073633846982240</id><published>2008-04-20T15:06:00.004-04:00</published><updated>2008-04-20T15:09:40.084-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nonsense'/><title type='text'>Nonsense: Something here doesn't belong</title><content type='html'>&lt;br&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/SAuUkIBfYEI/AAAAAAAABAw/kscTGpAGzAo/s1600-h/oregon.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/SAuUkIBfYEI/AAAAAAAABAw/kscTGpAGzAo/s400/oregon.png" alt="" id="BLOGGER_PHOTO_ID_5191406343824564290" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3703073633846982240?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3703073633846982240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3703073633846982240' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3703073633846982240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3703073633846982240'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/nonsense-something-here-doesnt-belong.html' title='Nonsense: Something here doesn&apos;t belong'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/SAuUkIBfYEI/AAAAAAAABAw/kscTGpAGzAo/s72-c/oregon.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-180493887126435242</id><published>2008-04-10T22:02:00.003-04:00</published><updated>2008-04-10T22:06:43.185-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nonsense'/><title type='text'>Nonsense</title><content type='html'>Rejected logo design in the summer, 1999.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R_7G6EgLPGI/AAAAAAAABAQ/jAnmQWLSqJs/s1600-h/googlelogo.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R_7G6EgLPGI/AAAAAAAABAQ/jAnmQWLSqJs/s400/googlelogo.png" alt="" id="BLOGGER_PHOTO_ID_5187802521720798306" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-180493887126435242?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/180493887126435242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=180493887126435242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/180493887126435242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/180493887126435242'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/nonsense_10.html' title='Nonsense'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0mA_T7sKsO4/R_7G6EgLPGI/AAAAAAAABAQ/jAnmQWLSqJs/s72-c/googlelogo.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-7154320284854163306</id><published>2008-04-10T21:22:00.003-04:00</published><updated>2008-04-10T21:25:14.246-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Colorful Words</title><content type='html'>Rasterize, then coloring&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R_69ukgLPEI/AAAAAAAABAA/zt5GPTdXuU4/s1600-h/color.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R_69ukgLPEI/AAAAAAAABAA/zt5GPTdXuU4/s400/color.png" alt="" id="BLOGGER_PHOTO_ID_5187792428547652674" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R_691kgLPFI/AAAAAAAABAI/sNVn5ROqW1U/s1600-h/heart.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R_691kgLPFI/AAAAAAAABAI/sNVn5ROqW1U/s400/heart.png" alt="" id="BLOGGER_PHOTO_ID_5187792548806736978" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-7154320284854163306?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/7154320284854163306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=7154320284854163306' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7154320284854163306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7154320284854163306'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/colorful-words.html' title='Colorful Words'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R_69ukgLPEI/AAAAAAAABAA/zt5GPTdXuU4/s72-c/color.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-55787333502965250</id><published>2008-04-07T23:16:00.006-04:00</published><updated>2008-05-06T13:33:24.589-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Algorithm'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Minimum Bounding Rectangle of a Point Set</title><content type='html'>Give a 2-D point set, we need to find the minimum bounding rectangle in term of area.&lt;br /&gt;&lt;br /&gt;I read it somewhere that the minimum rectangle must always contain at least one edge of the convex hull, however, I can't find a citation now. So the algorithm can be constructed in the following way: first construct the convex hull, then rotate each edges for the convex hull to the position  parallel to x-axes, then calculate area of bounding rectangle; find the minimum one of these rotated rectangles and rotate it back to normal.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R_rnConr6oI/AAAAAAAAA_4/_9E_OOiJFp4/s1600-h/minbox.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R_rnConr6oI/AAAAAAAAA_4/_9E_OOiJFp4/s400/minbox.png" alt="" id="BLOGGER_PHOTO_ID_5186711953320176258" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-55787333502965250?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/55787333502965250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=55787333502965250' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/55787333502965250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/55787333502965250'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/minimum-bounding-rectangle-of-point-set.html' title='Minimum Bounding Rectangle of a Point Set'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R_rnConr6oI/AAAAAAAAA_4/_9E_OOiJFp4/s72-c/minbox.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-338311059539104019</id><published>2008-04-04T13:42:00.003-04:00</published><updated>2008-04-04T13:52:45.091-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nonsense'/><title type='text'>Nonsense</title><content type='html'>The early sign of scientist self-destruction nature.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R_ZoxYnr6nI/AAAAAAAAA_w/ZVI-cSBYOUU/s1600-h/mushroom.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R_ZoxYnr6nI/AAAAAAAAA_w/ZVI-cSBYOUU/s400/mushroom.png" alt="" id="BLOGGER_PHOTO_ID_5185447218595490418" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;mushroom is from http://www.wpclipart.com/plants/mushroom/mushroom.png&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-338311059539104019?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/338311059539104019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=338311059539104019' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/338311059539104019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/338311059539104019'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/nonsense.html' title='Nonsense'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R_ZoxYnr6nI/AAAAAAAAA_w/ZVI-cSBYOUU/s72-c/mushroom.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-481222028320062103</id><published>2008-04-04T10:25:00.003-04:00</published><updated>2008-04-04T10:54:34.025-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><title type='text'>Google Chart API</title><content type='html'>The &lt;a href="http://code.google.com/apis/chart/"&gt;Google Chart API&lt;/a&gt; lets you dynamically generate charts.&lt;span style="font-family:monospace;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The basic format:&lt;span style="font-family:monospace;"&gt;&lt;br /&gt;&lt;/span&gt;http://chart.apis.google.com/chart?&amp;lt;parameters&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;img style="width: 300px; height: 200px;" src="http://chart.apis.google.com/chart?cht=lc&amp;amp;chco=ff0000,00ff00,0000ff&amp;amp;chs=300x200&amp;amp;chd=s:FOETHECat,lkjtf3asv,KATYPSNXJ&amp;amp;chxt=x,y&amp;amp;chxl=0:%7COct%7CNov%7CDec%7C1:%7C%7C20K%7C%7C60K%7C%7C100K" alt="Sample chart" /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;It is the most straightforward solution for web application to display dynamic graphs. I am wondering if Wolfram can come up something similar, not the webMathematica, just a simple free image generator will be great, it is definitely a good way to get more publicity.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-481222028320062103?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/481222028320062103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=481222028320062103' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/481222028320062103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/481222028320062103'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/google-chart-api.html' title='Google Chart API'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-317703512436059894</id><published>2008-04-03T10:22:00.004-04:00</published><updated>2008-04-03T10:33:35.855-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='GraphPlot'/><title type='text'>Tips: Customizing Graphplot</title><content type='html'>For a graph &lt;span style="font-weight: bold;"&gt;g&lt;/span&gt;, we like draw leaves in different style from nodes.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R_TqIonr6lI/AAAAAAAAA_g/Y_pjUavzZ7c/s1600-h/tree.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R_TqIonr6lI/AAAAAAAAA_g/Y_pjUavzZ7c/s400/tree.png" alt="" id="BLOGGER_PHOTO_ID_5185026505074010706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* find leaves *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;leaves = Complement[g[[All, 2]], g[[All, 1]]];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;TreePlot[g, VertexLabeling -&gt; False, PlotStyle -&gt; {Black}, &lt;/span&gt; &lt;span style="font-style: italic;"&gt; VertexRenderingFunction -&gt; (If[MemberQ[leaves, #2], &lt;/span&gt; &lt;span style="font-style: italic;"&gt;            {FaceForm[LightGray], EdgeForm[Black], Disk[#1, 0.15], Text[#2, #1]}, {FaceForm[White], EdgeForm[Black], Disk[#1, 0.15]}] &amp;amp;), AspectRatio -&gt; 0.3]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The tip is in VertexRenderingFunction, Text[#2, #1], #2 means the label, #1 is coordinates.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R_TqXYnr6mI/AAAAAAAAA_o/iijY91e5rIQ/s1600-h/newtree.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R_TqXYnr6mI/AAAAAAAAA_o/iijY91e5rIQ/s400/newtree.png" alt="" id="BLOGGER_PHOTO_ID_5185026758477081186" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-317703512436059894?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/317703512436059894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=317703512436059894' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/317703512436059894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/317703512436059894'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/04/tips-customizing-graphplot.html' title='Tips: Customizing Graphplot'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0mA_T7sKsO4/R_TqIonr6lI/AAAAAAAAA_g/Y_pjUavzZ7c/s72-c/tree.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6273707932476381097</id><published>2008-03-22T16:01:00.003-04:00</published><updated>2008-03-22T16:10:18.054-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><title type='text'>Learning regular expression</title><content type='html'>I am learning &lt;a href="http://reference.wolfram.com/mathematica/tutorial/RegularExpressions.html"&gt;Regular Expression&lt;/a&gt; right now. Here is the example to pull the information on monthly posting activities of &lt;a href="http://groups.google.com/group/comp.soft-sys.math.mathematica/about"&gt;Mathematica Discussion Group&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-family: georgia;"&gt;url = "http://groups.google.com/group/comp.soft-sys.math.mathematica/about";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-family: georgia;"&gt;reg = "(?&lt;=month/)\\d+-\\d+\"&gt;\\d+";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-family: georgia;"&gt;data = Import[url, "Source"];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-family: georgia;"&gt;ex = StringCases[data, RegularExpression[reg]];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-family: georgia;"&gt;ds = ToExpression[StringSplit[ex, {";", "-", "\"&gt;"}]];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we can use DataListPlot to produce a nice graph.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R-VnAonr6kI/AAAAAAAAA_Y/6AZCpvd6GBY/s1600-h/reg.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R-VnAonr6kI/AAAAAAAAA_Y/6AZCpvd6GBY/s400/reg.png" alt="" id="BLOGGER_PHOTO_ID_5180660206961158722" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6273707932476381097?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6273707932476381097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6273707932476381097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6273707932476381097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6273707932476381097'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/03/learning-regular-expression.html' title='Learning regular expression'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R-VnAonr6kI/AAAAAAAAA_Y/6AZCpvd6GBY/s72-c/reg.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-4328293755962436578</id><published>2008-03-12T12:26:00.006-04:00</published><updated>2008-03-12T12:48:47.952-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FinancialData'/><title type='text'>Understanding Finanical Market: Arbitrage</title><content type='html'>From Wikipedia, &lt;a href="http://en.wikipedia.org/wiki/Arbitrage"&gt;Arbitrage&lt;/a&gt; is the practice of taking advantage of a price differential between two or more markets, the profit being the difference between the markets prices.&lt;br /&gt;&lt;br /&gt;Fro example, China Petro &amp;amp; Chem is traded in both US and HK stock markets. The price between these two markets are different, it seems US price follows the movements of HK's in recent several months.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R9gJW_p40eI/AAAAAAAAA-4/ESAwS6y2BDo/s1600-h/hk.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R9gJW_p40eI/AAAAAAAAA-4/ESAwS6y2BDo/s400/hk.png" alt="" id="BLOGGER_PHOTO_ID_5176898062311281122" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;After converting HK share price to US dollars, the price differences can be shown:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;DateListPlot[{ussnp, hksnp}, Joined -&gt; True, Filling -&gt; {1 -&gt; {2}}, FillingStyle -&gt; {Green, Red}, DateTicksFormat -&gt; {"Month", "/", "YearShort"}]&lt;/span&gt;&lt;br /&gt;The trick is to use &lt;span style="font-style: italic;"&gt;Filling -&gt; {1 -&gt; {2}}, FillingStyle -&gt; {Green, Red}&lt;/span&gt;, Green indicates HK price is higher than US price, the red means the opposite.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R9gIRvp40dI/AAAAAAAAA-w/FZxiARncXm8/s1600-h/hk2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R9gIRvp40dI/AAAAAAAAA-w/FZxiARncXm8/s400/hk2.png" alt="" id="BLOGGER_PHOTO_ID_5176896872605340114" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-4328293755962436578?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/4328293755962436578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=4328293755962436578' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4328293755962436578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4328293755962436578'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/03/understanding-finanical-market.html' title='Understanding Finanical Market: Arbitrage'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R9gJW_p40eI/AAAAAAAAA-4/ESAwS6y2BDo/s72-c/hk.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8630911548050590629</id><published>2008-03-03T14:17:00.010-05:00</published><updated>2008-03-03T20:23:49.188-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><title type='text'>Tip: Orthographic view of 3D graphics</title><content type='html'>The orthographic view of the 3D plot can be generated by using &lt;a href="http://reference.wolfram.com/mathematica/ref/ViewPoint.html"&gt;ViewPoint&lt;/a&gt; option. It comes very handy in some situations.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;data = RandomReal[1, {20, 3}];&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;ListPlot3D[data, InterpolationOrder -&gt; 0, ColorFunction -&gt; "Rainbow",&lt;/span&gt; &lt;span style="font-style: italic;"&gt;Mesh -&gt; None, Boxed -&gt; True, Axes -&gt; None]&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R8xTrMAiiDI/AAAAAAAAA-Q/wNuLc398dQI/s1600-h/listplot3d.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R8xTrMAiiDI/AAAAAAAAA-Q/wNuLc398dQI/s320/listplot3d.png" alt="" id="BLOGGER_PHOTO_ID_5173602073364826162" border="0" /&gt;&lt;/a&gt;Add option &lt;span style="font-style: italic;"&gt;ViewPoint-&gt;{0,0,Infinity}&lt;/span&gt; and draw it again.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R8xTxsAiiEI/AAAAAAAAA-Y/n6RqNHx_NKk/s1600-h/viewpoint.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R8xTxsAiiEI/AAAAAAAAA-Y/n6RqNHx_NKk/s320/viewpoint.png" alt="" id="BLOGGER_PHOTO_ID_5173602185033975874" border="0" /&gt;&lt;/a&gt;Then we can put together a nice bounded Voronoi diagram. It saves the trouble to use  &lt;a href="http://reference.wolfram.com/mathematica/ComputationalGeometry/ref/BoundedDiagram.html"&gt;BoundedDiagram&lt;/a&gt; from  Computational Geometry Package.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R8xT8sAiiFI/AAAAAAAAA-g/mJhhp5cvHuA/s1600-h/Voronoi.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R8xT8sAiiFI/AAAAAAAAA-g/mJhhp5cvHuA/s320/Voronoi.png" alt="" id="BLOGGER_PHOTO_ID_5173602374012536914" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8630911548050590629?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8630911548050590629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8630911548050590629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8630911548050590629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8630911548050590629'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/03/tip-orthographic-view-of-3d-graphics.html' title='Tip: Orthographic view of 3D graphics'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R8xTrMAiiDI/AAAAAAAAA-Q/wNuLc398dQI/s72-c/listplot3d.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5125229078169856753</id><published>2008-03-02T09:21:00.003-05:00</published><updated>2008-03-02T10:03:26.526-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Min Max problem</title><content type='html'>There is a discussion in Matlab blog: &lt;a href="http://blogs.mathworks.com/loren/2008/02/27/should-min-and-max-marry/"&gt;Should min and max marry?&lt;/a&gt;&lt;br /&gt;The question is what the overhead is in          calling min &lt;span style="font-family:monospace;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;/span&gt;and max separately, instead of scanning through the data once, looking for both the lowest and highest values, and is it worth having a combined function for &lt;tt&gt;min&lt;/tt&gt; and &lt;tt&gt;max&lt;/tt&gt; from a speed point of view? It seems worthy it, if you work with large data frequently.&lt;br /&gt;&lt;br /&gt;I am not sure about how Mathematica handle Min/Max internally. The one thing I can confirm is that Min/Max operations on large random 1 dimensional array are several times faster than the ones in Matlab in my computer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5125229078169856753?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5125229078169856753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5125229078169856753' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5125229078169856753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5125229078169856753'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/03/min-max-problem.html' title='Min Max problem'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6336862172184467189</id><published>2008-02-25T10:37:00.002-05:00</published><updated>2008-02-25T10:41:53.708-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Tip on Mathematica Programming</title><content type='html'>There are two interesting presentations from 2007 Wolfram Technology Conference.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://library.wolfram.com/infocenter/Conferences/7005/"&gt;Efficient Mathematica Programming&lt;/a&gt;: tips from MathGroup, very helpful.&lt;br /&gt;&lt;a href="http://library.wolfram.com/infocenter/Conferences/7002/"&gt;A New Mathematica Programming Style&lt;/a&gt;: prefix and postfix-pure function is disscussed as an alternative to the traditional matchfix-dominated style&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6336862172184467189?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6336862172184467189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6336862172184467189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6336862172184467189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6336862172184467189'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/02/tip-on-mathematica-programming.html' title='Tip on Mathematica Programming'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5998740781342346484</id><published>2008-02-25T09:56:00.007-05:00</published><updated>2008-02-25T18:00:23.641-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='CityData'/><title type='text'>Google Static Maps API</title><content type='html'>Google finally release &lt;a href="http://code.google.com/apis/maps/documentation/staticmaps/index.html"&gt;Google Static Maps API&lt;/a&gt;, which allows you to generate the maps using a regular URL (ala REST) along with parameters specifying location, size, etc and it returns a unique GIF image with that map.&lt;br /&gt;However, there are several drawbacks, for example, &lt;code&gt;512x512&lt;/code&gt; is the largest image size allowed and geocoding is not integrated. Even though, it is better than  nothing.&lt;br /&gt;&lt;br /&gt;The following shows the API example:&lt;br /&gt;&lt;a href="http://www.google.com/trends?q=mathematica&amp;amp;ctab=0&amp;amp;geo=US&amp;amp;geor=all&amp;amp;date=ytd&amp;amp;sort=0"&gt;Top 10 "Mathematica" cites&lt;/a&gt; from Google Trends.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R8LbRbJlQZI/AAAAAAAAA80/8ORikI8tPAM/s1600-h/mathcity.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R8LbRbJlQZI/AAAAAAAAA80/8ORikI8tPAM/s320/mathcity.png" alt="" id="BLOGGER_PHOTO_ID_5170936414566957458" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;For fun, top 10 Mathematica cities vs  top 10 Matlab  cities&lt;br /&gt;Red "M"--&gt; Mathematica City, Blue "T" --&gt; Matlab City, Green "B" --&gt; City with both Mathematica and Matlab.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R8LdY7JlQbI/AAAAAAAAA9E/wjYs1nmQ0eA/s1600-h/geoquery.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R8LdY7JlQbI/AAAAAAAAA9E/wjYs1nmQ0eA/s320/geoquery.png" alt="" id="BLOGGER_PHOTO_ID_5170938742439231922" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update: &lt;/span&gt;static maps seems use the old data&lt;br /&gt;Noticed the problem with "Trade Center Dr",&lt;br /&gt;Check &lt;a href="http://maps.google.com/maps?f=q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=40.09769923125692,-88.24470072984695&amp;amp;ie=UTF8&amp;amp;ll=40.098222,-88.244709&amp;amp;spn=0.005499,0.010042&amp;amp;z=17"&gt;this place on Google Map&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R8NIM7JlQcI/AAAAAAAAA9M/FTSMWe17yww/s1600-h/staticmap.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R8NIM7JlQcI/AAAAAAAAA9M/FTSMWe17yww/s320/staticmap.gif" alt="" id="BLOGGER_PHOTO_ID_5171056184024973762" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5998740781342346484?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5998740781342346484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5998740781342346484' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5998740781342346484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5998740781342346484'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/02/google-static-maps.html' title='Google Static Maps API'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0mA_T7sKsO4/R8LbRbJlQZI/AAAAAAAAA80/8ORikI8tPAM/s72-c/mathcity.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-761677393789090823</id><published>2008-02-17T21:37:00.005-05:00</published><updated>2008-02-17T21:42:35.870-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Play with Images: Letter Image</title><content type='html'>&lt;a href="http://metaatem.net/words/"&gt;Spell with Flickr&lt;/a&gt; is interesting. I modified the &lt;a href="http://mathgis.blogspot.com/2008/01/play-with-images-flickr.html"&gt;Flickr image wall code&lt;/a&gt;.&lt;br /&gt;Here is the result:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R7jwcrJlQYI/AAAAAAAAA8Q/mCc_qPSKIZM/s1600-h/characterimage2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R7jwcrJlQYI/AAAAAAAAA8Q/mCc_qPSKIZM/s400/characterimage2.png" alt="" id="BLOGGER_PHOTO_ID_5168144947817562498" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R7jwMrJlQXI/AAAAAAAAA8I/4rfGGFOryBk/s1600-h/characterimage.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R7jwMrJlQXI/AAAAAAAAA8I/4rfGGFOryBk/s400/characterimage.png" alt="" id="BLOGGER_PHOTO_ID_5168144672939655538" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-761677393789090823?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/761677393789090823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=761677393789090823' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/761677393789090823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/761677393789090823'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/02/play-with-images-letter-image.html' title='Play with Images: Letter Image'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R7jwcrJlQYI/AAAAAAAAA8Q/mCc_qPSKIZM/s72-c/characterimage2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2621120512446362075</id><published>2008-02-08T09:23:00.000-05:00</published><updated>2008-02-08T09:31:28.316-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Import High Resolution DEM (2)</title><content type='html'>We are talking about more general case here: DEM is processed in ArcGIS (e.g. Mosaic, Extract by Mask, etc.). And it is ready for computation in Mathematica. The DEM can be exported as Float32 format, imported with the procedure in &lt;a title="the previous post" href="http://mathgis.blogspot.com/2008/02/import-high-resolution-dem-1.html" id="kl1q"&gt;the previous post&lt;/a&gt;.&lt;br /&gt;In this post, the DEM is exported as ARCGrid ASCII format, the whole DEM is in one text file.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;data = Import["DEM.txt", {"Lines", All}];&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;(* the first lines are metadata *)&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;meta = data[[1 ;; 6]]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;{"ncols         1703", "nrows         1200", "xllcorner &lt;br /&gt;-86.528233463385", "yllcorner     41.430023494444", "cellsize &lt;br /&gt;0.00027777777779994", "NODATA_value  -9999"}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; (* drop the metadata *)&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;data = Drop[data, 6];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; (* convert string to data *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; data = Map[ToExpression, StringSplit[#]] &amp;amp; /@ data;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The next step is that we will make the output of ReliefPlot match the other geographic data.&lt;br /&gt;&lt;br /&gt;1. Deal with NOData: PlotRange-&gt;{zMin,zMax}&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R6xmed9VTVI/AAAAAAAAA74/smM_pe06n74/s1600-h/demplotrange.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R6xmed9VTVI/AAAAAAAAA74/smM_pe06n74/s400/demplotrange.PNG" alt="" id="BLOGGER_PHOTO_ID_5164615546311101778" border="0" /&gt;&lt;/a&gt;2. Put the image into right geographic zone: DataRange-&gt; {{Lon_Min, Lon_Max}, {Lat_Min, Lat_Max}}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;ReliefPlot[data, DataReversed-&gt;True, DataRange-&gt; {{-86.5282, -86.0552}, {41.4300, 41.7634}}, PlotRange -&gt; {199.0, 283.0}]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then tested it with the map created in &lt;a title="another post" href="http://mathgis.blogspot.com/2008/02/select-point-data-inside-geographical.html" id="yb3r"&gt;another post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R6xmyt9VTWI/AAAAAAAAA8A/VP2g6n6-IfU/s1600-h/dem.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R6xmyt9VTWI/AAAAAAAAA8A/VP2g6n6-IfU/s400/dem.png" alt="" id="BLOGGER_PHOTO_ID_5164615894203452770" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Note: ReliefPlot needs an option: NoData-&gt;{}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2621120512446362075?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2621120512446362075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2621120512446362075' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2621120512446362075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2621120512446362075'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/02/import-high-resolution-dem-2.html' title='Import High Resolution DEM (2)'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R6xmed9VTVI/AAAAAAAAA74/smM_pe06n74/s72-c/demplotrange.PNG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5255638804991563105</id><published>2008-02-08T08:45:00.001-05:00</published><updated>2008-02-08T08:52:43.380-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Import High Resolution DEM (1)</title><content type='html'>The best place to get high resolution DEM is from &lt;a title="USGS National Map Seamless Server" href="http://seamless.usgs.gov/" id="ungs"&gt;USGS National Map Seamless Server&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It publishes National Elevation Dataset (NED) in 1 arc second(~30m resolution), 1/3 arc second(~10m resolution) and 1/9 arc second(~3m resolution).&lt;br /&gt;&lt;br /&gt;The default file format is ESRI ArcGRID. Several other non-proprietary formats are available. If you don't want to further process the DEM in ArcGIS, GridFloat format is the right choice. GridFloat is "a simple binary raster format (floating point data). There is an accompanying ASCII header file that provides file size information (number of rows and columns). The data are stored in row major order (all the data for row 1, followed by all the data for row 2, etc.)". See &lt;a title="National Elevation Data (NED) FAQ" href="http://seamless.usgs.gov/faq/ned_faq.php#nine" id="hodx"&gt;National Elevation Data (NED) FAQ&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Follow &lt;a title="this tutorial" href="http://seamless.usgs.gov/tutorial.php" id="bmd2"&gt;this tutorial&lt;/a&gt; for downloading procedure.&lt;br /&gt;&lt;br /&gt;After downloading, unzip the file, .flt is the data for DEM, .hdr is the header ASCII file.&lt;br /&gt;&lt;br /&gt;Open header file (.hdr)&lt;br /&gt;&lt;br /&gt;ncols         650&lt;br /&gt;nrows         395&lt;br /&gt;xllcorner     -86.428333330255&lt;br /&gt;yllcorner     41.639166666159&lt;br /&gt;cellsize      0.00027777777779995&lt;br /&gt;NODATA_value  -9999&lt;br /&gt;byteorder     LSBFIRST&lt;br /&gt;&lt;br /&gt;We can see this DEM has 395 row and 650 col.&lt;br /&gt;&lt;br /&gt;In Mathematica:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;data30 = Import["ned30.flt", {"Binary", "Real32"}];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* each row has 650 col. *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;data30 = Partition[data30, 650];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;ReliefPlot[data30, DataReversed -&gt; True, ColorFunction -&gt; "Rainbow"]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The following examples show the same area in 1 arc second (30m) and 1/3 arc second (10m) DEMs.&lt;br /&gt;&lt;div style="text-align: center;"&gt;30m&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R6xdfd9VTTI/AAAAAAAAA7o/sxHPEsKfpSA/s1600-h/dem30m.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R6xdfd9VTTI/AAAAAAAAA7o/sxHPEsKfpSA/s400/dem30m.png" alt="" id="BLOGGER_PHOTO_ID_5164605667886320946" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;10m&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R6xd7N9VTUI/AAAAAAAAA7w/CxudWunvtFU/s1600-h/dem10m.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R6xd7N9VTUI/AAAAAAAAA7w/CxudWunvtFU/s400/dem10m.png" alt="" id="BLOGGER_PHOTO_ID_5164606144627690818" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5255638804991563105?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5255638804991563105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5255638804991563105' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5255638804991563105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5255638804991563105'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/02/import-high-resolution-dem-1.html' title='Import High Resolution DEM (1)'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R6xdfd9VTTI/AAAAAAAAA7o/sxHPEsKfpSA/s72-c/dem30m.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6770105511722575668</id><published>2008-02-07T11:08:00.000-05:00</published><updated>2008-02-08T08:53:43.561-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='CityData'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Select Point Data inside Geographical Boundary</title><content type='html'>Here is an example on how to select point data inside the geographical boundary by using point inside polygon function.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* all the cities {name, coordinates} in Indiana *)&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;allcities = {First[#], CityData[#, "Coordinates"]} &amp;amp; /@ CityData[{All, "Indiana", "UnitedStates"}];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We like to select the cities inside St. Joseph county.&lt;br /&gt;Boundary of St. Joseph county is imported as Polygon. See &lt;a href="http://mathgis.blogspot.com/2008/01/details-on-importing-gis-data.html"&gt;details on importing GIS data&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In Mahtematica-users Wiki, there is an discussion on &lt;a href="http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Notebook:PointInsidePolygon.nb"&gt;Point Inside Polygon&lt;/a&gt;. We choose the first solution, since it works on non-convex polygon.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* select cities by Point inside Polygon function *)&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;Select[allcities, PLSPolygon[countyboundary, #[[2]]] &amp;amp;]&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R6tQa99VTSI/AAAAAAAAA7g/_97uSRtCKlU/s1600-h/selectdatabypolygon.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R6tQa99VTSI/AAAAAAAAA7g/_97uSRtCKlU/s400/selectdatabypolygon.png" alt="" id="BLOGGER_PHOTO_ID_5164309821949037858" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R6syaN9VTRI/AAAAAAAAA7Y/dCMutbBKS9A/s1600-h/selectdatabypolygon.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6770105511722575668?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6770105511722575668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6770105511722575668' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6770105511722575668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6770105511722575668'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/02/select-point-data-inside-geographical.html' title='Select Point Data inside Geographical Boundary'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R6tQa99VTSI/AAAAAAAAA7g/_97uSRtCKlU/s72-c/selectdatabypolygon.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1233199422218300284</id><published>2008-02-05T11:03:00.000-05:00</published><updated>2008-02-05T22:00:38.669-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FinancialData'/><title type='text'>Fun with Financial Data: Currency Exchange Rates</title><content type='html'>Someone posted some interesting photos from his trip to Japan in this January. One is delicious sushi sold at the roadside in somewhere, Kyoto, Japan.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R6iSFN9VTQI/AAAAAAAAA7Q/l5PtMv0pduo/s1600-h/sushi.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R6iSFN9VTQI/AAAAAAAAA7Q/l5PtMv0pduo/s400/sushi.jpg" alt="" id="BLOGGER_PHOTO_ID_5163537591124184322" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In the top row, the one marked for 900 Yen looks exactly like the ones sold here in greocery store. I am wondering the price in US dollars. &lt;p&gt;&lt;em&gt;900/FinancialData["USD/JPY"]&lt;/em&gt; gives $8.42, it is around 60% more expensive than the ones you can get here, however, it must taste much better.&lt;/p&gt;One interesting thing is how much we can get if we convert 1 USD dollar to Japan Yen through the third currency.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;FinancialData[{"USD",#}] / FinancialData[{"JPY",#}] &amp;amp;/@ {"HKD","EUR","GBP","CAD"}&lt;/em&gt;&lt;br /&gt;{106.842, 106.625, 106., 106.947}&lt;br /&gt;&lt;br /&gt;Direct exchange rate is 106.825.&lt;br /&gt;&lt;br /&gt;USD-&gt;GBP-&gt;JPY: lost near 1%           USD-&gt;CAD-&gt;JPY: gain tiny 0.1%&lt;br /&gt;&lt;br /&gt;Is there a simple way to find a currency exchange chain "USD-&gt;..-&gt;... -&gt;JPY" to maximize the gain over "USD-&gt;JPY"?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1233199422218300284?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1233199422218300284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1233199422218300284' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1233199422218300284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1233199422218300284'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/02/fun-with-financial-data-currency.html' title='Fun with Financial Data: Currency Exchange Rates'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0mA_T7sKsO4/R6iSFN9VTQI/AAAAAAAAA7Q/l5PtMv0pduo/s72-c/sushi.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2203336217596044524</id><published>2008-02-04T12:55:00.000-05:00</published><updated>2008-02-04T13:09:13.871-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Fun with MatrixPlot: Pixel Art</title><content type='html'>MatrixPlot is great for pixel art.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;jp=MatrixPlot[pixelart, Frame-&gt;None, ColorRules-&gt;{0-&gt;White}, ColorFunction-&gt;#, ImageSize-&gt;90, Mesh-&gt;All, MeshStyle-&gt;LightGray] &amp;amp;/@ Append[ColorData["Gradients"], "Monochrome"];&lt;/span&gt; &lt;span style="font-style: italic;"&gt;GraphicsGrid[Partition[RandomSample[jp],8],Spacings-&gt;0]&lt;br /&gt;&lt;br /&gt;&lt;/span&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R6dTjt9VTOI/AAAAAAAAA7A/KHUKAGZYx2U/s1600-h/pixelart.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R6dTjt9VTOI/AAAAAAAAA7A/KHUKAGZYx2U/s400/pixelart.png" alt="" id="BLOGGER_PHOTO_ID_5163187370900933858" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://reference.wolfram.com/mathematica/ref/ColorRules.html?q=colorrules&amp;amp;lang=en"&gt;ColorRules&lt;/a&gt; can be used for the better result, e.g. &lt;span style="font-style: italic;"&gt;ColorRules -&gt; {0 -&gt; White, 1 -&gt; Yellow, 2 -&gt; Orange, 3 -&gt; Pink, 4 -&gt; Red}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2203336217596044524?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2203336217596044524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2203336217596044524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2203336217596044524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2203336217596044524'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/02/fun-with-matrixplot-pixel-art.html' title='Fun with MatrixPlot: Pixel Art'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R6dTjt9VTOI/AAAAAAAAA7A/KHUKAGZYx2U/s72-c/pixelart.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-7410183216711148817</id><published>2008-01-31T21:25:00.000-05:00</published><updated>2008-01-31T21:39:08.978-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Tip: Import 3D Model</title><content type='html'>For whatever reason, some 3D models have to be imported in Mathematica.&lt;br /&gt;The 3D model is stored as &lt;a href="http://reference.wolfram.com/mathematica/ref/format/OBJ.html"&gt;OBJ file&lt;/a&gt;. When it is imported, it loses the texture information.&lt;br /&gt;&lt;br /&gt;(* set the color *)&lt;br /&gt;&lt;span style="font-style: italic;"&gt;roof = Import["greenroof.obj"]&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;roof = roof /. {l_Line :&gt; {Thick,Black, l}, p_Polygon :&gt; {FaceForm[Darker[Green]], p}}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R6KEwd9VTMI/AAAAAAAAA6w/5b5lHNi_JO8/s1600-h/roof.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R6KEwd9VTMI/AAAAAAAAA6w/5b5lHNi_JO8/s400/roof.PNG" alt="" id="BLOGGER_PHOTO_ID_5161834091130473666" border="0" /&gt;&lt;/a&gt;Here the whole model:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R6KE7d9VTNI/AAAAAAAAA64/ku0tcjqsiZU/s1600-h/logcabin.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R6KE7d9VTNI/AAAAAAAAA64/ku0tcjqsiZU/s400/logcabin.png" alt="" id="BLOGGER_PHOTO_ID_5161834280109034706" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-7410183216711148817?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/7410183216711148817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=7410183216711148817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7410183216711148817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7410183216711148817'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/tip-import-3d-model.html' title='Tip: Import 3D Model'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0mA_T7sKsO4/R6KEwd9VTMI/AAAAAAAAA6w/5b5lHNi_JO8/s72-c/roof.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5004435763889550433</id><published>2008-01-29T09:56:00.000-05:00</published><updated>2008-01-29T10:47:06.230-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Tip: Mathematica version of Maltab "Find" Function</title><content type='html'>I must say that if you work with Matlab everyday, it is really frustrated with Mathematica in some points.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/find.html"&gt;Find&lt;/a&gt; is one of the most frequently used functions in Matlab.&lt;br /&gt;Find(array&gt;5.0): returns indices of the elements that are greater than 5.0.&lt;br /&gt;&lt;br /&gt;In Mathematica, the corresponding function is &lt;a href="http://reference.wolfram.com/mathematica/ref/Position.html"&gt;Position&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Position[array, #&gt;5.0&amp;amp;] &lt;/span&gt;or &lt;span style="font-style: italic;"&gt;Position[array, _&gt;5.0]&lt;/span&gt; just doesn't work.&lt;br /&gt;&lt;span class="none"&gt;&lt;span class="IF"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;We "simple-minded" Matlab user have seldom thought about &lt;a href="http://reference.wolfram.com/mathematica/tutorial/PuttingConstraintsOnPatterns.html"&gt;putting constraints on patterns&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then, this will do the job&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Position[array, x : _ /; x &gt; 5.0]&lt;br /&gt;&lt;br /&gt;Position[array, x:_ /; testfunc[x]]&lt;/span&gt;&lt;span&gt; will do better.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5004435763889550433?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5004435763889550433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5004435763889550433' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5004435763889550433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5004435763889550433'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/tip-mathematica-version-of-maltab-find.html' title='Tip: Mathematica version of Maltab &quot;Find&quot; Function'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6689545065269386276</id><published>2008-01-28T12:05:00.000-05:00</published><updated>2008-01-28T12:19:39.476-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Tip: ListPlot3D and InterpolationOrder</title><content type='html'>Not exactly a tip.&lt;br /&gt;&lt;br /&gt;10,000 random points&lt;br /&gt;Regular grid: &lt;span style="font-style: italic;"&gt;data = Table[RandomReal[], {100}, {100}];&lt;/span&gt;&lt;br /&gt;Irregular grid: &lt;span style="font-style: italic;"&gt;data = RandomReal[1, {10000, 3}];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Table[ListPlot3D[data, InterpolationOrder -&gt; n, Mesh -&gt; None]; // Timing, {n, {0, 1, 2, 3, 4}}]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Result (in seconds):&lt;br /&gt;Interplotion Order: 0,  1,  2,  3,   4&lt;br /&gt;Regular Gird: 0.771, 3.415, 3.435, 3.525, 3.565&lt;br /&gt;Irregular Grid:6.349, 4.871, 4.767, 4.777, 4.737&lt;br /&gt;&lt;br /&gt;Difference in zero-order interpolation is huge.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://reference.wolfram.com/mathematica/ref/InterpolationOrder.html"&gt;InterpolationOrder&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6689545065269386276?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6689545065269386276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6689545065269386276' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6689545065269386276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6689545065269386276'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/tip-listplot3d-and-interpolationorder.html' title='Tip: ListPlot3D and InterpolationOrder'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-284209395774139443</id><published>2008-01-24T15:33:00.000-05:00</published><updated>2008-01-24T15:43:48.778-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><title type='text'>Tip: Counting Files by Date</title><content type='html'>We like to know the number of the certain special type file processed month by month.&lt;br /&gt;The following code will do the job:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* all the files under one base direcotry *)&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;SetDirectory[basedirectory]&lt;br /&gt;&lt;/span&gt; &lt;span style="font-style: italic;"&gt; (* find all the files in all the subdirectories*)&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;files = FileNames["*.byt", {"*"}, Infinity];&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;(* return {year, month} for each file *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;data = Take[FileDate[basedirectory &lt;&gt; "\\" &lt;&gt; #], 2] &amp;amp; /@ files;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* sort then count *)&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;cs = Tally[Sort[data]];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* draw the graph *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;DateListPlot[cs, Filling -&gt; Bottom, FillingStyle -&gt; Blue, &lt;/span&gt; &lt;span style="font-style: italic;"&gt; PlotStyle -&gt; {Red, PointSize[Large]}, &lt;/span&gt; &lt;span style="font-style: italic;"&gt; PlotRange -&gt; {{{2006, 1}, {2008, 2}}, Automatic}, &lt;/span&gt; &lt;span style="font-style: italic;"&gt; DateTicksFormat -&gt; {"MonthShort", "/", "YearShort"}]&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R5j4Bt9VTLI/AAAAAAAAA6Q/mJ2aUVGRT1s/s1600-h/filedate.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R5j4Bt9VTLI/AAAAAAAAA6Q/mJ2aUVGRT1s/s400/filedate.png" alt="" id="BLOGGER_PHOTO_ID_5159146081553304754" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-284209395774139443?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/284209395774139443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=284209395774139443' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/284209395774139443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/284209395774139443'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/tip-counting-files-by-date.html' title='Tip: Counting Files by Date'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R5j4Bt9VTLI/AAAAAAAAA6Q/mJ2aUVGRT1s/s72-c/filedate.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6096738971190832948</id><published>2008-01-22T11:53:00.001-05:00</published><updated>2008-01-24T15:50:15.652-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Fun with Map: Simple Geocoding with Yahoo Map API</title><content type='html'>&lt;a href="http://developer.yahoo.com/maps/"&gt;Yahoo Map API&lt;/a&gt; has a simple REST interface which works well with Mathematica.&lt;br /&gt;Here is an example to show a simple &lt;a href="http://en.wikipedia.org/wiki/Geocoding"&gt;Geocoding&lt;/a&gt; function.&lt;br /&gt;&lt;br /&gt;Problem: Give an address, return (longitude, latitude)&lt;br /&gt;&lt;br /&gt;The basic query format:&lt;br /&gt;http://local.yahooapis.com/MapsService/V1/geocode?appid=YahooDemo&lt;br /&gt;&amp;amp;street=?&amp;amp;city=?&amp;amp;state=?&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R5Yk9cgstGI/AAAAAAAAA5g/yhody9e5qvQ/s1600-h/geocoding.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R5Yk9cgstGI/AAAAAAAAA5g/yhody9e5qvQ/s400/geocoding.png" alt="" id="BLOGGER_PHOTO_ID_5158351061243442274" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span&gt;Let's try it with the address of Wolfram Research &lt;/span&gt;&lt;span&gt;Inc.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;geocoding[{"100 Trade Center Drive", "Champaign", "IL"}]&lt;br /&gt;{-88.244868, 40.097855}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Is the result right? Let's check it out with Map Image API.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R5YlT8gstHI/AAAAAAAAA5o/F6Gap1A8r74/s1600-h/mapimage.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R5YlT8gstHI/AAAAAAAAA5o/F6Gap1A8r74/s400/mapimage.png" alt="" id="BLOGGER_PHOTO_ID_5158351447790498930" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;image[geocoding[{"100 Trade Center Drive", "Champaign", "IL"}]]&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R5YljsgstII/AAAAAAAAA5w/qOSGNw1sjqM/s1600-h/wolfram.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 340px; height: 275px;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R5YljsgstII/AAAAAAAAA5w/qOSGNw1sjqM/s400/wolfram.png" alt="" id="BLOGGER_PHOTO_ID_5158351718373438594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;Notice:&lt;br /&gt;&lt;/span&gt;1. I use "YahooDemo" as AppID, if you want to use this function frequently, please apply your own ID, it is free.&lt;br /&gt;2. The Geocoding API is limited to 5, 000 queries per IP per day, Google Map has the similar limitation, so if you need geocoding a large amount of addresses, please use offline geocoding application.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;reference: &lt;a href="http://developer.yahoo.com/maps/"&gt;Yahoo Map API&lt;/a&gt;, &lt;a href="http://developer.yahoo.com/maps/rest/V1/mapImage.html"&gt;Map Image API&lt;/a&gt;, &lt;a href="http://developer.yahoo.com/maps/rest/V1/geocode.html"&gt;Geocoding API&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;update:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Google version&lt;/span&gt;: see 1th comment , Thanks very much.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6096738971190832948?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6096738971190832948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6096738971190832948' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6096738971190832948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6096738971190832948'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/fun-with-map-simple-geocoding-with.html' title='Fun with Map: Simple Geocoding with Yahoo Map API'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R5Yk9cgstGI/AAAAAAAAA5g/yhody9e5qvQ/s72-c/geocoding.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5993858859968349309</id><published>2008-01-20T22:42:00.000-05:00</published><updated>2008-01-21T09:45:07.810-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Tip: Programming Style</title><content type='html'>Read it from the company newsletter sometime ago:&lt;br /&gt;&lt;br /&gt;Given a list of pairs of numbers, return a list consisting of the sum of each pair.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;pairs = {{58, 96}, {85, 22}, {100, 69}, {5, 37}, {32, 64}, {41, 86}, {14, 0}, {79, 22}, {55, 36}, {86, 39}, {11, 15}};&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* Style I*)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;result = Table[Null, {Length[pairs]}];&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;Do[result[[k]] = pairs[[k, 1]] + pairs[[k, 2]], {k, 1, Length[pairs]}]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;result&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* Style II *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Table[pairs[[k, 1]] + pairs[[k, 2]], {k, Length[pairs]}]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* Style III *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Apply[Plus, pairs, {1}]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* Style IV *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Map[Total, pairs]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* Style V *)&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;pairs /. {p_, q_} -&gt; p + q&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* Style VI *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;pairs[[All, 1]] + pairs[[All, 2]]&lt;br /&gt;&lt;br /&gt;I work with Maltab most of the time, &lt;/span&gt;&lt;span style="font-style: italic;"&gt;it is useful to read this kind of document occasionally.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5993858859968349309?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5993858859968349309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5993858859968349309' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5993858859968349309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5993858859968349309'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/tip-programming-style.html' title='Tip: Programming Style'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-2099003425209275378</id><published>2008-01-18T10:08:00.000-05:00</published><updated>2008-01-21T14:10:48.918-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='HowTos'/><title type='text'>Details on Importing GIS Data</title><content type='html'>If you live US, there are plenty of GIS data published by different government agencies, it is quite possible that the county where you live has its own GIS department now. Most of the vector data come in ESRI shape file format. There are several different ways to get shape file into Mathematica. One simple way is explained here, it uses tools based on &lt;a href="http://shapelib.maptools.org/"&gt;shapelib&lt;/a&gt; (open source tools to read/write shape file).&lt;br /&gt;&lt;br /&gt;Step 1. Find the data you want&lt;br /&gt;Just go to the agency may have the data you are interested. In this example, I will use the Indiana county boundary data I have.&lt;br /&gt;There are some free/open source GIS software you can use to check the data: &lt;a href="http://www.qgis.org/"&gt;Quantum GIS&lt;/a&gt;,&lt;a href="http://www.esri.com/software/arcgis/explorer/index.html"&gt; ArcGIS Explorer&lt;/a&gt;. (No offense here, I just assume you don't much about GIS.)&lt;br /&gt;&lt;br /&gt;Step 2. Output shaple file to data&lt;br /&gt;We use &lt;a href="http://www.obviously.com/gis/shp2text/"&gt;shp2text&lt;/a&gt;, and you can find more information on its website.&lt;br /&gt;In command line mode:&lt;br /&gt;&lt;span style="font-style: italic;"&gt;shp2text --gpx indiana.shp&lt;/span&gt;&lt;br /&gt;the output is the structure of the associated data in DBF  file. We like to have county name, it is in Field 1.&lt;br /&gt;Field 0: Type=Integer, Title=`FIPS', Width=5, Decimals=0&lt;br /&gt;Field 1: Type=String, Title=`COUNTY', Width=16, Decimals=0&lt;br /&gt;Field 2: Type=String, Title=`DOQ_DISK', Width=16, Decimals=0&lt;br /&gt;Field 3: Type=String, Title=`FIPS_STRG', Width=16, Decimals=0&lt;br /&gt;Field 4: Type=String, Title=`ATLAS_CODE', Width=16, Decimals=0&lt;br /&gt;Field 5: Type=Double, Title=`AREA_FT2', Width=19, Decimals=3&lt;br /&gt;Field 6: Type=Double, Title=`AREA_ACRES', Width=19, Decimals=3&lt;br /&gt;Field 7: Type=Double, Title=`PERIMETER_', Width=19, Decimals=3&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;shp2text --gpx indiana.shp 1 0 &gt; output.xml&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There will dump the shape file into xml file, of course, if you can dump it into plain text without "--gpx", and reformat the plain text to cvs format. I personally prefer to XML format.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R5DPOsgstFI/AAAAAAAAA5A/vMoXf40oF1I/s1600-h/xml.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R5DPOsgstFI/AAAAAAAAA5A/vMoXf40oF1I/s400/xml.png" alt="" id="BLOGGER_PHOTO_ID_5156849424712643666" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;see &lt;a href="http://docs.google.com/Doc?id=dfqr9wnh_10fbx92fdq"&gt;the whole document&lt;/a&gt; here.&lt;br /&gt;&lt;br /&gt;Step 3. Process XML file in Mathematica&lt;br /&gt;I listed the code step by step here in case you are not familiar with XML.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;dataxml = Import["output.xml"];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* extract county names *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;countyname = Drop[Cases[dataxml, XMLElement["name", __, {w_}] :&gt; w, Infinity], 1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* extract {lat, lon} for each county boundary *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;wholes=Cases[dataxml, XMLElement["rte", __], Infinity] ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;counties = (Cases[#, XMLElement["rtept", __], Infinity] &amp;amp; ) /@ wholes;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;dataLatLon = counties /. (XMLElement["rtept", latLonRules_, {}] :&gt;  { {"lat", "lon"} /. latLonRules });&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* tidy up a little, of course, you can combine them into one line code*)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;test = Flatten[#, 1] &amp;amp; /@ dataLatLon;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;test = Map[ToExpression, test];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;test = Map[Reverse, test, 2];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* then draw it *)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Graphics[{EdgeForm[Gray], FaceForm[LightGreen], Polygon[test]}]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is the example that uses the data imported as the background map.&lt;br /&gt;Point data is from CityData, and it shows all cities with population &gt; 1000.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R5DOqcgstEI/AAAAAAAAA44/nJQv89KIek0/s1600-h/indianacity.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R5DOqcgstEI/AAAAAAAAA44/nJQv89KIek0/s400/indianacity.png" alt="" id="BLOGGER_PHOTO_ID_5156848801942385730" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Importing point, line type of data is in the similar way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-2099003425209275378?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/2099003425209275378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=2099003425209275378' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2099003425209275378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/2099003425209275378'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/details-on-importing-gis-data.html' title='Details on Importing GIS Data'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R5DPOsgstFI/AAAAAAAAA5A/vMoXf40oF1I/s72-c/xml.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1069672830681654347</id><published>2008-01-18T09:33:00.000-05:00</published><updated>2008-01-18T09:40:27.091-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Tip: Efficient Plot Large Point Data Set</title><content type='html'>It is from the &lt;a href="http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/b21c73a465ff45ce#"&gt;discussion from math group&lt;/a&gt;.&lt;br /&gt;Point, Line and Polygon now accept  multi-coordinate list that can be processed and rendered more quickly by the &lt;i&gt;Mathematica&lt;/i&gt; front end than the equivalent individual primitives.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;data = Table[{Random[], Random[]}, {100000}];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Graphics[{PointSize[0.002], Point[data]}, AspectRatio -&gt; Automatic]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Graphics[{PointSize[0.002], Point[#] &amp;amp; /@ data}, AspectRatio -&gt; Automatic]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;More information: &lt;a href="http://reference.wolfram.com/mathematica/tutorial/EfficientRepresentationOfManyPrimitives.html"&gt;Efficient Representation of Many Primitives&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1069672830681654347?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1069672830681654347/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1069672830681654347' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1069672830681654347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1069672830681654347'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/tip-efficient-plot-large-point-data-set.html' title='Tip: Efficient Plot Large Point Data Set'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-4726750571819822586</id><published>2008-01-17T14:40:00.001-05:00</published><updated>2008-01-17T14:50:14.527-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><title type='text'>Old Time Fun: Ternary Plot</title><content type='html'>Here is the ternary plot of the &lt;a href="http://demonstrations.wolfram.com/NamedColors/"&gt;140 named colors&lt;/a&gt; supported by modern browsers. Actually, only 139 colors are drawn in the graph. There is no place for Black (RGBColor[0,0,0]), the center is White, however, you can't see it on the white background.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R4-wdMgstDI/AAAAAAAAA4w/BI-YWI46xt4/s1600-h/Triangleplot.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R4-wdMgstDI/AAAAAAAAA4w/BI-YWI46xt4/s400/Triangleplot.png" alt="" id="BLOGGER_PHOTO_ID_5156534113983575090" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-4726750571819822586?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/4726750571819822586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=4726750571819822586' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4726750571819822586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/4726750571819822586'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/old-time-fun-ternary-plot.html' title='Old Time Fun: Ternary Plot'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R4-wdMgstDI/AAAAAAAAA4w/BI-YWI46xt4/s72-c/Triangleplot.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-6323987370174116966</id><published>2008-01-15T14:25:00.001-05:00</published><updated>2008-01-15T14:29:29.952-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Old Time Fun: Binary Image</title><content type='html'>Can  you find out the  relationship between these two images?&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R40JDcgstCI/AAAAAAAAA4o/7bRnuLQKTSI/s1600-h/rule02.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R40JDcgstCI/AAAAAAAAA4o/7bRnuLQKTSI/s400/rule02.png" alt="" id="BLOGGER_PHOTO_ID_5155787103206683682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R40I-cgstBI/AAAAAAAAA4g/wTWzQZ8EVKM/s1600-h/rule01.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R40I-cgstBI/AAAAAAAAA4g/wTWzQZ8EVKM/s400/rule01.png" alt="" id="BLOGGER_PHOTO_ID_5155787017307337746" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-6323987370174116966?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/6323987370174116966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=6323987370174116966' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6323987370174116966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/6323987370174116966'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/old-time-fun-binary-image.html' title='Old Time Fun: Binary Image'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R40JDcgstCI/AAAAAAAAA4o/7bRnuLQKTSI/s72-c/rule02.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-7608329983025918798</id><published>2008-01-14T11:15:00.000-05:00</published><updated>2008-01-17T14:49:36.681-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Graph'/><title type='text'>Old Time Fun: Hilbert Curve</title><content type='html'>At the time I started learning Mathematica (maybe version 3.0), it is almost impossible for any student not to plot space filling curves or other fancy fractals.  Except for eye candy,  it is quite useless for most of us. Today, it can't even be counted as eye candy any more.&lt;br /&gt;Here is mine, &lt;a href="http://mathworld.wolfram.com/HilbertCurve.html"&gt;Hilbert Space Filling Curve&lt;/a&gt;, which I found in pile of old files,  the only thing that warms my heart a bit is that I come up with 4 dimensional version. You probably don't see 4D ones quite often. Of course, it has to be projected into 3D in some way for displaying.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R4uPHMgss8I/AAAAAAAAA30/LwH1HRcu0pw/s1600-h/hilbert2d.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R4uPHMgss8I/AAAAAAAAA30/LwH1HRcu0pw/s400/hilbert2d.png" alt="" id="BLOGGER_PHOTO_ID_5155371552235893698" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R4uPLsgss9I/AAAAAAAAA38/uZTfT2NsoQE/s1600-h/hilbert3d.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R4uPLsgss9I/AAAAAAAAA38/uZTfT2NsoQE/s400/hilbert3d.png" alt="" id="BLOGGER_PHOTO_ID_5155371629545305042" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4uPQ8gss-I/AAAAAAAAA4E/ggZNpn-RQKo/s1600-h/hilbert4d.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4uPQ8gss-I/AAAAAAAAA4E/ggZNpn-RQKo/s400/hilbert4d.png" alt="" id="BLOGGER_PHOTO_ID_5155371719739618274" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-7608329983025918798?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/7608329983025918798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=7608329983025918798' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7608329983025918798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7608329983025918798'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/old-time-fun-hilbert-curve.html' title='Old Time Fun: Hilbert Curve'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R4uPHMgss8I/AAAAAAAAA30/LwH1HRcu0pw/s72-c/hilbert2d.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-5895394837453690585</id><published>2008-01-11T15:04:00.001-05:00</published><updated>2008-01-11T15:47:30.871-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Play with Images: Sky Color</title><content type='html'>I grabbed some images tagged with "sky" from Flickr with yesterday's &lt;a href="http://mathgis.blogspot.com/2008/01/play-with-images-flickr.html"&gt;image wall code&lt;/a&gt;. One thing interests me that if there is a simple way to tell the color of  sky.  I am not a digital image person. Let's us see what a layman can do  abut it during the lunch break.&lt;br /&gt;The most simple idea is that averaging the color of the upper 3/4 part of the image. After tried with  several images, the result of averaged RGB value are mostly some gray colors. The &lt;a href="http://en.wikipedia.org/wiki/HSL_color_space"&gt;HSB color&lt;/a&gt; system seems to be a much better choice.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4fOz8gss6I/AAAAAAAAA3k/zE17ZCUEIDs/s1600-h/Hue.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4fOz8gss6I/AAAAAAAAA3k/zE17ZCUEIDs/s400/Hue.png" alt="" id="BLOGGER_PHOTO_ID_5154315690360746914" border="0" /&gt;&lt;/a&gt;The averaged H(hue)  shall do the job. Here is the some examples with Quartiles[h](&lt;span class="none"&gt;1/4, 1/2, 3/4&lt;/span&gt;) and Mean[h].&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R4fP8cgss7I/AAAAAAAAA3s/D9oxFqQHIWo/s1600-h/sky.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R4fP8cgss7I/AAAAAAAAA3s/D9oxFqQHIWo/s400/sky.png" alt="" id="BLOGGER_PHOTO_ID_5154316935901262770" border="0" /&gt;&lt;/a&gt; Median probably works better than Mean does for identifying the main sky color, and the color changes of different quartiles may be used as the indicator about the cloudy sky. I don't have time to go further.&lt;br /&gt;note: RGBtoHSV is part of the image processing package&lt;span style="font-weight: bold;"&gt;.&lt;/span&gt; &lt;a name="9.11"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-5895394837453690585?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/5895394837453690585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=5895394837453690585' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5895394837453690585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/5895394837453690585'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/play-with-images-sky-color.html' title='Play with Images: Sky Color'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R4fOz8gss6I/AAAAAAAAA3k/zE17ZCUEIDs/s72-c/Hue.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8212385978861784135</id><published>2008-01-10T11:28:00.000-05:00</published><updated>2008-01-10T12:50:50.980-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Play with images: Flickr image wall</title><content type='html'>I come across one old python script to download the images from flickr. It will be cool if it can be done in Mathematica. The goal at this lunchtime is to grab some thumbnails from group &lt;a href="http://www.flickr.com/groups/birdguide/"&gt;Field Guide: Birds of the World&lt;/a&gt; to make a small image wall.&lt;br /&gt;&lt;br /&gt;Here is the output&lt;div style="text-align: center;"&gt;Formated XML output&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4ZRoMgss3I/AAAAAAAAA3M/L71LuwOdxJk/s1600-h/flickrtable.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4ZRoMgss3I/AAAAAAAAA3M/L71LuwOdxJk/s400/flickrtable.png" alt="" id="BLOGGER_PHOTO_ID_5153896574567101298" border="0" /&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;    Image wall &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R4ZR2cgss4I/AAAAAAAAA3U/a1ifsQvnm78/s1600-h/flickrwall.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R4ZR2cgss4I/AAAAAAAAA3U/a1ifsQvnm78/s400/flickrwall.png" alt="" id="BLOGGER_PHOTO_ID_5153896819380237186" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;div style="text-align: left;"&gt;Images are placed in random orders.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Achieved in 9 lines of code, not too bad.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;reference: &lt;a href="http://www.flickr.com/services/api/"&gt;Flickr API&lt;/a&gt;, &lt;a href="http://www.flickr.com/services/api/misc.urls.html"&gt;Photo Source Url&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Created a larger version (100 photos).&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4ZWRMgss5I/AAAAAAAAA3c/FumxvJzrLfg/s1600-h/flickrwall_L.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4ZWRMgss5I/AAAAAAAAA3c/FumxvJzrLfg/s400/flickrwall_L.png" alt="" id="BLOGGER_PHOTO_ID_5153901676988248978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8212385978861784135?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8212385978861784135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8212385978861784135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8212385978861784135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8212385978861784135'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/play-with-images-flickr.html' title='Play with images: Flickr image wall'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R4ZRoMgss3I/AAAAAAAAA3M/L71LuwOdxJk/s72-c/flickrtable.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1527924278013743160</id><published>2008-01-08T10:00:00.000-05:00</published><updated>2008-01-08T13:56:37.347-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CountryData'/><title type='text'>Fun with Flags: who have star in their flags?</title><content type='html'>How many countries have at least one star in their flags?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* get flag descriptions of all the countries *)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;desc = {#, CountryData[#, "FlagDescription"] /. _Missing -&gt; ""} &amp;amp; /@ CountryData[];&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;(* select countries which have the "star" *)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;pc = Select[desc, StringCount[#[[2]], "star"] &gt; 0 &amp;amp;];&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;(* take the country name out *)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;cc = pc[[All,1]];&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;(* take all the flags *)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;flags = CountryData[#, "Flag"] &amp;amp; /@ cc;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;(* show all the flags *)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;GraphicsGrid[Partition[flags, {10}], ImageSize -&gt; 800, Frame -&gt; All]&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;There are total 80 countries and areas that have at least one star in their flags.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R4OTQsgssxI/AAAAAAAAA18/EyTzcJaVcXk/s1600-h/starflags.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R4OTQsgssxI/AAAAAAAAA18/EyTzcJaVcXk/s400/starflags.png" alt="" id="BLOGGER_PHOTO_ID_5153124313677476626" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1527924278013743160?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1527924278013743160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1527924278013743160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1527924278013743160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1527924278013743160'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/fun-with-flags.html' title='Fun with Flags: who have star in their flags?'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_0mA_T7sKsO4/R4OTQsgssxI/AAAAAAAAA18/EyTzcJaVcXk/s72-c/starflags.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-3563365846588668710</id><published>2008-01-04T12:58:00.000-05:00</published><updated>2008-01-08T13:57:22.911-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FinancialData'/><title type='text'>Play with Numbers: January Financial Market Performance</title><content type='html'>I am getting curious about the stock market during the lunch time. I like to check the January performance   in the past.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(* define the function to get the January data *)&lt;br /&gt;cc[stock_, year_] := FinancialData[stock, {{year, 1, 1}, {year, 1, 31}}]&lt;br /&gt;(* plot multiyear graphs*)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;Table[DateListPlot[cc["^DJI", year], PlotStyle -&gt; {If[First[Last[#][[2]] - First[#] [[2]] &gt;= 0 &amp;amp; /@ {cc["^DJI", year]}], Green, Red]}, Joined -&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt; True, PlotLabel -&gt; year], {year, 1991, 2006}]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is DOW and NASDAQ January performance from 1991 to 2006. By comparing the first and last trading day, if it gains, the line color is green, otherwise, it is red.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;DOW January Performance (1991~2006)&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0mA_T7sKsO4/R354wcgssvI/AAAAAAAAA1g/zBPj7TOKCkE/s1600-h/JanualDJI.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_0mA_T7sKsO4/R354wcgssvI/AAAAAAAAA1g/zBPj7TOKCkE/s400/JanualDJI.png" alt="" id="BLOGGER_PHOTO_ID_5151687797440819954" border="0" /&gt;&lt;/a&gt;NASDAQ January Performance (1991~2006)&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R355CsgsswI/AAAAAAAAA1o/Mxbd-p0C0cM/s1600-h/JanualNASDAQ.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R355CsgsswI/AAAAAAAAA1o/Mxbd-p0C0cM/s400/JanualNASDAQ.png" alt="" id="BLOGGER_PHOTO_ID_5151688110973432578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You see, Mathematica does come in handy sometime!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-3563365846588668710?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/3563365846588668710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=3563365846588668710' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3563365846588668710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/3563365846588668710'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/play-with-numbers-january-financial.html' title='Play with Numbers: January Financial Market Performance'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0mA_T7sKsO4/R354wcgssvI/AAAAAAAAA1g/zBPj7TOKCkE/s72-c/JanualDJI.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-1000860073231573476</id><published>2008-01-03T10:34:00.001-05:00</published><updated>2008-01-08T22:22:09.273-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Map'/><category scheme='http://www.blogger.com/atom/ns#' term='GraphPlot'/><title type='text'>Overlay GraphPlot on maps</title><content type='html'>&lt;span style="font-style: italic; font-weight: bold;"&gt;GraphPlot&lt;/span&gt; is one of the most interesting and powerful function in Mathematica. Here comes up a simple demonstration to show  how to  overlay the Graph on top of the map. The key is to use &lt;span style="font-style: italic; font-weight: bold;"&gt;VertexCoordinateRules&lt;/span&gt; option to place the each vertex in the right place.&lt;br /&gt;&lt;br /&gt;The following graph is the adjacency graph for countries in South America.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4Q9XsgssyI/AAAAAAAAA2k/7fkey9mnbLo/s1600-h/neighborgrah.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R4Q9XsgssyI/AAAAAAAAA2k/7fkey9mnbLo/s400/neighborgrah.png" alt="" id="BLOGGER_PHOTO_ID_5153311350913282850" border="0" /&gt;&lt;/a&gt;Using the location of capital cities as vertex coordinates seems a good choice. So combining CountryData and CityData, the location list of {country-&gt;{lon, lat of capital city}} is created.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{{"Argentina" -&gt; {-58.37, -34.61}, "Bolivia" -&gt; {-68.15, -16.5}, "Brazil"&lt;/span&gt;&lt;span style="font-style: italic;"&gt; -&gt; {-47.91, -15.78}, "Chile" -&gt; {-70.64, -33.46},  "Colombia" -&gt; {-74.09, 4.63}, "&lt;/span&gt;&lt;span style="font-style: italic;"&gt;Ec&lt;/span&gt;&lt;span style="font-style: italic;"&gt;uador" -&gt; {-78.5, -0.19}, "FrenchGuiana" -&gt; {-52.34, 4.92}, "Guyana" -&gt; {-58.16,&lt;/span&gt;&lt;span style="font-style: italic;"&gt; 6.79},  "Par&lt;/span&gt;&lt;span style="font-style: italic;"&gt;aguay" -&gt; {-57.63, -25.3}, "Peru" -&gt; {-77.05, -12.07}, "Suriname" -&gt; {-55.2, 5.85}, "Uruguay" -&gt; {-56.17, -34.87}, "Venezuela" -&gt; {-66.93, 10.54}}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Redraw the graph with &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;VertexCoordinateRules -&gt; locationlist&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_0mA_T7sKsO4/R30G8cgssuI/AAAAAAAAA1Y/xXnw5THUdG4/s1600-h/newgraph.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_0mA_T7sKsO4/R30G8cgssuI/AAAAAAAAA1Y/xXnw5THUdG4/s400/newgraph.png" alt="" id="BLOGGER_PHOTO_ID_5151281184296973026" border="0" /&gt;&lt;/a&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;Then show it with the map&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0mA_T7sKsO4/R4Q9jcgsszI/AAAAAAAAA2s/SSseVd-UOhk/s1600-h/graphoverlay.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 267px; height: 375px;" src="http://4.bp.blogspot.com/_0mA_T7sKsO4/R4Q9jcgsszI/AAAAAAAAA2s/SSseVd-UOhk/s400/graphoverlay.png" alt="" id="BLOGGER_PHOTO_ID_5153311552776745778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;It is kind of silly in certain way to overlap the adjacency graph on top of the map. However, the graph delivers the information more clearly, you can spot it immediately that Brazil has the largest number of neighbors in South America.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-1000860073231573476?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/1000860073231573476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=1000860073231573476' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1000860073231573476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/1000860073231573476'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/overlay-graphplot-on-maps.html' title='Overlay GraphPlot on maps'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_0mA_T7sKsO4/R4Q9XsgssyI/AAAAAAAAA2k/7fkey9mnbLo/s72-c/neighborgrah.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-7022131374492295918</id><published>2008-01-01T17:19:00.000-05:00</published><updated>2008-01-08T13:58:16.898-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>Check weather with Mathematica</title><content type='html'>&lt;span style="font-style: italic;"&gt;wxml = Import["http://www.weather.gov/data/current_obs/KBMG.xml", &lt;/span&gt; &lt;span style="font-style: italic;"&gt;   "XML"];&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;First[Cases[wxml, XMLElement[#, _, {w_}] :&gt; w, &lt;/span&gt;&lt;span style="font-style: italic;"&gt;Infinity]]  &amp;amp; /@  {"weather", "observation_time"}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{"Light Snow", "Last Updated on Jan 1, 4:53 pm EST"}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-7022131374492295918?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/7022131374492295918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=7022131374492295918' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7022131374492295918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/7022131374492295918'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2008/01/check-weather-with-mathematica.html' title='Check weather with Mathematica'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5316462986483650877.post-8903757501895217151</id><published>2007-12-31T20:50:00.001-05:00</published><updated>2008-01-24T15:51:08.162-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Image'/><title type='text'>Happy New Year 2008: in security image way</title><content type='html'>ArrayPlot[ReplacePart[Rasterize[Framed["HAPPY NEW YEAR 2008"], "RGBColor", ImageSize-&gt;300, Background-&gt;LightYellow], Table[RandomInteger[{1,350},2] -&gt; Hue[RandomReal[1]], {30000}]], Frame-&gt;False]&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_0mA_T7sKsO4/R3mc58gssqI/AAAAAAAAAzY/G6K8xm67oDQ/s1600-h/happynewyear.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_0mA_T7sKsO4/R3mc58gssqI/AAAAAAAAAzY/G6K8xm67oDQ/s400/happynewyear.png" alt="" id="BLOGGER_PHOTO_ID_5150320168184623778" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5316462986483650877-8903757501895217151?l=mathgis.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathgis.blogspot.com/feeds/8903757501895217151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5316462986483650877&amp;postID=8903757501895217151' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8903757501895217151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5316462986483650877/posts/default/8903757501895217151'/><link rel='alternate' type='text/html' href='http://mathgis.blogspot.com/2007/12/happy-new-year-2008-in-security-image.html' title='Happy New Year 2008: in security image way'/><author><name>mathphobia</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/img/61/5770/320/profile.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_0mA_T7sKsO4/R3mc58gssqI/AAAAAAAAAzY/G6K8xm67oDQ/s72-c/happynewyear.png' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
