Google Maps Collaboration Using Google’s New ActionScript API, Flex, and BlazeDS

Google Maps Collaboration Using Google’s New ActionScript API, Flex, and BlazeDS


Google recently released the Google Maps API for Flash. I took the opportunity to create a Google version of the MapRooms sample application I posted recently. MapRooms works like Chat Rooms. You can create a room, or join an existing one. In addition to chatting, MapRooms allows you to collaborate on a map: the application leverages the real time capabilities of BlazeDS or LCDS to provide map synchronization between users in the room, and allow you to “whiteboard” on top of a map.

Testing the hosted version

Disclaimer: I’m currently hosting the application on the server I use to host this blog (basic PHP and Tomcat hosting plan). I don’t know much about the characteristics of my server, but I’m probably sharing it with a few dozens of other domains and the resources allocated to me are obviously limited in that shared environment. This is clearly not the ideal environment to host a potentially large scale real time application and I’m investigating other hosting solutions. In the meantime, if you experience difficulties running the app, you can install it locally using the instructions provided below (in “Local installation instructions”). The hosted version tries to connect using RTMP by default (available only as part of LCDS) and falls back to “long AMF polling” or regular AMF polling if the RTMP connection fails.

  1. Access http://coenraets.org/apps/gmaprooms/gmaprooms.html on two different machines or in two browser windows on the same machine.
  2. Make sure you logon with two different user names and the same room name.
  3. Move the map in one browser and notice that the position of the map is synchronized in the other browser.
  4. You can also search an address in one browser and the resulting map position will appear in the two browsers.
  5. The zoom level and the map type are also synchronized between users.
  6. Click the “Whiteboard” button in one browser, pick a color to draw on the map (upper left corner), and start drawing.

Note: you can right-click the application and select View Source or click here to see the source code of the application.

Local installation instructions:

  1. Install BlazeDS. You can download the BlazeDS turnkey server (a version of Tomcat with BlazeDS preinstalled) here.
  2. Open {blazeds-install-dir}/tomcat/webapps/samples/WEB-INF/flex/services-config.xml and add an AMF long polling channel defined as follows:

    <channel-definition id="my-longpolling-amf" class="mx.messaging.channels.AMFChannel">
    	<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amflongpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
    	<properties>
    		<polling-enabled>true</polling-enabled>
    		<polling-interval-seconds>5</polling-interval-seconds>
    		<wait-interval-millis>60000</wait-interval-millis>
    		<client-wait-interval-millis>1</client-wait-interval-millis>
    		<max-waiting-poll-requests>200</max-waiting-poll-requests>
    	</properties>
    </channel-definition>
    

  3. Open WEB-INF/messaging-config.xml and add the following destination:

    <destination id="gmaprooms">
    	<properties>
    		<server>
    			<allow-subtopics>true</allow-subtopics>
    			<subtopic-separator>.</subtopic-separator>
    		</server>
    	</properties>
    	<channels>
    		<channel ref="my-longpolling-amf"/>
    		<channel ref="my-polling-amf"/>
    	</channels>
    </destination>
    

  4. (Re)start the BlazeDS turnkey server.
  5. Download the source code of the Google Maps Application here.
  6. Create a Flex Builder project for the Flex application (gmaprooms). Make sure you configure your Flex Builder project to work with BlazeDS. To read instructions on how to set up a Flex Builder project that works with BlazeDS, make sure your BlazeDS turnkey server is started, and click here.
  7. Download the Google Maps ActionScript 3 API here, and add the swc file in the libs folder of your project.
  8. Get a Google Maps API key and assign it to map.key in the initMap() function in MapArea.mxml.
  9. Compile the application.
  10. Open the Flex application in two browser windows (to simulate two users in different locations) and test the application as described above (in “Testing the hosted version”).



  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • LinkedIn
  • StumbleUpon
  • Twitter
This entry was posted in BlazeDS, Collaboration, Flex, LCDS. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

