Tad's IT Blog
Posts tagged maps
Bing Maps: Suppressing the Bird’s Eye Popup
Sep 28th
When I was working on my last Bing Maps project for Webworld Technologies, my Microsoft rep told me, “…and as soon as you’re ready, let me know and I’ll give you a hack to disable that f’n birds-eye popup”. I didn’t know that was the official inside term for it, but like so many internal naming conventions that stick with you, I felt it was appropriately named. I think the Bing bird’s eye view is a fantastic way to visualize maps too, but the little “VIEW THIS IN THE COOL BIRDS EYE VIEW” popup that comes up every time you refresh the map is a bit far into the “annoying UI element” department.
To disable it, just do the following: right after invoke your map.LoadMap, hide the popup element as follows:
map.LoadMap(new VELatLong(38.865326, -77.074930), 12 ,’h’ ,false);
// Suppress popup saying Bird’s Eye available
document.getElementById("MSVE_obliqueNotification").style.visibility = "hidden";
That will get rid of that popup any time the map loads.
KML on Bing Maps: Beyond the 200-item Limit
Jul 6th
In importing KML into a Bing Maps (nee MS Virtual Earth) map, you will run into a limit of how many items or shapes it will allow you to render.
The reason for this is performance, as it’s generally understood that one will start getting degraded performance as you go up over 200 shapes being put on the map at any one time. Well, I did indeed experience such in IE8, but not in Safari, Chrome or Firefox – so, many of us may want/need to put more than their default 200 shapes on the screen.
To do this, you use the MaxImportedShapes property of the VEShapeSourceSpecification class (defined here), done something like this:
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>
<script type="text/javascript">
var map = null;function EventMapLoad() {
var shapeLayer = new VEShapeLayer();
// var shapeLimit = new VEShapeSourceSpecification.MaxImportedShapes = 500;
var shapeSpec = new VEShapeSourceSpecification(VEDataType.ImportXML, http://myhost.com/myKmlFile.kml, shapeLayer);
shapeSpec.MaxImportedShapes = 500;
map.ImportShapeLayerData(shapeSpec);
}function CreateMap() {
map = new VEMap(‘myMap’);
map.onLoadMap = EventMapLoad;
map.LoadMap(null, 3, VEMapStyle.Hybrid);
}
</script>
This will set the maximum number of shapes to 500. I haven’t tested with much more than that, so performance will almost certainly be intolerable if you kick that up to 1000 shapes plus.
Using Bing Maps with a KML Feed – Successes & Failures
Jul 3rd
I’m in the midst of doing a development project with Bing Maps, using their nifty feature whereby you can create a polygon ‘collection’ in their UI toolset, and then publish this out to a KML file, which you can then import back and overlay back onto the map and be able to display it in all sorts of interesting ways (i.e. in their birdseye mode, 3D Google-earth-style mode, etc.).
Unfortunately, it hasn’t been the smoothest road, and I’m looking to find a support community that can help me through this.
The first hurdle is that you can’t develop on KML using just your own box. I.e., you can’t host the KML file on your local web server or an internally-located dev server. In order make KML overlays work in Bing Maps, the KML file has to be on an internet-accessible machine. This is due to the fact that the sequence works like this – if you want to display a file like “myoverlays.kml” on your map:
1. You specify the KML overlay as a shape in your Bing Maps code, like so:
function EventMapLoad() {
var shapeLayer = new VEShapeLayer();
var shapeSpec = new VEShapeSourceSpecification(VEDataType.ImportXML, http://blog.reevestech.net/wp-content/uploads/arlington-combined.kml, shapeLayer);
map.ImportShapeLayerData(shapeSpec);
}
This will then load that KML file when the page loads.
2. When the page loads, the Bing Maps JS then grabs your KML file off the server, and sends it back to Bing to be transformed into a “collection” markup that the Bing JS can use. If you check your Firebug action when loading a KML file as above, you’ll see a request for something like this:
Note that it has my URL in the request. The response you get back from the server is something of a “Collection Markup” or “CML” schema, which is basically the same XML data as the KML, but obviously piped through some XSLT at Bing’s end to make it acceptable for their JS.
3. With that data returned successfully to the client’s browser, the KML should then render on the map area of the user’s machine.
Now, where it gets tricky for me is this: I’m trying to dynamically generate a KML file to be returned when the user goes to the page.
Now, for some reason – the Bing Maps KML parser seems to work when the data is served off of Apache, and works when served statically by Resin — but not when served dynamically from a Resin/Railo ColdFusion server.
I can’t tell why this is, but something in the request is making the Bing Maps KML parser bail out. Below are WGET samples – one where the request is going through Resin statically, the other is where it’s being parsed by the Railo CF servlet. Same exact file, nothing different.
Any clues, anyone?
Displaying a KML Feed on Bing Maps
Jun 24th
Okay – while not exactly where I wanted to be, I now see that I’m able to easily display a KML feed in Bing Maps (the artist formerly known as Microsoft Virtual Earth) by appending a “mapurl” parameter to maps.bing.com, and then feed it in the URL to your KML file. Like
For example, if you click through on the link above, you’ll see the KML file that I generated from my Flickr cross-country set, then superimposed on Bing Maps, with a nicely-formatted sidebar containing all of the other various metadata stored in the KML file.
I’ve still not been able to get their other sample to work, probably due to some sort of mime-type issue, but the above is a pretty nice feature.
Google Transit Still has Massive Holes
Jun 16th
I just read on the C|Net Download Blog that:
“…As with the online version, Google’s Transit works in 250 cities.”
The blog post is describing how the Android OS now supports voice as well as transit instructions. Now, fortunately or unfortunately, the editor of this blog was in San Francisco, where all features of Google’s Maps & Earth service are working at their best. However, as an owner of an iPhone, I am many times at the mercy of the massive holes that unfortunately still remain in this service. Now, if Google would specifically say that they don’t offer Google Transit in my area (the DC Metro area) then I would just be pleasantly surprised when data starts to populate in my phone regarding bus stops and metro stops.
But, when just looking up how to get from where I was in Arlington to Downtown DC, I ran into this:
The location where I was, was fairly close to a Metro rail station. So, I punched in directions on how to get to the Metro station, and thence to downtown.
The directions I got back clearly show that only the BUS is loaded into Google Transit’s coverage of the DC Metro area, and not the train. This is despte the fact that the train is marked perfectly in Google Earth, but somehow did not make it into the Google Maps / Google Transit data space.
So, from Arlington, it has me first walk to the Metro station. Then, it has me take a GWU Shuttle bus about an hour away from DC to Ashburn, VA, to the George Washington Ashburn campus, and then hop on another bus all the way back in to DC, and then to walk from George Washington University to my final destination in town (about 40 mins walking).
If the Metro was added, it would have simply told me to hop on the train and take it downtown, change to the Red Line, and then be 2 doors down from my destination.
Now, I can’t knock them too hard — as they do have a phenomenal service that has grown in leaps and bounds over the past year. But when you offer transit mapping to millions of handheld users, you have now exposed the data (or lack thereof) to people to really need it and could otherwise end up stranded when they start relying on their handheld device to tell them where to go.
Probably a good solution on this would be to simply not mark Google Transit service as being available, until such a time when all of the data is loaded & tested — as opposed to stat-pushing it so that it appears that “250 cities are covered” whereas the travel instructions in the 3rd-biggest metro area in the USA are not even remotely usable.








Recent Comments