Things you could do using http.get?

I’m sorry if this sounds stupid, but I wonder if - using something like http.get - you could integrate Google Maps into an app? I don’t really have the technical know-how for this, so I wouldn’t know if you could do it. However, if it were possible, I’d love to see something using it!

You could do it, but it would take a web app running on a server using the Google Maps api to download and format the data and pass it along to the Codea app. So your Codea app would connect to your php/python script and request a map, that script would get the data from Google, then send it back.

Actually there is no reason you couldn’t use the google maps API directly. You could use the Static Image API though you would (I think) need to decode the image yourself. But nothing about that requires a server

To name a couple of other things you could do:

@JockM you may not need to decode the image yourself. If the data returned is a valid iOS image type (png, tif, jpg, gif and many others) it will automatically be converted into an image object in your success callback.

Codea will attempt the conversion on the data, if it is not an image then it gives you the raw data.

Edit: by the way, it has been renamed http.request in the next update (though http.get will live on for compatibility until we can deprecate it completely).

@Simeon Oooo that is very good to know.

I guess it would be possible to write some sort of visualiser that take arbitrary ‘live’ data (via http.get) and presents it in an interesting visual way in real time? E.g live info from the financial markets, live train time tables, maybe there are live data sets from NASA somewhere? Seen a lot of cool stuff on the web that does this offline with legacy data as simple animations (e.g energy consumption in the US per city over the last 10 years) - think this sort of thing should be more than possible with Codea :slight_smile:

It works right out of the box. I used sample code from the Bing Maps rest API verbatim, displaying the returned static map image with the sprite command, and the map image popped right up.

Of course until there is a geolocation feature set added to Codea you won’t be able to track your current position on a map.

In a way, I am using http.get() to pull in almost live data for my app. It pulls it about every 5 minutes, but it works great!

If you live in the Portland (OR) Metro Area you can use Trimet’s Web Services.

If you live in the Bay Area you could use BART’s or San Francisco’s MUNI APIs.

You can also use it with the google chart API:

function setup()
    local tbl={["method"]="POST",

function getHttpData(data,status,headers)
    print("Chart loaded")
    print("image ("..grImg.width..","..grImg.height..")")

function httpError(error)
function draw()
    background(0, 0, 0, 255)
    if grImg then

I would make it so that an app is just a loader of code stored in a text file online. When you turn on the app, it checks it’s version number against a version number stored remotely. If they are different it gives you the option to auto update.

@KMEB I would strongly advise against that. Go through Apple’s update system. If you download code post-review they are likely to ban your entire development account. (Also, apps must be able to work offline.)

Going through their system also gives you automatic notifications to your user base, users can read your “What’s New” through the App Store App, and so on.

Edit: Do not make your App download any code. It’s against their policy.