Gmaps2BirdsEye – Google maps to Birds Eye View Bookmarklet

Screen Shot 2014-03-26 at 10.28.43

Google Maps pretty much wins the map wars over Bing Maps hands down in my opinion, except for one killer Bing feature… Bird’s Eye!

captain_birdseye

Bird’s Eye really does come into its own when you’re looking at property to rent or buy, as it allows you to see a street from different angles for a unique perspective of the local topography. I made this bookmarklet to quickly switch between views of a location; so whether you want street, satellite or bird’s eye view, you can switch quickly with this bookmarket. (What’s a bookmarklet?).

To use

Drag this link to your bookmark bar.
Gmaps2BirdsEye

Locate a place of interest in Google Maps, click the bookmarklet to switch between Google Maps & Bing Bird’s eye.

So far tested this on Chrome and Firefox. Note if you fire the bookmarklet when you’re not on Google Maps it will go to Google Maps.

Here is the code..

$j = jQuery.noConflict();

if(isGmaps()){
    l=getLoc("g");
    location.href="http://www.bing.com/maps/default.aspx?sty=b&cp=" + l.lat + "~" + l.long +"&lvl=" + l.zoom;
}else if(isBing()){
    l=getLoc("b");
    location.href="https://www.google.co.uk/maps/@" + l.lat+"," + l.long+ "," + l.zoom+ "z";
}else{
    location.href="http://maps.google.com"
}
function isGmaps(){
    return(location.host.search(/^maps.google/)==0||location.href.search(/^https?:\/\/www.google.co.*\/maps/)==0)
}
function isBing(){
    return(location.href.search(/^https?:\/\/www.bing.co.*\/maps/)==0)
}
function getLoc(mode){
    if (mode=="g"){
        if($j(".permalink-button").length>0){
            q=parseQuery($j(".permalink-button").attr("href"));
            ll = q["ll"].split(",");
            return {
                lat:ll[0],
                long:ll[1],
                zoom:q["z"]
            }
        }else{
            a1 = location.href.split("@").pop();
            a2= a1.split(",");
            return{
                lat:a2[0],
                long:a2[1],
                zoom:parseInt(a2[2])
            }
        }
    }else{
        q=parseQuery(VEShell.API.shareLink());
        if (q["cp"].indexOf("~")<0){
            VEShell.API.setMapStyle("r");
            q=parseQuery(VEShell.API.shareLink());
        }
        ll=q["cp"].split("~");
        return{
            lat:ll[0],
            long:ll[1],
            zoom:q["lvl"]
        }

    }
}
function parseQuery(str){
    if(typeof str != "string" || str.length == 0) return {};
    var s = str.split("&");
    var s_length = s.length;
    var bit, query = {}, first, second;
    for(var i = 0; i < s_length; i++)
    {
        bit = s[i].split("=");
        first = decodeURIComponent(bit[0]);
        if(first.length == 0) continue;
        second = decodeURIComponent(bit[1]);
        if(typeof query[first] == "undefined") query[first] = second;
        else if(query[first] instanceof Array) query[first].push(second);
        else query[first] = [query[first], second];
    }
    return query;
}

This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *