Scala Lift Example Using Google Maps
After much searching I was unable to find any up to date example of simply using the Google Maps API with Scala Lift.
So, Cronus was born https://github.com/joestein/cronus to be just this.
I started out with the sample lift basic project (the HelloWorld one that sets datetime) as I figured this was most familiar to folks starting out. Then made a few discrete changes to facilitate the server creating some locations and having them drawn on the client.
As you can see function drawmap(locations) loops through the locations passed in (assuming the first one is the one to center on it). This paramater is an Array of JSON object(s) which we generate on the server and pass it into this client side function.
The server side snippet (assuming you know enough Lift that this make sense) is called from the span lift:helloWorld.howdy
The snippet is implemented in src/main/scala/code/snippet/HelloWorld.scala
The entry point howdy() then calls renderGoogleMap() which sets up 2 points to plot on the map. These points are setup through the makeLocation() function to properly format the JSON objects. Then an ajax call is made so that drawmap(locations) is executed on the client side once the page loads.
A demo application is up and running @ CloudBees http://liftgooglemapexample.allthingsscala.cloudbees.net/