Interactive Mapping Blog

Mapping Solutions News

Archive for 2008

Virtual Earth makes a ‘Quantum Leap’ in 3d

Thursday, September 25th, 2008

This new release of virtual earth has some major updates to the 3d plugin. The two biggest changes being real time clouds and ’street view’ imagery for 3d models.

The first time I saw the real time clouds demo’d last week my first thought was “this looks just like the opening titles to Quantum Leap!”. Zooming through the clouds at as if in a plane is really cool even if it is a bit of a gimmick.

To give you an idea of what it looks like take a look at the video below of Mount Snowdon in Wales. Unfortunately I couldn’t get our normal capture program (fraps) working with the latest 3d plugin so it’s not very smooth, and certainly not ‘zooming’ but it still adds a lot of atmosphere to the landscape.

Go and give it a try for yourself here are a few mountains to try:

Now if only we could commercially sell these 3d videos flyovers, like we currently do with Google Earth video tours, it would be brilliant, but Microsoft’s 3rd party licensing deals are always the issue.

That’s all for now next time we will look at the new 3d street view imagery that’s been added to some of the modeled cities.

Virtual Earth, Microsoft releases ver 6.2 today!

Sunday, September 21st, 2008

Its been rumoured for a few days but now its official the new version of the Virtual Earth ajax web control has been released. Considering this is just a minor release it  has a lot of features packed into it:

  1. Localised map tiles for German, French, Italian and Spanish

    image

  2. Built in client side pushpin clustering
  3. Landmark based routing, currently supported in the USA for fast food restaurants and petrol stations
  4. Massive improvements in European and Worldwide addresses parsing specifically improved for UK, France, Italy and Spain
  5. Static maps for mobile (see more below)
  6. Ability to disable the default virtual earth tiles, when adding custom tile layer (no word on how to license this scenario though)

There is now also a set of Virtual Earth web services (seperate from the mappoint web services):

  1. Imagery meta data webservice – gives date range of imagery and provider details (only for ortho imagery)
  2. Geocoding web service – using the virtual earth geocoder, not the mpws one and with the improvements as mentioned above
  3. Reverse geocoding worldwide – available wherever routing is available
  4. Search and routing – web service methods to match the ajax controls existing methods
  5. Image tiles and static maps – you can now request tiles via the web service rather than directly to use in your own custom map controls and also for mobile devices

There have even been some updates to the 3D control and content:

  1. Realtime weather and clouds, the clouds look great as you fly through them

    London's real time rain clouds ;-)

  2. Improved installed for the 3d plugin
  3. More options available to user including disabling weather (when its raining and you are showing the client there lovely new beach resort :-) )
  4. Improved texture quality on 3d buildings
  5. Improved ’street level’ textures on buildings – this is Microsofts answer to Google Streetview where they have textured the lower parts of buildings with imagery taken at street level
  6. Import of models from your own hosting (no need to upload to live.com) in the lightwave obj format
  7. New version of 3dvia shape

Getting Stuck In

To get started with version 6.2 first try the interactive sdk then read through the reference sdk including the whats new section.

Summary

There seem to have been a bit of a delay getting this release live as it was due to be released on the 22nd but it goes to show how big a release it is. So as you can see the Virtual Earth dev team have been really busy. Its brilliant to see how many features requested by the developer community have been released. To be honest when I was asked what new features we wanted to see in the future there weren’t many I could think of any more, it just goes to show how mature a product the ajax control is becoming. Now access to the tiles have been officially supported it will be interesting to see what commercial uses people find for this and the mobile maps.

It’s also great to see the hard work of the MultiMap team making it into the Virtual Earth control as they contributed to the pushpin clustering and the massive improvements in worldwide geocoding and address parsing.

Creating simple drive time maps with Virtual Earth

Saturday, September 20th, 2008

download code download code

distance coverable from central london in 30 minutes A feature that we are sometimes asked for with our mapping products and solutions is “can you show a map of how far I can travel by car from X in Y minutes?”. I was recently inspired by a demo of the Masternaut fleet management system at the UK Virtual Earth partners day, that showed very nice detailed polygons of how far you could travel my car from a given point in a given time.

Now I’m sure Masternauts solution, which works almost instantly, has a massive backend data store to query all this information but it got me wondering if we could do a very simple version of this just using the data available from Virtual Earth?

