If you are on local host, try the link below in browser: That's it and our restFul web services are ready for use: To test it, go in the browser and use the http request URL to obtain the result. The BodyStyle is set to 'Bare' as we don't want the returned json string to get wrapped automatically. The WebMessageFormat will be 'json' here, but can also be 'xml' if you feel comfortable with that. Operation contract will define a URI format that we will use to call the service. Class ' LatestPosition' is declared as a data contract so that it can be returned as a JSON string when we call the service. The interface will have one operation contract to declare the function and one data contract to declare the return type. To start, create an Interface named " IRESTfulService.cs" as below, remember to include ' System.ServiceModel' in your references. We will design a rest service that uses a specific http URL and returns the latest latitude and longitude from the database. Rest Services use simple http request response methods to send and receive data. RestFul Web ServiceÄesign the restFul web services first to get the GPS readings. In the end, we will discuss some future enhancements of our prototype. We will first design our restFul web services, then Google maps interface followed by placing 3D models and other interactions. Start and stop button will start and stop reading and updating maps with GPS data. The height of the table is resized on resize event of windows. The page design has one menu bar at the top that can enable /disable various features on maps followed by 2 div tags for both 3D and 2D maps. Now I am going to describe my code line by line and answer as many what's and why's as I can. I will list a number of future enhancements that are in my mind and some ways to do it at the end of this article. Remember what I made is just a prototype and there are large number of enhancements that can be made to make it much more complex and perfect in many ways. The orientation of the map also changes with the heading direction. The desired 3D model is also placed on the Google earth and moved accordingly. The whole process is repeated desired x number of times per second (depending on the rate of your GPS capture device) giving an effect of animation. Jquery is used to make an Ajax call to the specific rest service to get geolocation which is finally used to update maps on the browser. RestFul services structure is used to obtain the latest geolocation. I used Google maps for my 2D views and Google earth browser plugin for my 3D views. In one line: "We repeatedly pan in Google earth and move the marker in Google map to the next geolocation when available live from the server using Ajax". If you are aware of ajax, jquery, Rest Services, Google Map & Earth API and some Java, then it's just a piece of cake for you. The prototype is quite simple and there is no complex logic involved in it. English is not my first language so please don't mind any bad grammar here, as long as you get the sense of what I am writing. I am a regular lazy viewer of CodeProject and this is my first article to share the working behind my prototype. Below is the link of the video showing what we can achieve. I shall not be able to cover any video streaming part as that will be out of scope for this article and against my company's policies. In this article, I will cover the code of my prototype and the explanation side by side. Our clients are quite impressed with this and I am soon going to develop a full fledged interface. After 3 days of work, I ended up creating a successful prototype of what I desired. I also did research on Ajax, Jquery and restful services pattern so that I could interact with server side. I started my research and was impressed with bing maps initially but as they revoked their 3D maps feature, I ended up using Google maps for my solution. For the last couple of days, I have been thinking of making a sophisticated dashboard with live maps (all 3D, 2D, street view), tracking live positions of the camera, streaming video on the side with a whole lot of other information and settings to customize the dashboard view. I work for a company 'Momentum Technologies' in Australia which provides real time video streaming solutions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |