In this post I am going to carry on from where we last left off. For those who did not get to see our earlier posts here is [part 1] and [part 2]. Am going to briefly show you how to retrieve data, specifically from project nimbus, and put it in your app. A pre-requisite for using Project Nimbus would be an account key, which you can get by dropping them an email [projectnimbus@live.com.sg]. If you wish, you may use other datasets for your app as well.
Background
In order to develop an augmented reality application, we would need information to the Points of Interests that are near us. We can already find out our location by using the GPS sensor. We would next want to know where this POIs are, their distance
and bearing from the user/device.
We are going to use the data from project Nimbus’s Hungry Go Where Restaurant Dataset. Its available from this url: [http://api.projectnimbus.org/hgwodataservice.svc/$metadata]
More
Development
1. We are going to create a new class in our project, lets call it “Nimbus”
a. In that class we are going to write the methods needed to retrieve the restaurants that are nearby, within a 250m radius
2. Declare 3 string variables, calling them “AccountKey”, “AccountGuid” and “NimbusUrl” respectively. Instantiate the first two with your nimbus account key and a guid respectively. Instantiate the 3rd key with your nimbus dataset url.
3. Declare a WebClient type variable, and name it “NimbusService”
4. In the constructor of the Nimbus Class, instantiate the WebClient and add an event handler for it’s “DownloadStringCompleted” event.
a. Add the headers for the accountkey and guid to the “NimbusService” object of type webclient.
5. Create an event handler method for “NimbusService_DownloadStringCompleted”
a. Inside the method, ensure the result of the web client request does not contain any error. If it does, notify the user. If it does not, proceed to parse the query.
6. Create a method to parse the data from the webclient request.
7. Create an ItemViewModel class that we could store the retrieved data from, lets call it “ItemViewModel”
8. In the parse data method, do a linq query to parse your data and retrieve the name of the restaurant as well as its location. Store the name and location into the item.
9. Finally write a entry method that could be used by the main class to start the retrieval of data, we shall call this method “retrieveRestaurants”. It takes in 2 parameters, one of type GeoCoordinate which is the current location’s value, the second being the radius, in meters.
a. In that method, prepare the url string with the current geolocation of the user as well as the distance/radius of data that the user would be interested in.
10. In your MainPage.xaml.cs class, declare a global variable called “nimbus” of type “Nimbus”. Instantiate it in the onNavigatedTo event handler.
11. Previously you had a method called “callWebService”. In that method call the retrieveRestaurants method of the NimbusClass, passing in the current GeoCoordinate of the user together with the radius.
12. You now would have an application that is hooked up to live data. You can download the source code of this part from [here]
In the next post…
Now that we have all the device instrumentation setup, our data ready there remains only one last step, which is to make sense of the sensors, retrieve the proper data and displaying them on screen. We would be discussing on World space/3D space to screen coordinates projection in our next and final post in this series. Stay tuned.
4 Responses to “Augmented Reality With Windows Phone 7 – Part III The Dataset”
Gutemberg
Where is the part 4? Till now awesome article… Now I need know how to project the data into the camera feed. If you have a sample, please send me an email with it.
Thanks!
Alison
Hello, can I just check are you guys still uploading the part 4 tutorial? I’m currently building an augmented reality mobile app on window 7 phone for a school project. Thus, it will be great if I am able to get guidance through the tutorial. If part 4 is available can you guys send me the link?
Thank you! 🙂
Hillary
It’s been a great article up to now.
May I know where is Part 4 to this?
Thank you!
Chloe
Hey, may I check with you, are you guys still uploading the fourth part of the tutorial?
I’m currently building a windows 7 app for my school project which also requires Augmented Reality. It will be great if I’m able to get some guidance through the tutorial.
If you have the fourth part of the tutorial, is it alright for you guys to send me the link? Or email me?
Thank you and it’s greatly appreciated.