http.request + Google Static Map API

I’m probably the last person in the world to figure this out. But just in case, give this a try…

displayMode(FULLSCREEN)

function setup()
    map = nil
    http.request('http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x400&sensor=false', didGetImage)
end

function didGetImage(theImage, status, head)
    map = theImage
end

function draw()
    background(226, 226, 226, 255)
    if map ~= nil then
        sprite(map, WIDTH/2, HEIGHT/2)
    end
end

Pretty spiffy. And if you look at the static maps API, you’ll find there’s a lot you can do with it.

Now, imagine if we had the compass heading and GPS values. We’d be well on our way to our own Codea-based mapping tool.

Yes, a little bit late, but it’s a good time to remind us about “old” code:

http://twolivesleft.com/Codea/Talk/discussion/1167/speed-shooter-earth/p1

Anyway, a nice compact example of Google maps access.

.@mark thanks for the nice piece of code.