Skip to content
Browse files

map me

  • Loading branch information...
1 parent 7c32a7d commit 391487e4474137f89422f65fb0548c1c2e1b52ae @maddox maddox committed Oct 25, 2011
Showing with 24 additions and 0 deletions.
  1. +24 −0 src/scripts/maps.coffee
View
24 src/scripts/maps.coffee
@@ -0,0 +1,24 @@
+# Interacts with the Google Maps API.
+#
+# map me <query> - Returns a map view of the area returned by `query`.
+
+module.exports = (robot) ->
+
+ robot.hear /(?:(satellite|terrain|hybrid)[- ])?map me (.+)/i, (msg) ->
+ mapType = msg.match[1] || "roadmap"
+ location = msg.match[2]
+ mapUrl = "http://maps.google.com/maps/api/staticmap?markers=" +
+ escape(location) +
+ "&size=400x400&maptype=" +
+ mapType +
+ "&sensor=false" +
+ "&format=png" # So campfire knows it's an image
+ url = "http://maps.google.com/maps?q=" +
+ escape(location) +
+ "&hl=en&sll=37.0625,-95.677068&sspn=73.579623,100.371094&vpsrc=0&hnear=" +
+ escape(location) +
+ "&t=m&z=11"
+
+ msg.send mapUrl
+ msg.send url
+

0 comments on commit 391487e

Please sign in to comment.
Something went wrong with that request. Please try again.