« Mashup the Enterprise: an example | Main | Using OpenLDAP with WebLogic Server »

Workshop 10.1, Maps, GeoRSS, REST and more

This was originally posted on my dev2dev blog July 26th, 2007.  Workshop has been rebranded as the Oracle Enterprise Eclipse Pack.

First of all I have to gush about how cool Workshop 10.1 is.  Having the split-plane WYSIWYG JSP editor integrated with all of the WebLogic plug-ins is so great, and I can use it to deploy to 8.1, 9.2, and 10 servers, which is very helpful for me as many of my customers have a little of everything still deployed.  In my last post, I gave some examples of how I did a simple Google Maps mashup with Workshop using RSS and XMLBeans.  Well, in this post I wanted to discuss my experiences extending that example to use Yahoo Maps and Microsoft Virtual Earth as well.  I also discovered the GeoRSS format and used the Yahoo Geo-coding REST API.

Code share example

I promised to post my code to codeshare, and now all of my code is available here as a codesample.  The basic instructions are just to download Workshop 10.1, import the zipped projects into a workspace, and deploy them to a WLS 10 server instance that has the Workshop runtime.  Once you deploy, visit http://localhost:7001/MapsWAR and check it out.

Workshop10.1

So my first foray into the maps world was to see if I could come up with a simple bean that could represent locations to plot on a map, regardless of which map service I used.  Each map service has their own way of doing things, but they all have some fairly basic starting examples.  I used a pageflow form to select which map service to select, and I demonstrate how to display some hard-coded locations on each map service, reusing the same map bean.

googleBasic microsoftBasic yahooBasic

Add RSS to the mix

Now, hard-coding values is not very flexible, so I also integrated a RSS feed from Picasa that has a location attribute for each of my public web albums.  Using XMLBeans, I retrieve the RSS feed, parse out the location data, populate my maps bean, and display the album locations on the selected map service.  In each case I use the map service javascript to put the locations on the map, I do not have to know the lat/long coordinates, but I have to know some particulars about each map service's javascript api.

GoogleAlbums msAlbums yahooAlbums

GeoRss, Yahoo Geo-coding and REST

Playing around with these map services I became aware that they all support GeoRSS.  Instead of having lots of proprietary knowledge on each of the map service's javascript api, I found that using GeoRSS you only have to supply the GeoRSS file, and then let the map service take care of the details.  The hang-up with this is that now I need to know the lat/long values in order to create the GeoRSS format.  Yahoo provides a REST based geo-coding service which makes this pretty easy.  Bill Roth has previously blogged about how to use it and even submitted his own codesample to codeshare.  So I start by retrieving the RSS file from Picasa, then for each album I parse out the City and State value from the description, then I submit a request to the Yahoo service and add the lat/long result back into the RSS feed.  Now what started out as a plain RSS feed now has GeoRSS elements in it.  Be aware that if you're running this server instance on a corporate site that you may have to configure your server to use a proxy since WLS will try and access yahoo services to invoke the geo-coding service.  Here is some relevant documentation for setting a proxy server for http requests outbound from WLS for 8.1, I believe it is similar for 9.2 and 10.

I found Google's map service to be the most flexible with GeoRSS because you can put any GeoRSS file in the search form and have it plot the results.  Try it out.

The map services

All of the map services were pretty easy to use with examples, although I found Google's to be the most intuitive.  One of the downsides of Google's service however is that the api key is tied to a domain and port.  So in this case, if you run my example on localhost:7001 the Google Maps will work just fine.  However, if you change the URL such as using 127.0.0.1:7001, you'll get a javascript popup telling you that you need a new API key for that domain,   Yahoo also requires you to get a unique application id, but it does not appear to be tied to a particular domain and port.  Surprisingly, Microsoft does not require this at all.  Google, Yahoo and Microsoft definitely have some interesting APIs that I did not explore yet such as a Yahoo Maps Flash API , Virtual Earth SDK and a whole smattering of offerings from Google.  I find that the competition between the services is good because it is forcing them to innovate quickly to offer developers compelling features.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

james_bayer.jpg

I am a Senior Sales Consultant covering enterprise customers in and around the Chicago area focusing on middleware and internet technologies. My career began as a Java consultant and architect where I experienced the technology shift toward SOA. I enjoy helping customers solve business problems by applying Oracle technology solutions.

About This Entry

This page contains a single entry from the blog posted on July 26, 2007 8:00 PM.

The previous post in this blog was Mashup the Enterprise: an example.

The next post in this blog is Using OpenLDAP with WebLogic Server.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle