Many of us spent a LOT of time rooting around the damned JS files
If it hadn’t been for ViaVirtualEarth, I would probably have bagged working with VE.
But now, there is an SDK. It’s pretty light, but something. And there is a new search control I heard about during PDC. You can get that in the SDK area as well.
Don’t Forget: www.acehaid.org
I’ve been fiddling some more with Virtual Earth Ink.
I discovered that there are cases where the tiles don’t get realigned before going over to the inking interface. In order to realign the tiles, I need to use the map object’s SetCenter command and pass in the current lat/long values of the map.That actually calls SetCenterandZoom, before recreating the map anew with fresh tiles (in the order that I need them). This is creating a big problem for me. When I zoom, I need to realign the tiles. But in doing so, this puts me in an infinite loop. So I have to come up with another way around this. In the meantime, if you pan a bit after zooming, the pan will fire off the realignment. Then when you go to INK the tiles, they will be in correct order.
The other thing I have been playing with is setting pins upon a search, which is not a problem. However, I want to persist the pins to the inking surface. I know how to do it, but am having trouble with calculating the position. I just have to keep at it, which of course, I will.
If you are planning to program with Virtual Earth
by David Flanagan though it looks like I’m behind a few editions.
Channel 9 gets the inside scoop on Virtual Earth from the VE team. Watchiing this video really opened my eyes up to the amazing capabilities of this technology. I have barely tapped it in my Virtual Earth does Ink application.
There is a website at www.virtualearthinfo.com with a compilation of links and info regarding VE. And MSN is hiring!
Posted from BLInk!
I have been working with Virtual Earth some more. I wrote recently about the tiles that make up the map image and have made some new discoveries.
When you create a new map, the tiles collection has the tiles in the order of their placement in the grid, by column, as opposed to by row, like a <table> object builds a grid. So in a map of 12 tiles, map.tiles through map.tiles are placed like this.
However as you pan (scroll) around the map image, VE just keeps adding tiles to the end of the collection based on your movement. Therefore, when you stop scrolling, the tiles will no longer be in any order that you can count on, which is not good if you have code depending on the above order.
To rectify this you can use two methods of the map control to jiggle the tiles back into “proper order”.
Capture the onEndContinusPan
event of the map and then use the SetCenter
method followed by the _UpdateMap
map.onEndContinuousPan = function(e)
I had originally tried to just create a new map when the panning ended, but I was unable (by hook or by crook) to get the compass control, zooming controls, etc to interact with the new map.
Thanks to ViaVirtualEarth for the lesson on how to capture map events.
I have been experimenting with VirtualEarth to understand the structure of the map image.
The map image is made up of tiles (map.tiles). It basically builds a grid of image objects. Each quadrant of the grid is a tile and literally points to an image file (png) on the VirtualEarth website. The tile object has a lot of members, the most important one to me is the property “f” which returns the uri of the image that makes up the tile.
The tile size and number of tiles that make up the image will vary based on the zoom level of the map. Then the tiles are placed in a DIV that has a hidden overflow which is why you can grab it and move it around within it’s bounds. If you want to see this, look for map.element.outerHTML while debugging.
When you request a map from Virtual Earth, it returns the html that makes up the map. This is a DIV with a whole bunch <img> tags pointing to the various urls of the images at VirtualEarth that make up the map. For example: “http://tiles1.virtualearth.msn.com/tiles/r02211.png?g=1“.
You can see this DIV within the “map.element” object.
Since VirtualEarth works out the html in advance and returns it to us, we just get back the DIV and the images with their positions. Since the solution I am working on to ink enable this stuff requires that I know how to rebuild them, I will have to create a little function to determine what the dimensions of the resulting “grid” are. I have gotten 3 x 5, 3 x 4 and 2 x 2 so far. So I can’t count on a pattern.
One other thing that I can tell you is that so far I have not found any property or method that will return the image data of a tile. So after an enormous (you don’t even want to know…) amount of experimentation, I have found the best way to get at this data (since I need it for my solution) is to build a web service that streams the image data back to me. Dr. Neil appreciates the irony of this, because Virtual Earth is built on MapPoint web services – so I am writing a web service to wrap a web service!
From Via Virtual Earth
Test the methods of the Map control
I have added this test page to the Gallery that shows methods on the Mapcontrol and how to use them.
Now all we need is for someone to do the same thing for the VE.js scripts.
Anyone feel like they want to do this?
VirtualEarth is interesting but quite undocumented when it comes to developing against it. Luckily, Neil Roodyn (that’s Dr. Neil) has had a great head start with Virtual Earth and has created the Virtual Earth developer center “ViaVirtualEarth”. There are already some articles on getting started and a …[read more]
[A DevLife post]