How might we achieve this?

image The basic process behind this idea is to create a set of “spokes” at evenly distributed angles around a centre point (the start location) like a bicycle wheel.

The diameter of the “wheel” being set to the maximum possible distance that could be travelled in a straight line from the centre of the “wheel”.

We then need to get the latitude and longitude of the point at the end of each “spoke” and use this to get directions, using Virtual Earth, from the centre of the “wheel” to each “spoke” end point.

We should then be able to go through the details of each “spoke” route returned and work out how far along the route we could get in the given time. This should give us a set of latitude / longitude points around the centre of our “wheel” indicating how far along each “spoke” we can travel in the given time, join them together in a polygon and you have your map!

So the basic process is:

1) Get X spoke point positions (lat / lon) at equal distance and equally distributed around a start point

2) Calculate the full driving directions from the start point to each of the X spoke positions

3) Go through each route returned and work out how far along the route we could travel in the given time, get the position (lat / lon) of this point

4) Add all the points from 3 and draw a polygon on the map showing the boundaries of the possible locations.

The Code

I would usually write this as a javascript class using the asp.net ajax libraries but to make it as readable as possible and portable to any framework it is coded as simple function calls with a few global variables.

First we have to work out the position of each end point of the “spokes”:

//starts the process of calculating the driving distances
function GetDrivingDistance(startpoint, mins, numspokes, maxspeedkmph) {
    gmins = mins; //need to use later
    gnumspokes = numspokes;
    gstartpoint = startpoint;
    
    //add original start point as pushpin to map
    var pin = new VEShape(VEShapeType.Pushpin, startpoint);
    gmap.AddShape(pin);
    
    //calculate maximum distance possible in a straight line
    //at the maxspeed
    var maxdist = (maxspeedkmph/60) * mins;
    
    gspokearray = new Array(); //new array to contain spoke VELatLong objects
    groutesarray = new Array(); //new array to contain the VERoute objects calculated
    
    //setup verouteoptions for directions
    gropts = BuildRouteOptions();
    
    //calculate position, in lat lon, of each spoke
    //assuming maximum distance away
    for (i = 0; i < numspokes; i++) {
        var bearing = (360 / numspokes) * i; //get bearing of current spoke
        gspokearray[i] = GetPointAtDistanceAndBearing(startpoint, maxdist, bearing);
 
        //get first route between startpoint and spoke endpoint
        //cannot call more than one GetDirections at once
        if (i == 0) {
            document.getElementById("progress").innerHTML = "Proccessing step 1 of " + gnumspokes;
 
            //plot spoke
            if (gdebug) gmap.AddShape(new VEShape(VEShapeType.Pushpin, gspokearray[i]));
            
            //get directions
            gmap.GetDirections(new Array(startpoint, gspokearray[i]), gropts);
        }
    }
}

This  function starts by setting some global variables and then adds a pushpin to the map at the location of the supplied VELatLong startpoint parameter.

The we calculate the maximum possible distance coverable in a straight line at the parameter maxspeedkmph (max speed in km per hour).

Then we setup a few arrays for storing results in later, and create the VERouteOptions class to be used in all routing (see full code for function BuildRouteOptions). The route options set a callback method called OnRoutingComplete when the route is complete

Now we loop through the number of spokes requested (parameter numspokes) and work out the bearing of each spoke around the start point using the GetPointAtDistanceAndBearing method (see full code).

After updating the UI with our progress we optionally plot the spoke end point if the code is in debug mode (see full code) just so we can see what is going on.

Finally we fire off the first request to VEMaps GetDirections method for the first spoke point.

When the GetDirections is complete the OnRoutingComplete function is called:

//the callback function when a route completes
function OnRoutingComplete(result) {
    //add new route to groutesarray
    groutesarray.push(result);
    if (groutesarray.length == gnumspokes) {
        //now all routing is complete start next stage
        ProcessDrivingRoutes();
    }
    else {
        //update progress
        document.getElementById("progress").innerHTML = "Proccessing step " + (groutesarray.length + 1) + " of " + gnumspokes;
 
        //debug plot spoke and route end
        if (gdebug) {
            gmap.AddShape(new VEShape(VEShapeType.Pushpin, gspokearray[groutesarray.length]));
            if(result.Distance>0) gmap.AddShape(new VEShape(VEShapeType.Pushpin, result.RouteLegs[0].Itinerary.Items[result.RouteLegs[0].Itinerary.Items.length-1].LatLong));//end of route, to see how close it got to spoke
        }
          
    
        //get next route
        gmap.GetDirections(new Array(gstartpoint, gspokearray[groutesarray.length]), gropts);
    } 
}

This adds the returned VERoute object to an array for processing later and then either calls ProcessDrivingRoutes if all routes have been completed or calls itself again with the next “spoke” position.

Once all routes have been completed the ProcessDrivingRoutes function is called:

function ProcessDrivingRoutes() {
    var pointsarray = new Array();
    var numroutesnotfound = 0;
    //process each route result
    for (i = 0; i < gnumspokes; i++) {
        //check route found, or if was in middle of sea etc so nothing returned!
        if (groutesarray[i].Distance > 0) {
            //work out how far down route we can actually get in the time supplied
            var totaltime = 0;
            for (var ii in groutesarray[i].RouteLegs[0].Itinerary.Items) {//will only be one RouteLeg
                //is current leg time greater than time supplied?
                var items = groutesarray[i].RouteLegs[0].Itinerary.Items;
                totaltime += items[ii].Time; //calculate the cumlative time of the route so far
                if (totaltime >= gmins * 60) {
                    //work out average speed between this point and the last
                    var routetimesecs = items[ii - 1].Time;
                    var avspeedkmph = 0
                    //check route time is greater than zero, as some itineraries can have zero time and distance
                    if (routetimesecs > 0) {
                        avspeedkmph = items[ii - 1].Distance / (routetimesecs / 360);
                    }
 
 
                    //work out aprox how far along route between this point and the previous
                    //you can get in the remaining time at the average speed
                    var timeleftsecs = (gmins * 60) - (totaltime - items[ii].Time); //time left from previous point
                    var maxdist = (avspeedkmph / 360) * timeleftsecs;
 
                    //work out bearing between previous point and this one
                    var bearing = GetBearingBetweenPoints(items[ii - 1].LatLong, items[ii].LatLong);
 
                    //work out new point along route between previous point and this one
                    //that can be reached in the remaining time
                    var newpoint = GetPointAtDistanceAndBearing(items[ii - 1].LatLong, maxdist, bearing);
                    pointsarray.push(newpoint);
                    break; //exit loop as have maximum point reachable in time given     
                }
            }
        }
        else {
            numroutesnotfound++;
        }
    }
    
    //debug
    if (gdebug) {
        alert("routes not found: " + numroutesnotfound);
        alert("routes found: " + pointsarray.length);
    }
 
    //we have all our maximum points in each direction
    //now draw the polygon representing the points
    var poly = new VEShape(VEShapeType.Polygon, pointsarray);
    poly.HideIcon();
    gmap.AddShape(poly); //add to map
    gmap.SetMapView(pointsarray);
 
    //reset button
    document.getElementById("btnCalc").disabled = false;
    document.getElementById("btnCalc").value = "Calculate";
 
    document.getElementById("progress").innerHTML = "Proccessing complete";  
}

This loops through the routes returned in the groutesarray and first checks if the route has any distance, if it doesn’t we ignore it as is means a route could not be found between the startpoint and a specific “spoke” end point.

Now we loop through each stage of the route (there will only be one route leg) working out how far we can get along the route before the maximum time in minutes (as supplied to GetDrivingDistance as parameter mins)  is exceeded.

Once we find the 2 stages of the route that are either side of the maximum time we calculate the distance between the 2 stages of the route and the average speed along that part of the route (distance travelled / time taken). We can then work out the distance from the first of the 2 route stages to the final position possible to reach in the time given, and the direction of travel in degrees between the 2 stage’s start points. Finally we can work out the position (lat / lon) of this final reachable point by calling the GetPointAtDistanceAndBearing function again (see full code).

Now we have the point which we can reach along the route to the end point of the “spoke” in the given time limit. Finally we add this to an array and draw all the points in the array as a polygon on the map, zooming the map out using SetMapView so we can see the whole polygon.

So does it work?

As you can see in the demo, it does indeed plot a drive time polygon, which improves its accuracy as you increase the number of spokes. You can manually check a location within the polygon to confirm that you can actually reach it within the given time, and most of the time that works.

However there are a few issues…

What doesn’t work?

Well unfortunately there is a lot that doesn’t work:

1) Try centering the map near a costal region, you will see quite often the polygon drawn does not even include the start point. This is either because Virtual Earth used shipping lines to get a route (which head inland first to get to the port), or could not even find a route out to the middle of the sea.

image

2) Even in inland locations if there is not a road even remotely close to the end point of a spoke Virtual Earth will get a route to the nearest road which may be miles away in any direction. To see this for yourself change the gdebug global variable to true and see each spoke end point and each route end point ploted on the map, many of which are far apart.

3) Often the polygons points end up not plotting in order of increasing degrees around the start point mostly due to point 2 above. This can lead to points in the polygon crossing over as below:

image

4) Its SLOOOOOOWWW. As we seem to only be able to call one GetDirections at a time it takes forever to plot a map with a high number of spokes.

5) Exactly how accurate or even useful the results are is certainly questionable

6) It will of course not work if directions are not available in the region the map is covering.

7) Routes to the endpoint of the spoke might go a long way off the angle of the “spoke” to get to the final destination so getting a point along this route is never going to give a really accurate answer to the problem.

How could it be made better?

There are lots of simple ways this could be made to work better including:

1) Using country boundaries to work out when we are asking for a route in the sea and instead ask for a route to the very edge of the coast.

2) Fix the polygon points so they are in order when plotting on the map which should remove the crossing over effect discussed above.

3) Right now we are using the routleg itineraries to plot the data but these are not the exact route points but only the turn by turn points so are not as accurate. With a commercial account we could get to the full route data which might be able to be used to get a more accurate position of the polygons points.

Got an idea to make this better?

Do you have an idea for making this work better? Please add it to the comments below.

download code download code

Virtual Earth Control 100% height problem – Solved! Well almost

Friday, August 29th, 2008

Ok, so I was using the new asp.net Virtual Earth map control and looking to size it to have a 100% width and height. Like many of you out there I was experiencing the problem that I could only seem to apply the 100% width. As soon as I tried to apply the 100% height the control was not visible when the page loaded.

Well, we here at Earthware have continued to work at the problem and have managed to come up with a solution. If you put the map control within a div which is positioned absolute and has a height and width of 100% itself, then you should see it works as required. See below…

<div style="position:absolute;width:100%;height:100%;">
    <ve:Map ID="Map1" runat="server" Height="100%" Width="100%"
    ZoomLevel="4" onserverloadmap="Map1_ServerLoadMap"
    OnClientLoadMap="Map1_ClientLoadMap"
    OnClientResize="Map1_ClientLoadMap" />
</div>

However, as always things are not quite that simple!! From what we can see this works in Internet Explorer 7 and Firefox 3, but not in earlier versions of these browsers. We’ve therefore come up with a semi fix for this. If you set the height and width using the Map.Resize method in the code behind then this works on initial page load. We’ve used some javascript and hidden fields in the code in front to get the correct height and width, as below…

CODE IN FRONT:

<script type="text/javascript">
 function Map1_ClientLoadMap(sender, e)
 {
     if (document.documentElement &&
        (document.documentElement.clientWidth ||
         document.documentElement.clientHeight))
     {
       //For the fix for IE 6 and Firefox versions less than 3
       $get("clientwidth").value = document.documentElement.clientWidth;
       $get("clientheight").value = document.documentElement.clientHeight;
     }
 }
</script>

CODE BEHIND:

protected void Map1_ServerLoadMap(object sender, EventArgs e)
{
    ResizeMap();
}

private void ResizeMap()
{
    if (Request.Browser.Type == "IE6" ||
       (Request.Browser.Browser == "Firefox" &&
        Request.Browser.MajorVersion < 3))
    {
        Map1.Resize(Convert.ToInt16(clientwidth.Value), 
                    Convert.ToInt16(clientheight.Value));
    }
}

Unfortunately at this time we cannot get the resize events to work (the Resize event only fires if you manually resize the control, not if you resize the browser window) but do check back again soon as we are continuing to work on this.

