In the last weeks i have been working in my entry to the SilverlightShow EcoContest, this year the theme of the contest was the International Year of Forests .
My application for the contest called Forest Findr. is based on the BIng Map Control for silverlight and Sql Spatial data, and helps you find Forests and get geolocated pictures and wikipedia information related with every forests.
It was very good to learn more about forests in the research i made for the app, i ended up going with this kind of app, because in my point of view we don’t enjoy forests enought as we should , people always talk about the bad things related to forests, and forget the positive things. And i wanted to help by providing a tool to better see the beautiful photos of forests and find ways to get to them. 2011 is the International year of Forests and we should celebrate Forests by visiting them and having fun with our family and friends. Forest Findr. can be used to find forests to visit when u go to a diffrent country or traveling around your own.
The application was build using mvvm as a pattern, and othert good pratices. I also wanted to show off the a range of key features of Silverlight. I used mmvm light (of course) and mef to implement all the mvvm related aspects, as this was a small project it was a very simple aproach but sometimes with some workarounds. The project was also build to consume services that could bring always something fresh to the application. By design the choice was to build a good interactive and updated experience that could be used right now. And geolocated information is a kind of data that is getting used even more and is updated often. So the final ideia for this project came from ProtectedPlanet.net, a maps application that has a awesome dataset of shapes of all the protected areas and attributes about each area this dataset is build from information of all countrys and federal instituitins as well as information from the comunity. Things got better when after i talked with some people on protectedplanet i was told they were building an api to that dataset so in the future we can use the same dataset. One of most difficult things of the project were the backend services and the database. In the current format of ProtectPlanet they allow users to download SHP files that contain the geo information and the metadata for each area, but they have 160 000 areas that ‘s alot of information, i download all the areas in a 800MB file. I decided to create a database in Sql2008 using the spatial data features, for this i also had to do some research and ended up discover in codeplex 2 projects that helped me SqlSpatialTools to import the shp files to sql db, and DataConnector that was a service layer to work with sql spatial data. I used the SqlSpatialTool to try import the 160 000 areas file, but unfortenly i got in some troubles because there were areas with so many points that the tool didn’t handle it very well and consumed all my computer memory, so after one week i finally went and download hundreds of files for that didn’t broke my machine and upload the shp to sql db uspeing teh geography dataty. So with a decent dataset of forests around the world i could go to the UI. I created a model ADO.NET model from the database to expose RiaServices to my Silverlight client.
The UI was built using views, and custom controls. Views were connected to the viewmodels using MEF, the map was a custom control that had some dependency propertys to help binding layers and other properties that aren’t possible to bind to in the actual silverlight map control. The views have an attached property to bind the states in the visualstatemanager to the viewmodel. I used medialement to get a florest sound going on the application and show a video of the app working in the about section. embebed custom font and some images to create the design. i also build a custom splash screen and install experience to provide a better ux to new users that aren’t developers. ALso used the autocomplete box with RiaServices to select shapes based on country’s name.
IN the services layer,to get the address of the each user that visits the app i used ipinfodb.com api to get the geolocation of the user, i used Bing GeoCode Service and Route Service, to get the routes between two places, draw them on the map, and the user could select a detour from that route and find forests in that area. I used a Xaml service that returned xaml for the layers of request areas after querying the db. There are 3 more services on the MIX, wikipedia service that was used to query wikipedia for information with the name of each area, and 2 photo services using Flickr and Panoramio public api to get geolocated photos of each place.
I used visual studio 2010 and blend to work in some design details, used for example the photoshop importer in blend to import the logo to vectorial shapes and build the logo animation that uses prespective projection to achive a 3D feeling. The app is hosted in Windows Azure with one instance , and the database is at SQL Azure
At the end this was a awesome learning experience, in the contest there were a lot of entrys this year let’s see who the judges choose to take the grande prize. As far as voting, mine is the application with more votes, but what counts is the rating of each application. I learned that i should have submitted my application at the last minute to avoid being bad rated more days.
I end this post by asking everyone to help me out and vote in my aplication with 5 leafs and send me to MIX11 , to vote no registration is required.
You can view and vote in my entry here: http://contest.silverlightshow.net/Gallery/ContestEntry.aspx?id=20 (check if you are not blocking popups)
You can view a video of the app in action here : http://www.youtube.com/watch?v=WbLq5O4AncY