Thursday, 9 May 2013

Satellite image viewer

Today I'll show you a post about a satellite viewer, how it works:
  • it reads a page
  • it extract satellite image url using parse
  • it load also the vertical gradient bar
  • it display a layout that update image every 30 minutes
and all in just 16 lines of code!

Here is the source:
    Title: "Gradient Colorize Examples"  
    Author:   ["Tesserator" "Massimiliano Vessi"]
    Purpose: {Trying to Auto DL weather maps on 30min. intervals from: }
update_img: does [
    flash "Fetching image..."
    img: read
    parse img [thru {TYPE="image" src="}   copy img   to {"}   to end ]
    img: load (join   nasa_url img)
    ; this way img2 is loaded just one time
    if not value? 'img2   [img2: load ]
view layout [
    h1   "GOES East Interactive Infrared Weather Satellite Image Viewer"
    text "Image automatically updated every 30 minutes"
    image img rate 00:30 feel [ engage: func [face action event] [
        face/image: img
        show face
        ] ]
    image img2  

No comments:

Post a Comment