Please download an example of a working case to of all of the above in action.

Mapping the Olympics

Wednesday, August 27th, 2008

For a good example of how interactive maps can be used in sporting contexts see the Olympics map on the BBC sports website.

Get an aerial view of the sporting venues with an overlaid 3d image of the sites; search the map by sporting event or landmark you want to view; click on the icons to view the information pop-up and select to have blogs and twitters shown on the map giving up to date information on what is happening around the Olympic venues.

Although the information is embedded in the overlay rather than the map imagery which limits what you can see of the actual locations, the map gives a good overview of which events the venues are hosting, plus the blogs and twitters keep you up to date with each event and all from one web page.

This is the key point to interactive mapping: a highly visual environment allowing the user to research locations worldwide without ever needing to leave the map. This is the concept behind Earthware’s interactive property mapping and travel mapping products.

SQM Meets Captain Birds Eye

Thursday, July 10th, 2008

SQM Meets Captain Birds Eye

“Captain Birds Eye” aka Georges Verdis, general manager of London Executive, is featured in the June edition of SQM magazine giving rave reviews to his “new toy” Property Bird, an implementation of our mapping solution for residential and commercial property.

We move past the slightly cheesy title to the article attempting to put the Property Bird experience into words:

“Wow, it’s amazing… Not only can you swoop down the streets from all angles, you can also make the search criteria bespoke for your requirements… these would include where the nearest Waitrose, farmers market and hairdressers with parking are situated… [and] all the practical stuff too such as council tax brackets, doctors surgeries, schooling even the days the bins are collected”. However, “due to the lack of space” the article concluded that all the other stuff “you’ll just have to search out for yourself”.

As Georges gives examples of what Property Bird can do, it becomes evident of his enthusiasm for it. But what’s the point, the article daringly asks: “It’s by far the most advanced mapping system for estate agents”, comes George’s reply. “London Executive has a page rank of four on Google when you search for ‘London Property’ simply due to Property Bird’s click rate. The map page itself has a page rank of five. It would cost a fortune to pay for that kind of presence… In the last month, Property Bird certainly paid for itself”.

Read the full article to discover more about Property Bird and find out exactly why Georges is “a very satisfied customer” and to find out more about what Earthware’s mapping solutions can do for you and hear the stories of other satisfied customers contact info@earthware.co.uk or 08456429880.

lastminute Google Earth experiments

Friday, July 4th, 2008

We came across some of the interesting stuff that lastminute have been doing using Google Earth.  lastminute have an experimental arm it seems called lastminute labs who are big fans of Google Earth and have been doing some stuff with Google Earth pretty much since it came on the market.

Some good examples include:

Flight sales through lastminute in the last minute – shows the start and end points and a line between them.  Using only the last 60 secs of purchase keeps the map nice and clean.

LastMinute products – this places the products that lastminute offer in their location in the world with interactive icons that allow you to access more information before being passed on to the part of lastminute that allows you to book.

We like companies that are innovating using mapping and congratulate the lastminute labs team!

Making more of your 3d building models

Friday, June 27th, 2008

Here at Earthware we are always keen to drive more value from the VScapes 3d property modelling presentations, completed for our property development clients. So when we heard about the new web page exporter for Google’s 3d modelling application Sketchup, we immediately saw its application to building projects.

The exporter is much more basic than the 3d model viewer from 3dVia we have previously shown on the blog but it has one advantage, you don’t need to install anything extra to see the model its works in any normal web browser!

Its really easily to use and as you can see for yourself below its pretty effective.

To read more about using the Sketchup web exporter plugin see this video tutorial. The exporter is a beta release and we would love to see more functionality in future including 360 rotation and basic zooming, hopefully the best is yet to come!

This is just another way for our clients to present their building projects adding to the established Vscapes products including videos, Google Earth models and 3d PDFs.

Government Outline Wind Farm Targets by 2020

Thursday, June 26th, 2008

With government claims that most people back today’s wind farm announcements, and the Guardian citing a new NOP poll showing 80% favour their use and 64% are happy to live within 5km of a development,

Why does it still take so long to push through planning?

