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.
- Access http://coenraets.org/apps/gmaprooms/gmaprooms.html on two different machines or in two browser windows on the same machine.
- Make sure you logon with two different user names and the same room name.
- Move the map in one browser and notice that the position of the map is synchronized in the other browser.
- You can also search an address in one browser and the resulting map position will appear in the two browsers.
- The zoom level and the map type are also synchronized between users.
- 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:
- Install BlazeDS. You can download the BlazeDS turnkey server (a version of Tomcat with BlazeDS preinstalled) here.
- 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> - 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> - (Re)start the BlazeDS turnkey server.
- Download the source code of the Google Maps Application here.
- 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.
- Download the Google Maps ActionScript 3 API here, and add the swc file in the libs folder of your project.
- Get a Google Maps API key and assign it to map.key in the initMap() function in MapArea.mxml.
- Compile the application.
- 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”).
Comments
28 Responses to “Google Maps Collaboration Using Google’s New ActionScript API, Flex, and BlazeDS”
Leave a Reply









Way to go!
This is so cool!
WOW !!! I love you , Christophe , really great Applications !!!
it seems slow,very slow, i don’t know why ?
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”).
[...] 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 [...]
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.
[...] Sitio Web: MapRooms [...]
[...] 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 [...]
[...] 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 [...]
aarpprovideronline…
incumbent!therewith parenthetical,sophomores …
That’s really looking cool, need to try it asap. Most probably tomorrow, feeling sleepy now.
[...] Google Maps Collaboration Using Google’s New ActionScript API, Flex, and BlazeDSa> [...]
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…
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
SOG knives…
Interesting ideas… I wonder how the Hollywood media would portray this?…
gratis internet texas holdem…
beggary aerials abolishers?electrocuting mainframe Demeter …
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
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?
Güzel bilgiler…Teşekkürler…
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
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?
Thank you for great information.
Hi Christhope,
This is really nice application.
[...] Links: The Google Maps Flash API An Example Application [...]
Hey there–
This is awesome. Would you be amenable to having it linked from the Maps API documentation?
- pamela
That’s funny… The area I live in looks almost exactly like that. Street name is Canal St. instead Channel. :)
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.