Feeds

Virtual Earth puts human face on data

Lightweight programming, minus Google

Secure remote control for conventional and virtual desktops

The data set is returned to the method in the web service and, whilst this is happening, the text "Searching..." is displayed on the web page to provide feedback for the user.

If the transfer of data was successful, the function onSuccess is called.

    function onSuccess(result)
    {
        if (!layer)
        {
            layer = new VEShapeLayer();
            map.AddShapeLayer(layer);
            map.ShowAllShapeLayers();
        }
        
        layer.DeleteAllShapes();
        
        document.getElementById('SearchingText').innerHTML
            = 'Processing results...';
        
        for (var count=0; count < result.length; count++)
        {
            document.getElementById('SearchingText').innerHTML
                = 'Processing result ' + (count + 1)
                + ' of ' + result.length + '.';
            AddPoint(result[count].Name, result[count].Latitude,
                     result[count].Longitude);
        }

        document.getElementById('SearchingText').innerHTML
            = result.length + ' matches found.';
    }

The first five lines after the function name inquire if a layer is present: if there isn't, one is pulled in. Then any existing shapes superimposed upon the layer are erased.

Feedback ("Processing results...") for the web page user is provided again, and then a loop is entered that processes the returned data set row by row and adds a point for each location. Once each row has been processed, the number of matches found is displayed on the web page.

The mashup is now complete: data has been selected by the user, has been returned by the database and is displayed graphically on a Virtual Earth map.

The code needed to make this mashup work was easy to write using Visual Studio 2008. So are we trying to get you to use Visual Studio 2008? No. We don't care. The point isn't that it's any easier in any other code development tool of your choosing, but that it's easy to create mashups that provide useful interactive web-based tools.

If you are already writing web services, adding a mashup on top is trivial. Code for the web service ran to a mere 77 lines, not counting comments or lines containing a single bracket. (Although these are, of course, vital for the readability of code, they aren't exactly a taxing part of code writing and so they were ignored for the line count). The web page code was fractionally shorter at 75 lines, counted on the same basis.

So go on: create a mashup in your lunch break. You know it makes sense.®

The essential guide to IT transformation

More from The Register

next story
Apple promises to lift Curse of the Drained iPhone 5 Battery
Have you tried turning it off and...? Never mind, here's a replacement
Mozilla's 'Tiles' ads debut in new Firefox nightlies
You can try turning them off and on again
Linux turns 23 and Linus Torvalds celebrates as only he can
No, not with swearing, but by controlling the release cycle
Scratched PC-dispatch patch patched, hatched in batch rematch
Windows security update fixed after triggering blue screens (and screams) of death
This is how I set about making a fortune with my own startup
Would you leave your well-paid job to chase your dream?
prev story

Whitepapers

Endpoint data privacy in the cloud is easier than you think
Innovations in encryption and storage resolve issues of data privacy and key requirements for companies to look for in a solution.
Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Advanced data protection for your virtualized environments
Find a natural fit for optimizing protection for the often resource-constrained data protection process found in virtual environments.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Next gen security for virtualised datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.