stonish image 2 Residents seem to be unable to visualise new developments and feel pushed out of the planning process.  In the recent example of a proposed farm in Stonish Hill, a ‘Vscapes’ presentation (virtual landscape) for us non techies, was used to clearly engage local residents and offer an accurate depiction of the proposed development, for more info click here. Earthware, the company commissioned to prepare the presentation, created scale 3D models and then embed these with Google Earth, allowing navigation around the proposed development, and demonstrating accurate views from any location.

If the government are going to reach their stated targets, further support and more efficient processes like that used in the Stonish Hill wind farm will come to the forefront in the mind set of both local planning authorities, but perhaps more pertinently with developers, as long drawn out applications result in lower ROI, but with no major increase in government funding these additional costs would have to be raised by customers through higher bills.

A recent Sustainable Development commission report cited community engagement and environmental impacts as two key factors in the future success of wind power development in the UK, and with many applications being rejected much like the proposal for the Drummuir Estate wind farm, declined as Lord Gill said there was "no substance" to the council’s submission on the cumulative impact of the proposal, and with the 2020 deadline outlined by the government it is pertinent for developers to take notice of the added value a Vscapes presentation offers.

MultiMap the quiet mapping API revolution

Wednesday, June 25th, 2008

Many of us in the UK are used to seeing MultiMap’s maps on company websites.  They have been more or less the "de facto" web site mapping choice in the UK for years.

I’m sure most of us who are familiar with MultiMap associate them with the very simple, not very exciting, static maps where you have to reload a page to move the map or zoom, as the screen shot shows below:

image

But how many of you know they actually have a much more up to date mapping API with all the features of a typical web 2.0 mapping solution and a few unique features?

image

It seems MultiMap have been busy over the last few years. Unfortunately not many of their clients seem to have taken advantage of the new API so most of us have missed out experiencing it for ourselves.

So What’s Different About The MultiMap API?

Multimap have a few unique features to help developers get their mapping projects out of the door much quicker that are not found in many competitors mapping APIs for example:

  • Built in browser compatibility testing and handling
    This gives you a quick way to check compatibility and presents a static map solution to non compatible browsers
  • Coverage check before panning / zooming
    This allows a developer to check the availability of imagery before allowing the users to pan or zoom – really useful to stop users zooming in too far
  • Built-in ‘right mouse click’ context menus
    Allowing developers to quickly create their own custom context menus
  • Built-in client side pushpin clustering
    This can be used when you have lots of overlapping icons and has two options for how to display the overlapping pushpins
  • Client side filtering of pushpins
    You can filter pushpins quickly and simply using this built in feature
  • Map pan limiting
    A much requested feature for Microsoft Virtual Earth is already built into MultiMap’s API allowing developers to keep users within a specific boundary.
  • Draggable pushpins
    A built in method to make pushpins draggable
  • Tabbed Infoboxes
    This allows you to quickly create tabs within the map popup ‘info’ boxes – very nice for situations where you have lots of data to display
  • Innovative web services
    There are a number of webservices you can use with the API including searching by travel distance / duration, searching along routes, carbon emission calculation and loads more.
  • Clever imagery selection
    MultiMap’s user interface has some very usable features including previews of mapping styles with roads on and off

Take a good look at all these features and more at the MultiMap API demos page.

What’s MultiMap’s Future?

As some of you may know MultiMap were bought by Microsoft last year who of course have their own mapping API Virtual Earth. What does this mean for MultiMap?

In the short term it means MultiMap now have access to the brilliant imagery including birdseye photography, that Virtual Earth offers. It seems that Microsoft have made a commitment to continue developing the MultiMap API alongside Virtual Earth as an alternative solution and as you can see from its developer features quite an attractive alternative.

However what the long term plan for MultiMap and Virtual Earth is, I don’t think anyone knows quiet yet but it would be great to see some of MultiMap’s innovative features make it into the next Virtual Earth release.

Summing it all up

As you can see MultiMap’s API has some really neat features making it one of the most developer focused mapping API’s available. I encourage you at least to go and have a play with their demos.

Earthware, as specialists in bespoke Virtual Earth implementations, would love to see some of their features get built into Virtual Earth, especially the much requested clustering, pan limiting and coverage data functionality. Also MultiMap’s web services set a real challenge to other providers in terms of functionality that we would love to see ported to Virtual Earth / MapPoint web services.