<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>MapQuest Actionscript 3.0 Learning and Blogging</title>
	<atom:link href="http://mqguru.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mqguru.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 19 Oct 2009 20:58:13 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='mqguru.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/46ddec8bd3fa6f292d0b3deb2a5cc5b6?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>MapQuest Actionscript 3.0 Learning and Blogging</title>
		<link>http://mqguru.wordpress.com</link>
	</image>
			<item>
		<title>Zooming like a big boy</title>
		<link>http://mqguru.wordpress.com/2009/10/19/zooming-like-a-big-boy/</link>
		<comments>http://mqguru.wordpress.com/2009/10/19/zooming-like-a-big-boy/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 20:58:13 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[centering]]></category>
		<category><![CDATA[zooming]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/2009/10/19/zooming-like-a-big-boy/</guid>
		<description><![CDATA[Wow, so I have had a ticket sitting in my queue for some time now that I didn&#8217;t think would be easy.  What we had to do was to Zoom in the user but leave the location of the Zoom in the same place it was on the map.  After much thinking (about [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=48&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Wow, so I have had a ticket sitting in my queue for some time now that I didn&#8217;t think would be easy.  What we had to do was to Zoom in the user but leave the location of the Zoom in the same place it was on the map.  After much thinking (about two hours) I came up with my solution.  </p>
<p>The principle is simple.  Figure out where the users mouse is.  Get the XY, zoom in figure out what LatLng is in that XY Position, get the difference.  Then apply the difference to center point and set the new center point.  </p>
<p>public function zoomMapKeepingXYCoords():void<br />
{<br />
	var mouseXY:IPointXY = new PointXY(myMap.mouseX, myMap.mouseY);<br />
	var mouseLL:IPointLL = myMap.pixToLL(new PointXY(myMap.mouseX, myMap.mouseY))<br />
	setZoom(myMap.getZoomLevel() + 1);<br />
	var newLLatXY:IPointLL = myMap.pixToLL(mouseXY);<br />
	var latDiff:Number = mouseLL.lat &#8211; newLLatXY.lat;<br />
	var lngDiff:Number = mouseLL.lng &#8211; newLLatXY.lng;<br />
	var centerAftZoom:IPointLL = myMap.getCenter();<br />
	var newCenter:IPointLL = new PointLL(myMap.getCenter().lat + latDiff,myMap.getCenter().lng + lngDiff );<br />
	myMap.setCenter(newCenter);</p>
<p>}</p>
<p>Have Fun!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=48&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2009/10/19/zooming-like-a-big-boy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
		<item>
		<title>Clear out the Clutter (Decluttering POIs)</title>
		<link>http://mqguru.wordpress.com/2009/08/07/clear-out-the-clutter-decluttering-pois/</link>
		<comments>http://mqguru.wordpress.com/2009/08/07/clear-out-the-clutter-decluttering-pois/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 19:28:13 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[POI]]></category>
		<category><![CDATA[mapquest]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=46</guid>
		<description><![CDATA[Ok, so this post probably won't be long because this is so super simple!  So first the atta boy to MapQuest for making this so simple.  Now lets look at what it takes.  myMap.getDeclutterMode().setDeclutterMode(2);<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=46&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ok, so this post probably won&#8217;t be long because this is so super simple!  So first the atta boy to MapQuest for making this so simple.  Now lets look at what it takes.</p>
<p>The tilemap is what actually need the setting done, so in your code you can say:</p>
<p>myMap.getDeclutterMode().setDeclutterMode(2);<br />
<span style="color:#339966;"><em>//you can also use 1 but in my opinion 2 looks much more intuitive.  0 will set it back to no decluttering </em></span></p>
<p>So on the baseline that is it.  So if you extend the map you can actually catch some neat functionality.  Do the following to get a neat declutter when hitting a specific zoom level or breaking a zoom level barrier.  A quick word of advice.  Declutter in mode 2 might make the flash player take longer than hoped on large data sets.  If this is the case you might want to do something like below or even turn off deluttering when retrieving POIs then turn it on once you put them on the map.  I found that it took the player some significant time to show the POIs when I have too many POIs. </p>
<p><span style="font-size:x-small;color:#009900;"><font size="2" color="#009900"></p>
<p align="left"><em>/* This function will turn on decluttering of the pois when the zoom levels reach optimal position. */<br />
</em></p>
<p></font></span></p>
<p align="left"><strong><em><span style="font-size:x-small;color:#0033ff;">public</span><span style="font-size:x-small;"> </span></em><strong><em><span style="font-size:x-small;color:#339966;">function</span><span style="font-size:x-small;"> setDeclutterByZoom(e:TileMapEvent):</span></em><strong><span style="font-size:x-small;color:#0033ff;"><em>void<br />
</em></span><span style="font-size:x-small;"><em>{<br />
</em></span><strong><em><span style="font-size:x-small;color:#0033ff;">if</span><span style="font-size:x-small;">(</span></em><strong><em><span style="font-size:x-small;color:#0033ff;">this</span><span style="font-size:x-small;">.getZoomLevel() &gt;= 7)</span></em><strong><span style="font-size:x-small;color:#0033ff;"><em>this</em></span><span style="font-size:x-small;"><em>.getDeclutter().setDeclutterMode(2);<br />
</em></span><strong><span style="font-size:x-small;color:#0033ff;"><em>else<br />
</em></span><strong><span style="font-size:x-small;color:#0033ff;"><em>this</em></span><span style="font-size:x-small;"><em>.getDeclutter().setDeclutterMode(0);<br />
</em></span></strong><strong><strong><span style="font-size:x-small;color:#0033ff;"><em>return<br />
}</em></span></strong></strong></strong></strong></strong></strong></strong></strong></strong></p>
<p align="left"><span style="color:#000000;">Like I said before I like to use 2 because it looks much easier to the users I have.  </span></p>
<p align="left"><span style="color:#000000;">If your users like this then you might want to also grab the dragable ability of the POIs.  But if you have a complex application you might run into a problem if you are running an event listener on a mouseup, mousedown or something of that nature on the map.  I was doing that because it was the simple thing at the time because I was waiting for a Click For Drag so I could recenter my map.  So I made sure I moved that event and it worked flawlessly.  Just add the following line to your POI.</span></p>
<p><span style="font-size:x-small;"></p>
<p align="left">myPoi.setDraggable(<span style="color:#0000ff;"><strong>true</strong></span>);</p>
<p>You can also add use this function to let your users drop those POIs where ever they want.  Just drag and drop, all done!   <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <br />
myPoi.setSnapback(<strong><span style="color:#0000ff;">false</span>);</strong></p>
<p align="left"><strong>This is pretty striaght forward stuff, but really watch you events as it will have some crazy interaction with the POI dragability. </p>
<p></strong></p>
<p></span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=46&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2009/08/07/clear-out-the-clutter-decluttering-pois/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
		<item>
		<title>More Java Topology Suite.</title>
		<link>http://mqguru.wordpress.com/2009/03/09/more-java-topology-suite/</link>
		<comments>http://mqguru.wordpress.com/2009/03/09/more-java-topology-suite/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 13:23:14 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=43</guid>
		<description><![CDATA[So one of my colleagues  whom is heavily involved in our current mapping project has been working with our polygons and trying to come up with some different solutions to make things faster, more scalable and workable.  I networked with several people to try to find some fast easy workarounds and thanks to a couple [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=43&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So one of my colleagues  whom is heavily involved in our current mapping project has been working with our polygons and trying to come up with some different solutions to make things faster, more scalable and workable.  I networked with several people to try to find some fast easy workarounds and thanks to a couple of them pointing the way we were able to accomplish some things.  With that, we loved the Java Topology Suite.  Check out this post on the JTS and how we made things work. </p>
<p><a href="http://webmonkeyswithlaserbeams.wordpress.com/2009/03/04/the-sweet-java-topology-suite-part-ii/">http://webmonkeyswithlaserbeams.wordpress.com/2009/03/04/the-sweet-java-topology-suite-part-ii/</a></p>
<p>Enjoy</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=43&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2009/03/09/more-java-topology-suite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding and Removing the same POIs</title>
		<link>http://mqguru.wordpress.com/2009/01/12/adding-and-removing-the-same-pois/</link>
		<comments>http://mqguru.wordpress.com/2009/01/12/adding-and-removing-the-same-pois/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 16:43:30 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[POI]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=39</guid>
		<description><![CDATA[Adding and removing the same POIs over and over again doesn't perform as I expected.  To get rid of all the POIs you need to use the removeAllPois() function.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=39&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So we have the situation where we will want to add and remove the same set of POIs on the map at any given time.  One issue we are having with that is a problem with the AS3 function on the map called removePOI(poi).  The function will remove it visually from the map, but the map still has the object reference in it&#8217;s memory.  So if try to add the POI once it has been added then removed, the map will add it with the same key, as it should, but you will get an error if you try to remove it.  I have not seen any fixes in the unsupported version for Flex either. </p>
<p>So to clerify: <br />
<span style="font-size:x-small;">myMap.removeShape(myMap.getByKey(shapeId));<br />
     AND<br />
<span style="font-size:x-small;">myMap.removePoi(Poi(myMap.getByKey(shapeId)));</span></span></p>
<p><span style="font-size:x-small;">will only visually remove the POI object from the map, not relationally (physically)  </span></p>
<p><span style="font-size:x-small;">However, the function myMap.removeAllPois() will remove all of the POIs from the map in every way.  The map no longer has a reference to them at all.  That works out well, if you can remove all of the POIs.  The problem comes in when you only need to remove a couple.  </span></p>
<p><span style="font-size:x-small;">WORK AROUND:</span></p>
<div><strong><span style="font-size:x-small;color:#0033ff;"><strong></strong></span></strong></div>
<p><strong><span style="font-size:x-small;color:#0033ff;"><strong><span style="font-size:x-small;color:#0033ff;"></p>
<p align="left">if<span style="font-size:x-small;"><span style="color:#000000;">(showTypePoi())<br />
</span></span><span style="color:#000000;"><span style="font-size:x-small;">{<br />
     </span><strong><span style="font-size:x-small;">if</span></strong><span style="font-size:x-small;">(myMap.getByKey(myPoi.id) == </span><strong><span style="font-size:x-small;">null</span></strong></span><span style="font-size:x-small;"><span style="color:#000000;">)</span><span style="color:#00ff00;"><em>//if it is not on the map put it on<br />
</em></span>          <span style="color:#000000;">addPoi(myPoi);</span><br />
</span><span style="font-size:x-small;color:#0033ff;"><strong>     else</strong><span style="color:#00ff00;"><em>//map still has reference just show the object</em></span><br />
          </span><span style="font-size:x-small;"><span style="color:#000000;">Poi(myMap.getByKey(myPoi.id)).draw();<br />
}</span><br />
</span><span style="font-size:x-small;color:#0033ff;"><strong>else</strong><span style="color:#00ff00;"><em>//remove it from the map</em></span><br />
</span><span style="font-size:x-small;"><span style="color:#000000;">{<br />
     myMap.removeShape(myMap.getByKey(myPoi.id));<br />
}</span></span></p>
<p></span></strong></span></strong></p>
<p align="left"> </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=39&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2009/01/12/adding-and-removing-the-same-pois/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
		<item>
		<title>Extending the TileMap &amp; some components</title>
		<link>http://mqguru.wordpress.com/2009/01/08/extending-the-tilemap-some-components/</link>
		<comments>http://mqguru.wordpress.com/2009/01/08/extending-the-tilemap-some-components/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 19:18:46 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[extending components]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[mapquest]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=36</guid>
		<description><![CDATA[Quick overview of what you can do by extending some of the MapQuest Components.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=36&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So we had an issue arrise.  Well we always have issues, but this time it was very needed.  We have users that need to manipulate a group of polygon overlays all at one time.  So we needed a fun little package to put them in.  We added this cool new Object that just Extended the Polygon Overlay.  This worked out handy to package them up, but then we needed a way to quickly work with them and add them to the map, move them off at the same time, or do other things of this nature as a collective group.  So we Extended the TileMap.  This was easy and all we did was to make a couple of functions that would take the New Object that we made and apply all the overlays that were in the object to the map.  This worked out really well.  So now we can add and remove them.  But we also have another problem.</p>
<p>The tilemap has Overlays and they have a Key.  This is good, but the key can be the same, and if you use the function getByKey, it would only return you one, of the possibly many items that were there.  Not good for us, or anyone really, but we needed to fix this.  Well since we are working with our own object, then we can go ahead and write it so we do something like this.</p>
<p>A new Shape Collection which has a function like this:</p>
<p> public function getMultipleByKey(key:String):Array<br />
{<br />
      var a:Array = new Array();<br />
      var i:int = 0;</p>
<p>      if(this.sc.get(0) is PolygonOverlay)<br />
      {<br />
            for(i=0; i&lt;this.sc.getSize(); i++)<br />
            {<br />
                          if(PolygonOverlay(this.sc.get(i)).getKey() == key)<br />
                                     a.push(PolygonOverlay(this.sc.get(i)));<br />
             }<br />
         }</p>
<p>          if(this.sc.get(0) is Poi)<br />
         {<br />
                 for(i=0; i&lt;this.sc.getSize(); i++)<br />
                 {<br />
                          if(Poi(this.sc.get(i)).getKey() == key)<br />
                                    a.push(Poi(this.sc.get(i)));<br />
                   }<br />
           }</p>
<p> return a<br />
}</p>
<p>So in the case above, we can call this function and it will get us a shape collection of the multiple items that we wanted.  You don&#8217;t have to extend the map to get this functionality, just the ShapeCollection.  We extended a few of the common object we use readily.  This is one of the many things that we have done.  I will try to post some more about what we have done as i see the community might like to know.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=36&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2009/01/08/extending-the-tilemap-some-components/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
		<item>
		<title>Welcome to Cali</title>
		<link>http://mqguru.wordpress.com/2008/11/16/welcome-to-cali/</link>
		<comments>http://mqguru.wordpress.com/2008/11/16/welcome-to-cali/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 19:13:57 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=33</guid>
		<description><![CDATA[Well, I made it to Cali this weekend.  I am hanging out at a starbucks right now just trying to get everything together.  should be checking out Max tonight sometime.  If you are at MAX come look around the MapQuest booth, i will probably be torchering the MapQuest guys.  Hope you have a great week.  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=33&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well, I made it to Cali this weekend.  I am hanging out at a starbucks right now just trying to get everything together.  should be checking out Max tonight sometime.  If you are at MAX come look around the MapQuest booth, i will probably be torchering the MapQuest guys.  Hope you have a great week.  I will try to check in a couple times while I am here and give some thoughts on how Max will help our program.  Also check out the MapQuest booth as a small part of my project is on their demo site.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=33&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2008/11/16/welcome-to-cali/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
		<item>
		<title>Learning how to draw.</title>
		<link>http://mqguru.wordpress.com/2008/09/05/learning-how-to-draw/</link>
		<comments>http://mqguru.wordpress.com/2008/09/05/learning-how-to-draw/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 22:19:40 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=30</guid>
		<description><![CDATA[Wow, this post is making me feel like i am back in kindergarten.  Let&#8217;s learn how to draw, first take your pencil and a piece of paper an&#8230; well i tried that, now it&#8217;s hard to read the other stuff on the monitor!  Ok, well so I have taught myself how to draw a line [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=30&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="font-size:10pt;color:black;font-family:Verdana;">Wow, this post is making me feel like i am back in kindergarten.  Let&#8217;s learn how to draw, first take your pencil and a piece of paper an&#8230; well i tried that, now it&#8217;s hard to read the other stuff on the monitor!  Ok, well so I have taught myself how to draw a line over the last couple of days and i have learned a couple of things.  It is easy to draw a line, only took me about 8 hours to get the rough cut, then another 8 to tweak it a bit.  I would suggest understanding it by first checking out the LineOverlay and the single line points. </span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:black;font-family:Verdana;">STEP 1:  Drawing a simple line on the screen</span></strong><span style="font-size:8.5pt;color:black;font-family:Verdana;"><br />
</span><span style="font-size:10pt;color:black;font-family:Verdana;">oh, I am not going to give you the code, just the advice like before, draw something simple, all you really need is two LatLng&#8217;s, LatLngCollection,IPointLLCollection and a LineOverlay.  Ok i am a sucker, so here is a little help:<br />
</span><em><span style="font-size:10pt;color:#009900;font-family:&quot;">//first get LatLng1 &amp; LatLng2 as LatLngs with accurate values</span></em><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><em><span style="font-size:10pt;color:#009900;font-family:&quot;">//then persue the rest of the following</span></em><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> line:LineOverlay = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> LineOverlay();</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">private</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> linePointCollection:LatLngCollection = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> LatLngCollection();</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">linePointCollection.add(LatLng1);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">linePointCollection.add(LatLng2);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> myIpColl:IPointLLCollection = linePointCollection;</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">line.setShapePoints(myIpColl);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p><span style="font-size:10pt;color:black;font-family:&quot;">myMap.addOverlay(line);</span><span style="font-size:10pt;color:black;font-family:Verdana;"></p>
<p>something like that should get your first version working on the map.  </span><span style="font-size:8.5pt;color:black;font-family:Verdana;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;">So let’s think about doing something a little more productive now.<span>  </span>Let’s actually make an Object that will take in some information and do the heavy lifting and we can move the code off and really do some cool stuff with making a line.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;">Making the Object:</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;">Let start out making our class</span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#9900cc;font-family:&quot;">Package</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> ActionScript</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">{</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0 0 0 0.5in;"><em><span style="font-size:10pt;color:#009900;font-family:&quot;">/*This object will be created to get you a Line to draw or display on the map the user can have a distance for the line.<span>    </span>*/</span></em><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span></span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">import</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> com.mapquest.*;</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span></span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">import</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> com.mapquest.tilemap.overlays.LineOverlay;</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span></span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">import</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> com.mapquest.tilemap.pois.Poi;</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span></span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">import</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> mx.collections.ArrayCollection;</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span></span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span></span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">public</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#9900cc;font-family:&quot;">class</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> LineMaker</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;">So all of the stuff up there look familiar?<span>  </span>Well I hope so, I will not spend time talking about it.<span>  </span>Now lets make a couple private variables so we can have a start and end to the line</span></p>
<p class="MsoNormal" style="text-indent:0.5in;margin:0 0 0 0.5in;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">private</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> startPosition:Poi;</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>            </span></span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">private</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> endPosition:Poi;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">Please notice these are POI’s.<span>  </span>This is a good way to start if you want MapQuest to get you some LatLng’s so you can put some simple ones one the board to start.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">private</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> arrLinePoints:ArrayCollection = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> ArrayCollection();</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">private</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> linePointCollection:LatLngCollection = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> LatLngCollection();</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">private</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> line:LineOverlay = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> LineOverlay();</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">private</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> totalDistance:Number = 0.0;</span></p>
<p class="MsoNormal" style="margin:0;"><em><span style="font-size:10pt;color:#009900;font-family:&quot;">//&#8230;the end of the function would be down past all the cool code</span></em></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">Now we added the above to make sure we can insert LatLng’s at any point of the Object, get the total distance of the users line, and also to have the items to make a line.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;">Now you could add some public functions that would allow the user to create a line with two points, so you can do it quickly.<span>  </span>Send a POI to strip out the LatLng into the ArrayCollection.<span>  </span>Add a LatLng to the Array collection.<span>  </span>That should be a good start.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;">Now you will need to also be able to make the lineOverlay, retrieve the line overlay, get the distance of the line, retrieve the distance of the line, and probably 1,000’s of others.<span>  </span>Those are my basics for the LineObject.<span>  </span>I also have a function that will keep changing the last items of the array so you can see what the calculations and placement of the new line would be.<span>  </span>Ok, let’s get to the part where we put the line on the screen.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;">The following function can be implemented when a person clicks a draw button or whatever you like.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;">So there are some public functions like this.</span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">public</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> myLine:LineObject = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> LineObject();</span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;"> </span></strong></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">public</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#339966;font-family:&quot;">function</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> doDraw():</span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">void</span></strong><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">{</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">if</span></strong><span style="font-size:10pt;color:black;font-family:&quot;">( btnLine.label == </span><strong><span style="font-size:10pt;color:#990000;font-family:&quot;">&#8216;Draw Line&#8217;</span></strong><span style="font-size:10pt;color:black;font-family:&quot;">)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:&quot;">{</span></p>
<p class="MsoNormal" style="margin:0;"><em><span style="font-size:10pt;color:#009900;font-family:&quot;">//we can add the click event to the map when they click the button</span></em></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">myMap.addEventListener(MouseEvent.CLICK, getAddPoint,</span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">true</span></strong><span style="font-size:10pt;color:black;font-family:&quot;">);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">}</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">else</span></strong><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">{</span></p>
<p class="MsoNormal" style="margin:0;"><em><span style="font-size:10pt;color:#009900;font-family:&quot;">//we can remove our added listeners</span></em><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">myMap.removeEventListener(MouseEvent.CLICK, getAddPoint,</span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">true</span></strong><span style="font-size:10pt;color:black;font-family:&quot;">);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">myMap.removeEventListener(MouseEvent.MOUSE_MOVE,tempLineDraw,</span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">true</span></strong><span style="font-size:10pt;color:black;font-family:&quot;">);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">}</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin:0;"><em><span style="font-size:10pt;color:#009900;font-family:&quot;">/*this function would add a point every time the mouse is clicked.<span>  </span>It also adds an event to the map that will keep us up to date on where the user is pointing the mouse*/</span></em><span style="font-size:10pt;color:black;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">public</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#339966;font-family:&quot;">function</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> getAddPoint(e:MouseEvent):</span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">void</span></strong><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">{</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> pntXY:PointXY = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> PointXY(myMap.mouseX,myMap.mouseY);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> iPoint:IPointXY = pntXY;</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> ll:LatLng = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> LatLng(myMap.pixToLL(iPoint).lat,myMap.pixToLL(iPoint).lng)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">myLine.addLatLng(ll);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">if</span></strong><span style="font-size:10pt;color:black;font-family:&quot;">(myLine.getNumberPoints() &gt; 1)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">{</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span></span><em><span style="font-size:10pt;color:#009900;font-family:&quot;">/*for this version we can just remove all other overlays, but you will want to point to this specific one, so it might be worth it to have your cool LineObject<span>  </span>tell you it’s previous state.*/</span></em><span style="font-size:10pt;color:black;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="text-indent:0.5in;margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">myMap.removeAllOverlays();</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span>myMap.addOverlay(myLine.getLine());</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;"><span>      </span>currentCenterOfMap = myMap.getCenter();</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">}</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">else</span></strong><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">{</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">myMap.addEventListener(MouseEvent.MOUSE_MOVE,tempLineDraw,</span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">true</span></strong><span style="font-size:10pt;color:black;font-family:&quot;">);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">} <span>    </span><span>    </span><span>  </span></span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">}</span></p>
<p class="MsoNormal" style="margin:0;"><em><span style="font-size:10pt;color:#009900;font-family:&quot;">/*this function tells us where the user is pointing the map and then it updates our cool little LineObject so it keeps the line information up to date.*/</span></em></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">public</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> </span><strong><span style="font-size:10pt;color:#339966;font-family:&quot;">function</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> tempLineDraw(e:MouseEvent):</span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">void</span></strong><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">{</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> pntXY:PointXY = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> PointXY(myMap.mouseX,myMap.mouseY);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> iPoint:IPointXY = pntXY;</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#6699cc;font-family:&quot;">var</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> ll:LatLng = </span><strong><span style="font-size:10pt;color:#0033ff;font-family:&quot;">new</span></strong><span style="font-size:10pt;color:black;font-family:&quot;"> LatLng(myMap.pixToLL(iPoint).lat,myMap.pixToLL(iPoint).lng)</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">myLine.replaceLast(ll);</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">myMap.addOverlay(myLine.getLine());</span><span style="font-size:10pt;font-family:&quot;"></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">}</span></p>
<p class="MsoNormal" style="margin:0;"> </p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:&quot;">So this should get your motor cranking and off to a good start drawing.  I am still having a really hard time getting the line to follow the cursor.  I have seen a great set of tools over at:  <a href="http://sxsw.mapquest.com/Web_JavaScriptSamples/customcontrols.html">http://sxsw.mapquest.com/Web_JavaScriptSamples/customcontrols.html</a> and the rectangle, circle and line are exactly what I am looking to do in AS3 and Flex 3, but I am having a hard time like i said getting the line to follow.  I might get it if i spend another few hours on it, but if you have a tip or suggestion about it, feel free to let me know.    </span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mqguru.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mqguru.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=30&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2008/09/05/learning-how-to-draw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
		<item>
		<title>How To Give the User A Choice of POI&#8217;s</title>
		<link>http://mqguru.wordpress.com/2008/08/28/how-to-give-the-user-a-choice-of-pois/</link>
		<comments>http://mqguru.wordpress.com/2008/08/28/how-to-give-the-user-a-choice-of-pois/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 16:02:18 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[POI]]></category>
		<category><![CDATA[flash mapping]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[MXML Component]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=23</guid>
		<description><![CDATA[Ok, so I have some code that I would love to share with you fellow AS3 developers.  I have been playing over that last few days with some of the new features in the 5.3 version of MQAPI for AS3 and I made a custom mxml component.  This is a very simple component, and will allow the users [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=23&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ok, so I have some code that I would love to share with you fellow AS3 developers.  I have been playing over that last few days with some of the new features in the 5.3 version of MQAPI for AS3 and I made a custom mxml component.  This is a very simple component, and will allow the users to see county and state of multiple POI&#8217;s that are returned from a GeoCode search.  Of course if you want them to see something else, well you can change it, but at least this will give you a start. </p>
<p><a href="http://mqguru.files.wordpress.com/2008/08/custom_component_pic.jpg"></a><img class="alignnone size-medium wp-image-25" src="http://mqguru.files.wordpress.com/2008/08/custom_component_pic1.jpg?w=300&#038;h=166" alt="" width="300" height="166" /><br />
So the first thing you will need is something that contains a locationCollection you could just do a search so you can load this thing up:</p>
<p>private function getChoice(lc:LocationCollection,pc:PoiCreator):int<br />
{<br />
   var choicePanel:PoiChoices = new PoiChoices();<br />
   choicePanel.lc = lc;<br />
   choicePanel.parentMap = myMap.getTileMap();<br />
   Application.application.addChild(choicePanel);<br />
}<br />
this should open the panel and allow you to do what you need to do.</p>
<p>Breakdown of the code</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br />
&lt;mx:Panel xmlns:mx=&#8221;<a href="http://www.adobe.com/2006/mxml">http://www.adobe.com/2006/mxml</a>&#8221; layout=&#8221;absolute&#8221; x=&#8221;50&#8243; y=&#8221;5&#8243; width=&#8221;400&#8243; height=&#8221;300&#8243; creationComplete=&#8221;init();&#8221;&gt;<br />
  &lt;mx:VBox id=&#8221;main&#8221; width=&#8221;100%&#8221; height=&#8221;100%&#8221;  horizontalScrollPolicy=&#8221;off&#8221; verticalScrollPolicy=&#8221;off&#8221;&gt;<br />
   &lt;mx:VBox id=&#8221;choiceHolder&#8221; width=&#8221;100%&#8221; height=&#8221;100%&#8221; /&gt;<br />
   &lt;mx:Button id=&#8221;closeChoices&#8221; click=&#8221;this.parent.removeChild(this);&#8221; label=&#8221;Close&#8221;/&gt;<br />
  &lt;/mx:VBox&gt;<br />
 &lt;mx:Script&gt;<br />
  &lt;![CDATA[<br />
//here we just import everything that we need to use<br />
   import com.mapquest.tilemap.ShapeCollection;<br />
   import com.mapquest.tilemap.TileMap;<br />
   import mx.core.Application;<br />
   import com.mapquest.tilemap.pois.Poi;<br />
   import mx.controls.CheckBox;<br />
   import ActionScript.PoiCreator;<br />
   import mx.controls.Alert;<br />
   import com.mapquest.*;<br />
   import com.mapquest.LocationCollection;<br />
//we set a couple things so you can send in the information to build it<br />
   [Bindable] public var lc:LocationCollection = new LocationCollection();<br />
//we need to pass a reference to the map so this thing can show the POIs on the map<br />
   [Bindable] public var parentMap:TileMap;<br />
   public var currentPoiChoice:Poi;<br />
   //public var blnPauseMouseOvers:Boolean = false;<br />
   //this function acutally makes all the items to build this guy, it loops over the collection and builds the items in code.  this reduces possible erros<br />
   public function init():void<br />
   {<br />
    this.title = &#8216;Point Of Interest Choices (&#8216;+lc.getSize()+&#8217;)';<br />
    for(var i:int =0;i &lt; lc.getSize();i++)<br />
    {<br />
     var myChk:CheckBox = new CheckBox();<br />
     myChk.label = GeoAddress(lc.get(i)).getCounty()+&#8217;/'+GeoAddress(lc.get(i)).getState();<br />
     myChk.name = i.toString();<br />
     choiceHolder.addChild(myChk);<br />
//adding listeners so if the user hovers over the item, it shows on the map and removes when they leave it<br />
     myChk.addEventListener(MouseEvent.MOUSE_OVER,tempPlacePoi,false);<br />
     myChk.addEventListener(MouseEvent.MOUSE_OUT,removePOI,false);<br />
//if the user checks/unchecks it, a function removes or keeps it displayed<br />
     myChk.addEventListener(MouseEvent.CLICK,checkPoi,false);<br />
    }<br />
   }<br />
   <br />
   private function checkPoi(e:MouseEvent):void<br />
   {<br />
    if(CheckBox(e.currentTarget).selected)<br />
    {<br />
     CheckBox(e.currentTarget).removeEventListener(MouseEvent.MOUSE_OUT,removePOI,false);<br />
     currentChoice = int(e.currentTarget.name);<br />
     placePoi(currentChoice);<br />
    }<br />
    else<br />
    {<br />
     var GeoA:GeoAddress = lc.getAt(int(e.currentTarget.name));<br />
     var shpColMapPois:ShapeCollection = parentMap.getPois();<br />
     for(var i:int = 0;i &lt; shpColMapPois.getSize();i++)<br />
     {<br />
      if(Poi(shpColMapPois.get(i)).getLatLng().lat == GeoA.getLatLng().lat &amp;&amp; Poi(shpColMapPois.get(i)).getLatLng().lng == GeoA.getLatLng().lng)<br />
      {<br />
       parentMap.removePoi(Poi(shpColMapPois.get(i)));<br />
      }<br />
     }<br />
     CheckBox(e.currentTarget).addEventListener(MouseEvent.MOUSE_OUT,removePOI,false);<br />
    }<br />
   }<br />
   //this prepares to put it on the map on hover<br />
   private function tempPlacePoi(e:MouseEvent):void<br />
   {<br />
    currentChoice = int(e.currentTarget.name);<br />
    placePoi(currentChoice);<br />
   }<br />
//this function acutally creates the POI it on the map<br />
   private function placePoi(intItem:int):void<br />
   {<br />
//the PoiCreator is a AS3 object that i have made to display a POI with information you pass it.<br />
    var poiC:PoiCreator = new PoiCreator();<br />
    var GeoA:GeoAddress = lc.getAt(intItem);<br />
    poiC.createPoiGeoAddress(GeoA,this.addPoiToMap,null,&#8217;&lt;br/&gt;Address:&lt;br/&gt;&#8217;+GeoA.getStreet()+&#8217;&lt;br/&gt;&#8217;+GeoA.getCity()+&#8217;, &#8216;+GeoA.getState()+GeoA.getPostalCode());<br />
   }<br />
   //this function removes the item from the map when the user is no longer hovering over<br />
   private function removePOI(e:MouseEvent):void<br />
   {<br />
    parentMap.removePoi(currentPoiChoice);<br />
   }<br />
//this actually adds the items to the map<br />
   public function addPoiToMap(p:Poi):void<br />
   {<br />
    parentMap.addPoi(p);<br />
    currentPoiChoice = p;<br />
   }<br />
  ]]&gt;<br />
 &lt;/mx:Script&gt;<br />
&lt;/mx:Panel&gt;</p>
<p>The only other thing that you would need is my custom POI object, which is simple, it does the geoCoding for me if i need it, or it just makes the POI with information passed and returns the POI, you could just have something that does all that.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mqguru.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mqguru.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=23&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2008/08/28/how-to-give-the-user-a-choice-of-pois/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>

		<media:content url="http://mqguru.files.wordpress.com/2008/08/custom_component_pic1.jpg?w=300" medium="image" />
	</item>
		<item>
		<title>Back to Mapping, YAY!</title>
		<link>http://mqguru.wordpress.com/2008/08/21/back-to-mapping-yay/</link>
		<comments>http://mqguru.wordpress.com/2008/08/21/back-to-mapping-yay/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 22:09:30 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[mapping]]></category>
		<category><![CDATA[mapquest]]></category>
		<category><![CDATA[flex 3]]></category>
		<category><![CDATA[MapQuest 5.3 API]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=21</guid>
		<description><![CDATA[Way to go MapQuest, your new API is much faster while running with Flex 3<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=21&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well now that phase 1 has been complete, it is time to start the second phase of the mapping application that I have been blogging about.  So to do so, we have upgraded.  Not only from the older mapquest 5.2 API to the new MapQuest 5.3 API but also to Flex 3 from Flex 2!!  So today, I took my new flex 3 mapping project, empty canvas, and just threw the map on the screen.  Now, I am not running the swiftest computer out there&#8230; although that is soon to change, but it does good at getting the job done.  The first thing I noticed was how much faster the load time was to put the map on the screen.  It improved enough that I noticed it before looking at the other version I have out there.  I have to say, this next thing I am impressed with, I noticed that the map moved much more fluidly than it did before.  Same machine, same setup, except now using Flex 3 and MQ 5.3.  I don&#8217;t get that long loading grey screen of wait any longer, and those loading blocks have dwindled to few at the edges.  Before, the whole screen flashed, now just a couple blocks!!  Way to go MAPQUEST!  This is exciting to me.  My users will be able to get things much faster now than before.  I will be exploring the next couple of days what I can do with the new setup.  Thanks MapQuest for the new upgrades in performance.  Even now, just the little I have seen with the map alone, I am excited.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mqguru.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mqguru.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=21&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2008/08/21/back-to-mapping-yay/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
		<item>
		<title>6 month revist</title>
		<link>http://mqguru.wordpress.com/2008/05/16/6-month-revist/</link>
		<comments>http://mqguru.wordpress.com/2008/05/16/6-month-revist/#comments</comments>
		<pubDate>Fri, 16 May 2008 19:42:38 +0000</pubDate>
		<dc:creator>mqguru</dc:creator>
				<category><![CDATA[flash mapping]]></category>
		<category><![CDATA[mapquest]]></category>

		<guid isPermaLink="false">http://mqguru.wordpress.com/?p=19</guid>
		<description><![CDATA[OK, well i want to spend a little time talking about the project I just finished with making MapQuest Flash Maps in flex.
Project Refresher:
This project was to bring in demographics data and other informational data per zip code from internal systems, and using those choice zip codes to display zip code polygons on the map, somewhere [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=19&subd=mqguru&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>OK, well i want to spend a little time talking about the project I just finished with making MapQuest Flash Maps in flex.</p>
<p><strong>Project Refresher:</strong></p>
<p>This project was to bring in demographics data and other informational data per zip code from internal systems, and using those choice zip codes to display zip code polygons on the map, somewhere between 50 and 2100 zip codes, effectively.  The zip codes will be colored based on system or demographics data, whichever the user chooses, and displayed to the user like on might see a weather map on TV. </p>
<p><strong>Project Hardships:</strong></p>
<p><em>Multiple Polygons:</em>  Some of the hardships that were found early on while i was learning was displaying a large amount of zip codes.  We found out that we were not able to ask for a certain set of zip codes from MapQuest, so we needed a way to get all of the ones that we wanted to see quickly.  We determined that we should cache them on a local server so we can access them faster and more readily.  The only problem was figuring out how to grab the object once it was cached.  We soon found that using the Feature Collection XML for the code would be appropriate for the storage. </p>
<p>We started development with that in mind, and it worked well, but it still took a lot of time to get the XML across the wire.  So we used gzip and ByteArrays.  I should mention we have a Java Back-end that makes many calls to cache our data, and then we have a flex front end that uses our chached data.  This data is taken and we had to use a XML processor to make the XML in JAVA, GZIP it and cache it until called.  Once the call is made we bring it in flex, unzip it and write it out.  This was fast but still took some time.  To make it use less time we used the Generalize function, which would then remove some points and make the polygon smaller, but we started getting some serious skew through the straight edges where the zips cross tile lines.  We found a cool project with called <a title="www.vividsolutions.com/jts/discussion.htm" href="http://" target="_blank">JTS(Java Topology Suite)</a>and it would make a single polygon where polys share lines with one another <span style="color:#ff9900;">(get rid of those pesky tile lines),</span>so we iincorporated some of that idea in our project.  That turned out beatuiful.  We now can generalize with the JTS as well and get really nice results.  We are still tweaking some things but all in all, incorporating their ideas really saved us. </p>
<p><em>Working with Multiple Polygons on the screen:</em>  I had to figure out how to manipulate the zip code polygons on the screen by changing their color, and their outline color as well.  I found that instead of putting them just right on the map, if you use a OverLayCollection, you can just sift through that and change the ones you need.  That works well.</p>
<p><em>Lack of Polygon Info:</em>  There are some things you just need to know about a polygon, like where it&#8217;s furthest edge points are.  I needed to find the north-most, south-most, east-most and west-most points of a poly, i wrote a function to do that, you can see it below in the Find Edges of Polygon posting I did.</p>
<p><em>Silly programming naming:</em>  I do it to, programmers write names for functions that seem to make sense, and you really have to pay attention to the api, but if you want to get the XML for a object in Flex/Flash, you say object.saveXml(), and that will return the XML to you.  If you want to load an object up with some XML just do object.loadXml(myXmlObj).  Thinking back, that is really pretty clear, that is more of my error.</p>
<p><em>Not incorporating objects soon enough:  </em>I actually wrote object that deal with a POI.  So if you have tons, instead of doing a batch of them, because they are not all the same probably, or if you have just one, you can fill this object up with an address, or something that resembles and address, and icon, and other information that you want the point to have and then let it go.  It will put itself on the map when it is done.  Also did the similar things to deal with the caching calls.  That way i can break them up and I make one return before the system sends the next one out.  Seems to work well. </p>
<p><em>Some sort of limiting factor:</em>  We had something that was going on and when we made a call to mapquest it would return partial XML, not sure why, but it would.  We changed some of the specifics of the call(radius call) like the radius and the number of results, but that didn&#8217;t help too much.  We were still a an impass with that.  Having a way to handle it would have been great other than it crashing our systems.</p>
<p><em>Batch Geocoding:  </em>You can only do a hundred at a time, but i don&#8217;t really care now, i do them all one at a time.  I can put about 350 on a screen in around a min.  I wouldn&#8217;t want to do this with too many more, but 350 is abnormal for us.  But 350 polygons isn&#8217;t, kinda funny.</p>
<p><strong>Seriously Easy Tasks</strong></p>
<p>Getting a map up and running is a breeze, just throw on the tilemap component and that is it.</p>
<p>GeoLocation calls are a breeze, getting that setup and working is also really easy.  I would write a object to do it, one for batches that manages a group of the same type of objects too if that is needed.</p>
<p><strong>TIPS</strong></p>
<p><em>Connecting to their servers:  </em>When you connect to their server make sure you are using the right password and username.  They are both listed in the account managment part of TRC.  But make sure you use the <strong>Registry Password</strong>not the password to log into TRC. </p>
<p><em>Getting the correct x and y position of the click on the map:</em>  myMap.mouseX,myMap.mouseY  others will work, but only in certain situations, these work constantly.</p>
<p><em>Items under clicked spot:  <span style="font-size:x-small;">myMap.getObjectsUnderPoint(myPnt) </span><strong><span style="font-size:x-small;color:#0033ff;">as</span></strong></em><span style="font-size:x-small;"><em> Array  </em>Use that to try to find the type of object you are looking for under your click.  You might need to set a key or some sort of identifier to make sure that you can pick the object contents out of the lineup.</span></p>
<p><span style="font-size:x-small;"><strong>My Wishlist:</strong></span></p>
<p><span style="font-size:x-small;">Mapquest accept a single call for a zip code.  I can live without it now, but that would make life a lot easier.  Especially when some zip codes are very large, like over 100 shape items, and take up a lot of resource power get get two that might be on different sides of the country.</span></p>
<p><span style="font-size:x-small;">MapQuest data implement JTS solution to get rid of tile lines, but i do that now too.  It save a lot of time.  Also let us pass in how generalized we might want to get the polys back and generalize them for us before return, that would save MapQuest gigs perhaps.</span></p>
<p><span style="font-size:x-small;">Lables for Polygons, like where you could see it blended into the polygon.</span></p>
<p><span style="font-size:x-small;"><strong>Summary</strong></span></p>
<p><span style="font-size:x-small;">Spending the last 8 months working with MapQuest and 6 months on a project, i found that working with the product is really good.  The support is out of this world, and they get back with you on a really quick basis.  Also, I find the map to usually render in a relatively quick time.  Getting the program tweaked to display the items quickly was a difficult 2 month task, i mean really, 2100 zip code polygons is a lot.  Lots of exploration on our part, using gzip bringing it in with Java and out into Flex/Flash.  Having the multiple API accessibility was great, we have a talented group in our office and they saved me some work, and i got to learn some Java in the midst of the project.</span></p>
<p> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mqguru.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mqguru.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mqguru.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mqguru.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mqguru.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mqguru.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mqguru.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mqguru.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mqguru.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mqguru.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mqguru.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mqguru.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mqguru.wordpress.com&blog=1766138&post=19&subd=mqguru&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mqguru.wordpress.com/2008/05/16/6-month-revist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d819bba50bd1a48684649464e7c6acfa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mqguru</media:title>
		</media:content>
	</item>
	</channel>
</rss>