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.

59 Comments

  1. Posted May 23, 2008 at 6:11 pm | Permalink

    Way to go!

  2. Posted May 23, 2008 at 11:42 pm | Permalink

    This is so cool!

  3. Mingo
    Posted May 25, 2008 at 11:03 pm | Permalink

    WOW !!! I love you , Christophe , really great Applications !!!

  4. Mingo
    Posted May 25, 2008 at 11:46 pm | Permalink

    it seems slow,very slow, i don’t know why ?

  5. Posted May 26, 2008 at 6:12 am | Permalink

    Mingo, 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”).

  6. Posted May 26, 2008 at 1:03 pm | Permalink

    This is ridiculously cool. The one thing I would say is that it’s not clear the difference between the “Shared map” and the “whiteboard” map.

    Also noticed that if I geocode after drawing, the drawing travels with me.

  7. Posted June 21, 2008 at 2:02 pm | Permalink

    That’s really looking cool, need to try it asap. Most probably tomorrow, feeling sleepy now.

  8. Posted June 27, 2008 at 3:24 pm | Permalink

    Please keep us updated with regard to your search for a good hosting environment. I’ve done a little googling and found only one webhost that advertises BlazeDS… Isn’t that the reason Adobe released BlazeDS? So web hosts would offer it as part of hosting solutions? I mean developers already have LCDS ES for development… ya know…

  9. Posted July 8, 2008 at 3:52 am | Permalink

    Hi Christophe,
    I’ve ported your app to run on FMS/Wowza/Red5: http://www.flashcomguru.com/index.cfm/2008/7/7/map-rooms-ported

    Best wishes,

    Stefan

  10. Jan
    Posted August 1, 2008 at 8:03 am | Permalink

    Hi Christophe,

    can you please post tha Java-Files for the Backend of this Application? This would help me to understand the communication between front- and back-end.

    Thanks
    Jan

  11. Heath Brown
    Posted August 6, 2008 at 3:41 pm | Permalink

    I really love your application look and feel. Where can I go to learn how to do that with Flex and AIR?

    I’ve got my setting for chrome to “none” but I still get standard borders and title bars from a windows application. How do I make it borderless like your cool looking apps?

  12. Posted August 6, 2008 at 5:48 pm | Permalink

    Güzel bilgiler…Teşekkürler…

  13. Christina
    Posted August 27, 2008 at 3:13 pm | Permalink

    Hi Christophe,

    I am trying to set up blazeDS on a remote server, and I am not sure how to configure the compiler (-services) and server settings (root folder) to make it work. I would appreciate any pointers you can give me. Thanks a lot!

    Christina

  14. Posted August 28, 2008 at 10:10 am | Permalink

    Hi Christophe,

    this sounds to be a awesome Application.
    Is it possible to release a “just click an run for stupid users like me” version?

  15. Posted September 8, 2008 at 8:33 am | Permalink

    Thank you for great information.

  16. Sreekanth
    Posted September 10, 2008 at 9:41 am | Permalink

    Hi Christhope,

    This is really nice application.

  17. Posted September 25, 2008 at 12:28 pm | Permalink

    Hey there–

    This is awesome. Would you be amenable to having it linked from the Maps API documentation?

    - pamela

  18. Posted October 22, 2008 at 9:49 pm | Permalink

    That’s funny… The area I live in looks almost exactly like that. Street name is Canal St. instead Channel. :)

  19. Posted November 13, 2008 at 4:36 pm | Permalink

    This is a great application. We are exploring the possibility of building something like this for our business. Are you available for phone consultation to guide us with the architecture and technology.

  20. Posted November 27, 2008 at 7:51 pm | Permalink

    Hi,Christophe

    This application can be sync now. Can you fixed it? Because I want to demo it for others. Thanks.

  21. Posted March 10, 2009 at 5:44 pm | Permalink

    Perfect application, I love google maps

  22. Posted May 28, 2009 at 9:14 pm | Permalink

    I’m not a developer and some of the discussion I had with MapQuest was too technical for me to entirely understand the full range of advantages of the new API. But, as mentioned, it appears to permit a new, richer generation of mashups to be born on using Flash and other Adobe platform tools.

  23. Posted May 30, 2009 at 5:08 am | Permalink

    Hi there,
    I found great ideas on your Web site.
    Well done !
    Thanks for that and keep on doing
    Greetings from germany
    Thomas

  24. Sriram
    Posted June 28, 2009 at 8:05 pm | Permalink

    Hi..

    I tried the local installation instructions. the front-end login page loaded, but after that the page did not load…i tried multiple times, but faced the same issue. Any solution?

  25. Laura W
    Posted July 4, 2009 at 2:47 pm | Permalink

    I’m very impressed by this application. Any thoughts on making the free hand drawing geo-referenced?

  26. Posted July 15, 2009 at 8:47 pm | Permalink

    Here is a tutorial to show how to install and use the MaxMind Database with PHP scripts examples. And it also shows how to display it on a map (Yahoo! Map) (french):
    http://www.flex-tutorial.fr/2009/02/01/flex-yahoo-maps-api-geo-localisation-par-ip-dun-visiteur-exemple/

  27. Henike99@girlsandnylons
    Posted July 17, 2009 at 9:26 am | Permalink

    That’s good information: Om said Om don’t know much about the characteristics of his or her server but I’m probably sharing it with a few dozens of other domains and the resources allocated to him or her are obviously limited in that shared environment.

  28. matifbutt
    Posted August 11, 2009 at 11:48 pm | Permalink

    Hi I dont know, my first client browser working okay with second one but when I reply from second client to first, its not working.

    Any idea

  29. matifbutt
    Posted August 12, 2009 at 12:32 am | Permalink

    Client one get the reply but slowly from Client 2. Is there any reason?

  30. Posted August 18, 2009 at 5:19 am | Permalink

    nice one! But I still have the problem, that the API-Key is not working with Subdomains! I have to register new Keys for each Sub! Anyone any solutions?

  31. Posted August 18, 2009 at 7:26 am | Permalink

    Hi activetraffic: I think that you have to stick with registering each subdomain – unless there is some sort of script to automate the process? Regards, Marco

  32. Posted August 20, 2009 at 3:32 am | Permalink

    Вопрос к автору сайта, а вот у вас время у каждой статьи и в комментах пишется… Это какое? Московское? Заранее спасибо за ответ.

  33. Posted August 20, 2009 at 3:49 am | Permalink

    has anyone any more informations on this “subdomain-issue”? because I´m facing the same problem!

    Best Regards
    Nico

  34. Posted August 23, 2009 at 1:55 pm | Permalink

    This is so cool! woow great Idea

  35. Posted September 5, 2009 at 10:56 pm | Permalink

    Hi activetraffic: I think that you have to stick with registering each subdomain – unless there is some sort of script to automate the process? Regards, :)

  36. Don
    Posted September 16, 2009 at 12:21 pm | Permalink

    Communication between rooms does not seem to be working at the moment

  37. Posted September 21, 2009 at 2:06 pm | Permalink

    I found the idea Wunderfull! Its nice

  38. Posted October 6, 2009 at 12:06 pm | Permalink

    wow great!

  39. Posted October 11, 2009 at 5:34 pm | Permalink

    Would you be able to having it linked from the Maps API documentation?

  40. Posted October 15, 2009 at 1:39 pm | Permalink

    I am using G Maps with Ruby on Rails and it works fine, now I will try it with flash and flex.

  41. Posted October 25, 2009 at 5:34 pm | Permalink

    I love google maps on the iphone – but no flash is possible on the iphone

  42. Posted October 26, 2009 at 12:40 pm | Permalink

    Flash will probably never go to the iphone.
    But its not needed anyway.
    Nice article and thanks for sharing :)
    Greetings, Außenwerbung

  43. Posted November 2, 2009 at 11:05 am | Permalink

    I tried the tutorial, great help. Thanks!

  44. Posted November 30, 2009 at 6:07 am | Permalink

    wow, the tutorial actually helped me alot.
    thank you :)

  45. Posted November 30, 2009 at 3:53 pm | Permalink

    Whow! i have to try this very soon. brilliant idea!

  46. Posted December 4, 2009 at 6:35 am | Permalink

    thats awesome. thanks..

  47. Posted December 8, 2009 at 7:25 am | Permalink

    Thank you for the helpfull apllication!

  48. Posted December 12, 2009 at 10:07 am | Permalink

    Nice article! Thanks

  49. Posted December 17, 2009 at 1:22 pm | Permalink

    Ein Kompliment für diese tolle Seite.
    Eigentlich bin ich durch Zufall darauf gestoßen und dachte mir,
    einen netten Eintrag und viele Grüße zu hinterlassen.
    _____ \\\!!!///____
    ______( ô ô )_____
    ___ooO-(_)-Ooo___
    Vielleicht schauen sie mal auf meiner Homepage vorbei!

  50. Posted December 27, 2009 at 5:58 pm | Permalink

    Whow! i have to try this very soon. brilliant idea

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>