Virtual Earth Mobile
When MSN’s Virtual Earth website came online a few months ago, naturally the first thing I did was try it on a Windows Mobile device. But the website is pretty advanced; it pushes the envelope of what you can do with a pure browser-based app using DHTML, JavaScript, and AJAX. And, unfortunately, IE Mobile couldn’t render it. But not being able to access map data on a mobile device just seemed wrong, so I set out to write a Windows Mobile app that could access Virtual Earth’s maps.
The first step was to figure out how the website worked. There was no SDK, but viavirtualearth.com had info on how to use VE’s JavaScript control to display a map. Of course, I already knew that that JavaScript control wouldn’t work on Windows Mobile, but at least now I knew where to find the source code for the control (MapControl.js). The source code was thankfully not obfuscated, but it didn’t have any whitespace or comments either (presumably to decrease download time). Now my job basically consisted of adding whitespace to the functions I cared about, and staring at the code until I figured out what it was doing. And what it was doing was taking four values – latitude, longitude, zoom level, and map type – and encoding them into a URL. The URL points to a pre-rendered jpeg or png image, called a tile, on the Virtual Earth servers. (Each tile is 256 pixels square.) So once I knew that, I knew I didn’t need the JavaScript control at all, I just needed to take those four values, do a bunch of math and transforms to construct a URL, download the URL, and display it. Then lather, rinse, repeat until I had filled the screen with tiles. I wrote a C# app to do exactly this, and that’s how Pocket Earth was born. (I later discovered there already was an app call Pocket Earth, so I renamed my app Virtual Earth Mobile.)
But the Virtual Earth servers can do more than just serve up map tiles; they can also do various flavors of searches. The simplest search is to search for an address: you take an address string (e.g., “429 Columbus Ave., Boston, MA”) and do an HTTP POST request to https://207.46.159.133/search.ashx and you’ll get back a JavaScript string like “SetViewport(latitude1,longitude1,latitude2,longitude2);” The four coordinates specify a rectangle on Earth where the address is located. For a street address, which is essentially a point, a rectangle might not make sense, but if you had searched for, say, “Massachusetts”, you’d definitely need a rectangle. You might be wondering what the “SetViewport” is for; why not just return four coordinates? Well, VE’s JavaScript control has a SetViewport function, so you could just have JavaScript evaluate (“eval”) this string, and it would cause the Map Control to display the rectangle specified by the four coordinates. (Since I don’t have a JavaScript control, my app manually parses out the coordinates.) There are more details about how to do this kind of search on https://viavirtualearth.com/vve/Articles/3.ashx.
The second kind of search is a search for a business. Suppose you are looking for restaurants in Boston. You do the same sort of HTTP POST request to https://207.46.159.133/search.ashx, except now you pass in “Restaurant” and the four lat/long coordinates that bound the area you want to search, and you’ll get back a string containing up to ten search results, each one including the business name, phone number, address, and lat/long. You also get back a boolean indicating whether there are more search results. If there are, you can make another request (passing in a different starting index) to get the next batch of ten. (As with the first kind of search, the string you get back is a JavaScript expression. Using C#’s RegEx class makes it relatively easy to parse.)
New Windows Mobile 5.0 APIs made it easy to add two features. The first is “Find a Contact”: pull an address out of your Contacts list and map it. Using the new ChooseContactDialog() and the WindowsMobile.PocketOutlook.Contact class, this whole feature took ten lines of code. The second feature is the GPS feature: read your current position from a GPS device and map it. That was also ten lines of code. (The GPS classes ship as sample code in the Windows Mobile SDK; they’re not in ROM.)
I said at the beginning that I wrote Virtual Earth Mobile because I wanted to bring map data to mobile devices. That’s true, but the truth is there were a lot of reasons:
• I wanted to get experience writing a full-fledged managed app.
• I wanted to dogfood our own development tools, and get some sense of what it’s like to be a Windows Mobile ISV.
• I thought it would be fun. I wrote it in my spare time; the running joke was that whenever I came back from vacation the app would have new features.
Having road maps available anytime anywhere is very practical. Adding satellite/aerial photos isn’t a huge jump in practicality, in my opinion, but the photos certainly are fascinating to look at. There are all sorts of fun things you can do with them:
• Look at your house from the air. (This is the first thing everyone does.)
• Discover there’s a cemetery you never knew about less than a half mile from the house you grew up in. (Okay, maybe that’s just me.)
• Check out famous landmarks (Space Needle, St. Louis arch, …)
• Try to find photos where you can make out individual people.
• Quiz your friends to see if they can identify places from the air. (Here’s one to get you started: https://windowsmobile.members.winisp.net/ve.jpg.)
I’ve always enjoyed looking at maps of unfamiliar places; it’s like taking a virtual tour, and now aerial photos make the tour a little less virtual and a little more real.
The Virtual Earth Mobile app, its help file, and its source code, are all on https://viavirtualearth.com/vemobile. The app is free, and the source code is under a Shared Source license. If you want to know more details about how to download images from the Virtual Earth servers, or how to do a search, the source code is the place to go.
- Jason Fuller
Comments
Anonymous
October 24, 2005
So where is ve.jpg?Anonymous
October 27, 2005
That's easy! Walt Disney World. Disneyland's Main Entrance area is much smaller. You can clearly see the floral Mickey. :)Anonymous
October 31, 2005
When I open Virtual Earth Mobile i get the following error:
"An unexpected error has occurred in VirtualEarthMObile.exe.
Select Quit and then restart this program, or select Details for more information."
If I select details, it says:
"VirtualEarthMobile.exe
Exception
Application::Run+0xf
FormPocketEarth::Main_0xa"
I am running this on my samsung i730.
Thanks
Jeff
jms42200@yahoo.comAnonymous
November 06, 2005
The comment has been removedAnonymous
November 08, 2005
Speaking of the GPS access: "(The GPS classes ship as sample code in the Windows Mobile SDK; they’re not in ROM)" - I understand here that you are referring to the managed bits (and I have found the sample), but where is gpsapi.dll? I cannot locate that DLL on my device (Qtek 9100) nor on any WM5 emulator.
It is my current understanding that a GPS receiver has to expressly support the GPSID for a WM5 device to be able to manage access to a GPS receiver (i.e. the WM5 GPS control panel applet will not be able to 'manage' a generic BT GPS receiver) - is my understading correct? ...which would explain why the GPS functionality in VEM appears not to work for my device/GPS receiver combination. Correct?
Thanks..and great post on VEM. I would be great if you guys (WM team) would blog abit about GPS / GPS control panel applet in WM5. :)Anonymous
November 13, 2005
I would also love to see more information about GPS / GPS control panel applet in WM5. :)Anonymous
December 18, 2005
Hello,
Great software..
I have the hp ipaq 6516 messenger phone with pocket pc 2003 with a square screen (240x240) device. Is it possible to fix the virtual earth mobile to work with that square screen.
When can you add the GPS support for the pocket pc 2003 and can you add direction help with the GPS. The virtual earth software + GPS will guide the user to a given address.
Thank you,
Vlad.Anonymous
December 31, 2005
Can I save a map or an aerial on my PPC and if so how?
Great program!
FredAnonymous
January 05, 2006
To respond to a few questions posted here:
1. Gpsapi.dll should be in the Windows directory of any Windows Mobile 5.0 device. gpsapi.lib is in the SDK.
2. "It is my current understanding that a GPS receiver has to expressly support the GPSID for a WM5 device to be able to manage access to a GPS receiver (i.e. the WM5 GPS control panel applet will not be able to 'manage' a generic BT GPS receiver)" This is not true. GPSID can talk to any GPS device on a COM port (which they all are). It should work with any Bluetooth GPS receiver. The catch is that Smartphone did not ship with a GPS control panel, and the control panel is what configures the API. For example, it tells the API what COM port the GPS is on. We have a control panel we hope to release soon as a power toy.
3. There is no direct way to save a map to your PPC. For what it's worth, the cached map tiles are stored under Application DataVirtual Earth Mobile.Anonymous
February 19, 2006
I had an interesting experience with a cool Windows Mobile app last night. I was invited for dinner to...Anonymous
February 20, 2006
I figured I might as well ask here, since although I've been looking around, I have yet to find an answer that works.
I have the Pharos GPS-360 (the one that ships with MS S&T 2005) with a Bluetooth dock so that I can use it with my WM5 PocketPC device. I have the following settings:
Pharos iGPS-BT (COM8)
Incoming Port (COM6)
I can get it to work just fine with Pocket Streets on COM8... but I can't for the life of me figure out how to configure the WM5 GPS control panel applet so that I can use the GPS with Virtual Earth Mobile. Any suggestions?
I've tried all the combinations with the following:
Programs: COM6/COM8/GPD6/GPD8
Hardware: COM6/COM8
Baud rate: 4800
Thanks!Anonymous
February 27, 2006
I'm having the same problem as Mitchell. I have the Pharos GPS-360 w/ Bluetooth dock and can't get it to work with the WM5 GPS control panel and Virtual Earth Mobile.
I have Mapopolis and Pocket Streets & Trips working with the GPS receiver, but they don't use the GPS control panel. They use the COM ports I set up in the Bluetooth COM port setup. I'm using COM6 for incoming and COM7 (4800 baud )for outgoing in the Bluetooth COM port setup.
I've tried every combination of COM6 and COM7 in the GPS control panel with no luck. Can anyone help?
ThanksAnonymous
February 27, 2006
A couple more questions...
In the Bluetooth COM port setup, the COM ports are referred to as "incoming" and "outgoing".
In the WM5 GPS Control Panel, they're referred to as "program" and "hardware".
How do they relate? Is the "incoming" port the "program" or the "hardware" port?
Do I need to set up different ports than the "incoming" and "outgoing" ports for the "program" and "hardware" ports?
ThanksAnonymous
February 28, 2006
hi.
This is a cool software!
i just downloaded it into my PC and it looks great. My friend who used to stay in US could see his college clearly with the cars park by.
The driving directions and turn to turn map, totally handy.
However, I am from Malaysia and I really hope that i will be able to fully use this software. Is there any way that Malaysia/India/China map will be incorporated into this software?
THanks,
Tina.Anonymous
April 05, 2006
On many Windows Mobile 5.0 devices the GPS control panel function is missing. To get access to the GPS control panel, you have to edit the registry. HKLMControlPanelGPS settings. Delete any "Redirect" values, and add new DWORD value name: "Hide" value:"0" and name: "Group" value:"2".
When you setup a bluetooth device, add an outgoing port and assign a com number.
In GPS control panel the GPS hardware port should be set to the com port you chose during BT setup. The GPS program port is the port used by the applications.Anonymous
April 08, 2006
Is it possible to specify the folder in which the cached map .jpeg files are stored?
Currently the jpegs are stored in /Application Data/VirtualEarthMobile/
I'd like to have them stored in a folder on my SD storage card,
say /Storage Card/Application Data/VirtualEarthMobile/
I'm running Windows Mobile 5 on an O2 XDA Exec
ROM version 1.13.82 WWE
ExtROM version 1.13.188 WWE
Many ThanksAnonymous
April 28, 2006
OziPhotoTool takes the digital photos with EXIF metatdata, and tracks that have been downloaded to OziExplorer to determine where the GPS was when the photo was taken. As long as the GPS was in the same location as the camera this represents the location of the photo.
http://www.yaodownload.com/video-design/miscimagingtools/oziphototool_miscimagingtools.htmAnonymous
May 02, 2006
"Of course, I already knew that that JavaScript control wouldn’t work on Windows Mobile..."
Does JavaScript work on Windows Mobile 5.0? An HP tech told me it was released in November 2005, but later you talk about Windows Mobile 5.0 APIs. So I do not know if you are saying that JavaScript does not work on Windows Mobile 5.
I am on Windows CE 4.21 where JavaScript does not work.Anonymous
May 05, 2006
so does this cost money to use? ie gprs costsAnonymous
May 10, 2006
Would the GPS control panel show on the t-mobile SDA running WM5?
The reg key for GPS did not exist so I created it and the values, but nothing happens. I'm trying to get the SDA to work with the teletype GPS receiver.Anonymous
May 24, 2006
Firstly,I must congratulate you on this great application!
Checking the source code,I found out that the making of the "fetch"-tile-url is changed in "MapControl.js" v2. Is it possible for you to share the new logic of this url in some way. How is the tile filename built?The new MapControl.js is really hard to sort out!
Any help is much appreciatedAnonymous
May 27, 2006
where can i find support for this program? Is the newest version 3 causing problems for anyone else? the WIFI "find me" no longer works and find business no longer works either. I have uninstalled and reinstalled with no luck.. anyone? otherwise this is a killer program. thanks a bunchAnonymous
May 29, 2006
The comment has been removedAnonymous
May 29, 2006
The comment has been removedAnonymous
June 09, 2006
The Virtual Earth server chnaged their interface, which broke a few things in VE Mobile, including driving directions, WiFi, and Business Search. I'll try to have an updated version available in a few days.Anonymous
June 10, 2006
Thank you Jason. Look foward to seeing the new version. Be happy to test for you if you need it.. Dr. Neil has my email address if you wish.Anonymous
June 22, 2006
Mr. Fuller, how will we know that the version has been updated?Anonymous
June 28, 2006
This is a great app!! I'm using PPC 2003 on a iPaq hw6515 and the internal GPS is not working (as mentioned by Jason) Will this be ever added..??
Also, to the folks browsing this page.. Are there similar apps out there for PocketPC where maps are loaded on demand (like this one) and GPS is supported..??
Thanks,
--NathanAnonymous
June 28, 2006
I'll take part of my previous comment back..
The Find by GPS works after I specify the COM port (COM 7 for me..) Still, I'm looking for advanced GPS support like driving directions and such.. Any similar apps out there..??
Thanks,
--NathanAnonymous
June 29, 2006
Wonderfull tool!! (I also use ArcPad, GPS Tuner, PocketEarth, VitoNavigarorII, VisualGPSce, LocBrowser, PocketNavigator)
I easily got it to work with my Holux Bluetooth GPS. I moved the install files to my SD card, so the software link to the help file is broken. It would be nice to have + and - icons side by side instead of the separatly located Zoom Out and Zoom In menu items. Moving (dragging) the map by hand would also be nice.) Got the driving directions done too. Wonder if I go out now, if all the necessary maps have been properly stored on my unit...
Great work, thanks.Anonymous
July 04, 2006
I have installed Virtual Earth Mobile on my MDA Vario. I cannot get my Holux 236 Bluetooth GPS to be recognised.
It is on com 6 and can be seen by Tom Tom and Route 66.
Any thoughts anyone?
Great program guys.Anonymous
July 06, 2006
i got it working on my dopod 577w with a CNAV1000 with differential correction from a beacon in Singapore.
But the map of singapore is very very brief.
CheersAnonymous
July 08, 2006
can someone tell me how can i get a copy of the map of singapore and use it on virtual earth mobile ?Anonymous
July 14, 2006
send me the link of pocket earth for smartphone mpx220Anonymous
July 20, 2006
i need a software for pocket pc 2003.GPS in india including road maps and streets.
THANKING YOU,
sandyAnonymous
July 23, 2006
I couldn't browse some sites which require virtual java machine support, and also for same reason, I couldn't use Google Earth to view satelite images of various places of earth. All these above I can do in my destop but not in my newly bought hw HP iPAQ 6516 windows mobile.
So, Please help me with the java support.Anonymous
August 03, 2006
The comment has been removedAnonymous
August 18, 2006
Hi. Great app!
I've been unable to get BTGPS on my Cingular 2125 and CoPilot BT GPS.
I've added the New Outgoing Port to port 6 and tried port 7, and no luck. Any ideas?
Thanks!Anonymous
August 22, 2006
Hello Jason,
Thank you for the nice app.
One suggestion--add the traffic capability of Virtual Earth. Google Maps for Windows Mobile has now added that capability, it would be great if Virtual Earth Mobile could do so as well.
Thanks againAnonymous
August 24, 2006
I love the software, and I am running it with a Pharos GPS and Cingular 2125. I have one suggestion - can we have the GPS location update in real time, or once every 5 seconds? It would be a great effect to trace current location without having to click the button continuously.Anonymous
August 24, 2006
The comment has been removedAnonymous
August 26, 2006
I'm trying to use VEM with a verizon xv6700 and the screen is just white. Iv'e typed in addresses and States and Cities and it cannot find any of them. The wi-fi connection is fine so why is there no map?Anonymous
September 07, 2006
I have the same problem that Jason described a while ago:
"When I open Virtual Earth Mobile i get the following error:
"An unexpected error has occurred in VirtualEarthMObile.exe.
Select Quit and then restart this program, or select Details for more information."
If I select details, it says:
"VirtualEarthMobile.exe
Exception
Application::Run+0xf
FormPocketEarth::Main_0xa"
I have a T-mobile MDA (HTC Wizzard)
Thanks
Freddy
You can contact me at http://www.freddyreyes.comAnonymous
September 07, 2006
I get the same error as Freddy Reyes but on a Sprint ppc-6700. It's running the latest version of the sprint software with .net cf 2.0. I don't know if that is the problem (the 2.0)
The app seems to install fine but wont start. Throwing the exact same error as the one Freddy shows.Anonymous
September 20, 2006
The comment has been removedAnonymous
September 22, 2006
On regard of the problem that I had with VEM:
"When I open Virtual Earth Mobile i get the following error:
"An unexpected error has occurred in VirtualEarthMObile.exe.
Select Quit and then restart this program, or select Details for more information."
If I select details, it says:
"VirtualEarthMobile.exe
Exception
Application::Run+0xf
FormPocketEarth::Main_0xa"
I was able to fix it, following these steps:
1- Uninstall VEM
2- Delete the install directory (if still exits after uninstallation)
3- Delete the follwing directory: "Application DataVirtualEarthMobile"
4- Reinstall VEM and run it
5- That's all that you need to do and now it should work fine (it worked for me).
Thanks
Freddy Reyes
http://www.freddyreyes.comAnonymous
October 13, 2006
The comment has been removedAnonymous
October 18, 2006
I also have the same problem with the version that removed the menu option. However, I noticed that on the last version before the menu option was removed that I could not use the WM5 system connections GPS program port but rather had to the actural Bluetooth serial port COM8 in order to get it to work. Now (with the latest version) it can not find the Bluetooth GPS port via the system/connections/GPS Programs port (COM0).Anonymous
October 20, 2006
Thank you so much for this great post about <a href="http://eteamz.active.com/kellyleander/files/contractor-license.html"">http://eteamz.active.com/kellyleander/files/contractor-license.html" title="contractor license">contractor license</a> and [URL=http://eteamz.active.com/kellyleander/files/contractor-license.html]contractor license[/URL]Anonymous
October 20, 2006
Nice software. Is there a way to download the map on my computer and then transfer it to the Tmobile MDA? I've been using it on the MDA... but downloading all of San Francisco at various zoom levels is a very tedious process on the device. I want to pre download the map and transfer it to my storage card.Anonymous
October 26, 2006
Very informative post about <a href="http://alisaadams.bravehost.com/melatonin.html"">http://alisaadams.bravehost.com/melatonin.html" title="melatonin">melatonin</a> and [URL=http://alisaadams.bravehost.com/melatonin.html]melatonin[/URL]Anonymous
December 05, 2006
I notice that I can scroll the display by using the joy stick. Wouldn't it be nice, , , if I could scroll it using the display. You know, putting the stylist on the display then dragging it like paper in the direction I want to see. . . You know what I mean!Anonymous
December 05, 2006
The comment has been removedAnonymous
January 31, 2007
I must be really stupid... but how do you install that sw on to your PPC. I have downloaded the file "VirtualEarthMobile.cab" unzipped on my PC and drag&drop into program file on my SD card in my PPC. But when I open the file there is nothing that can be opened except a file name "_setup.xml" And when I open it there is only a bunch of "codes" that is all "Chineese" to me. If any one could help me out I would appreciate. I would like to be able to atleast try this sw. ThanksAnonymous
January 31, 2007
OK forget about my "Stupid" question... I got it to work... I was unzipping before tranfering it to my PPC... WOW!!! great app at first glance!!! does it only get it's data via GPRS or can it also be configured to get data via wi-fi? ThanksAnonymous
February 02, 2007
The comment has been removedAnonymous
March 17, 2007
The comment has been removedAnonymous
March 22, 2007
Great Software! Only 2 suggestions: 1-Add a function to save maps or use the cached maps to work offline. 2-Add a + and - buttons to zoom more easly NicolaAnonymous
April 08, 2007
Hi, i am using a HP IPAQ 4700, WM05. Nice programm, thank you. I have a problem: The find-menu does not work here. I get a message "No search results found for" or there is an error like Format Exception application:Run+0xF FormPocketEarth: Main+0xB. Any idea ? And some wishes:
- and - buttons to zoom clicking a point in the display should center this point Greetings Uwe
Anonymous
April 18, 2007
TO SEE THE PLACE OF MOBILE USERAnonymous
May 10, 2007
Has the find address error been fixed yet? I just downloaded VEM this morning and tested but its still not working. Is there a patch or a fix or soemthing yet? Also does anyone know what com ports to use with a Pharos BT GPS and a T-Mobile MDA running Windows Mobile 5.0? Thaks in advance IanAnonymous
May 22, 2007
Nicola, if you set the cache size large enough, and set it to be on your storage card VEM will use the previously stored maps. However I have a problem related to that: I have plenty of space on my storage card, the size on my cache set large enough,but VEM crashes when trying to download new maps. Creating a new data directory fixes this but means I have to swop back and forth to access stored maps. Does anyone know if there is an inbuilt limit of 60MB in the cache? My limit is set at just under 99MB so it is unlikely that that is the problem. The problem noted by others is possibly related to cache size settings too.Anonymous
June 10, 2007
Hi, I've been using version 1.68 on an ipaq 2490b and it works great except for the fact that it crashes when I search for an address. I've tried uninstalling and removing the install directory as well as the application datavirtualearthmobile directory and then reinstalling it. I still have the same problems though. This used to work in the past, but I'm not sure what version I was using before, possibly an older one? Any solution to this? thanks,Anonymous
July 03, 2007
My this code is not running on windows mobile Internet Explorer ....why ? document.getElementById('pr1').style.borderColor = "#FF0000";Anonymous
July 10, 2007
The comment has been removedAnonymous
September 25, 2007
Please provide the latest version information on the VEM site. Please include a list of new features and fixes. By the way: When will the next version be released?Anonymous
November 03, 2007
The new HTC Tytn II has a built in GPS but V.E. will not locate it. Is there a way to get the phone's internal GPS to work with V.E. 1.69? Thanks.Anonymous
April 29, 2008
The comment has been removedAnonymous
June 11, 2008
Hi Guys, http://viavirtualearth.com/vemobile. is not available. Where can I get the source code of the application? BR, G