57 Comments

  1. Posted January 6, 2010 at 12:02 pm | Permalink

    Nice article! Thank you.

  2. Posted January 10, 2010 at 12:52 am | Permalink

    I use BlazeDS to create exceptional rich applications with Flex and Java BlazeDS is a popular, open source web application that can successfully be deployed into a Java application server, making it an ideal option for Flex and Java integration. With this comprehensive resource, you’ll walk through the process of creating Rich Internet Applications (RIA) using BlazeDS. After a look at BlazeDS basics, the book then moves on to explain how to configure, customize, and extend BlazeDS in order to integrate with new and existing Java data sources and applications with Flex-based RIA. * Explains how to install BlazeDS from source as well as its compiled distributions * Demonstrates ways to make user interfaces engaging and effective * Introduces techniques for intercepting for control and management

  3. Poonam
    Posted January 27, 2010 at 1:03 am | Permalink

    Hello,

    I have followed the steps to create the sample application of Google Map whiteboard , but I am getting the following error message when I click in “Join Room”

    [MessagingError message='Destination 'gmaprooms' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']

    Can you please help me in sorting out this please?

    Thanks
    Poonam Jaju
    poonam.mantri@gmail.com

  4. Posted February 12, 2010 at 9:45 am | Permalink

    Great article! Thank you for posting. Best Regards from Germany :-)

  5. Posted March 11, 2010 at 6:39 am | Permalink

    Great article :-) Thank you for posting and best regards!!!

  6. Posted April 17, 2010 at 12:22 pm | Permalink

    Great site, very interesting. Thanks

  7. Posted June 15, 2010 at 11:24 am | Permalink

    Very helpful website. Wish I would have found this good one earlier. Just bookmarked…
    Shiatsu Massagesessel

12 Trackbacks

  1. By Blog Xebia France - Revue de Presse Xebia on May 26, 2008 at 11:14 am

    [...] Coenraets, Senior Technical Evangelist chez Adobe, a développé à l’aide de cette API un outil de “cartes collaboratives” qui permet de commenter à plusieurs dans une “chat room” une carte Google Maps en lui ajoutant [...]

  2. [...] Sitio Web: MapRooms [...]

  3. By RenaLId.com :: Revue du Geoweb de la semaine on June 1, 2008 at 8:12 am

    [...] mashup avec Google Maps API Flash MapRooms est un mashup créé par Christophe Coenraets à partir de Google Maps API Flash. Il propose des "Chat Rooms" accompagnées [...]

  4. By Flex, Google Maps & BlazeDS : mashup powa on June 7, 2008 at 7:44 am

    [...] nouvel API de google maps dédié à Flash simplifie la vie du développeur et voici cette démonstration avec BlazeDS, le serveur Adobe Open source de Push Data – c’est le serveur qui pousse les [...]

  5. By aarpprovideronline on June 20, 2008 at 12:10 am

    aarpprovideronline…

    incumbent!therewith parenthetical,sophomores …

  6. [...] Google Maps Collaboration Using Google’s New ActionScript API, Flex, and BlazeDSa> [...]

  7. By SOG knives on July 17, 2008 at 3:01 pm

    SOG knives…

    Interesting ideas… I wonder how the Hollywood media would portray this?…

  8. By gratis internet texas holdem on July 20, 2008 at 5:18 pm

    gratis internet texas holdem…

    beggary aerials abolishers?electrocuting mainframe Demeter …

  9. By Indicator » Blog Archive » Google Maps Flash API on September 24, 2008 at 9:15 am

    [...] Links: The Google Maps Flash API An Example Application [...]

  10. [...] this year Christophe Coenraets, a colleague on the Platform Evangelism team, created an example application which combined Google’s ActionScript API, Flex and BlazeDS to provide a real-time [...]

  11. [...] this year Christophe Coenraets, a colleague on the Platform Evangelism team, created an example application which combined Google’s ActionScript API, Flex and BlazeDS to provide a real-time [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>