Background
Geostore Framework
Geostore is implemented in two layers as shown in figure 1. The first layer contains OAuth/OpenId, Membership and Access Control modules. The OAuth/OpenId module allows Geostore to act as an OAuth/OpenId consumer which means it allows users and clients to register and login to Geostore using open ids generated by other systems such as Google, Yahoo and OpenId. Membership module is used to provide user registration and authentication functionality in Geostore. AccessControl module ensures the security and privacy of geo location information.
Geostore core layer provides APIs to store and retrieve location information. It receives location information from devices such as mobile phones, specialised GPS devices, twitter, facebook and foursquare etc. The core service also provides access to location information. It maintains privacy and anonymity of users information and ensures that only desired information is provided to external systems.
There are several social, economical and commercial reasons to store location information of general public. However the way these things are stored and handled have raised several concerns about data privacy. These concerns are to the extent that generally people are not interested in sharing their personal information to organisations or other interested parties. On the contrary it is also evident that millions of people share their location publicly through social networking sites and tools without knowing the consequences of those actions.
Objective
We would like to build a system which stores and shares personal location information without compromising security and privacy of individual users. It allows organisations to use person's location information, with person's consent, without ability to track that person with the provided information.
Case studies
Highway motor authority might be interested in average speed of motorist on motor ways. Motorist would be interested in providing this information only if they are sure that authorities would be unable to track their personal and vehicle information with that data.
Geostore Framework
Geostore is implemented in two layers as shown in figure 1. The first layer contains OAuth/OpenId, Membership and Access Control modules. The OAuth/OpenId module allows Geostore to act as an OAuth/OpenId consumer which means it allows users and clients to register and login to Geostore using open ids generated by other systems such as Google, Yahoo and OpenId. Membership module is used to provide user registration and authentication functionality in Geostore. AccessControl module ensures the security and privacy of geo location information.
Geostore core layer provides APIs to store and retrieve location information. It receives location information from devices such as mobile phones, specialised GPS devices, twitter, facebook and foursquare etc. The core service also provides access to location information. It maintains privacy and anonymity of users information and ensures that only desired information is provided to external systems.
![]() |
Figure 1: Geostore framework |
Geostore implementation
Geostore is a REST based service with data stored in SQL database. This application is implemented in Asp.net and is deployed using Windows Azure.
Geostore Data Model:
Initially Geostore data model is based upon location information which comes from mobile phones. In future it will be extended to store data generated from devices and applications such as desktops, specialised GPS devices, twitter, facebook and foursquare etc. The current data model is shown in figure2.
![]() |
Figure 2: Geostore data model |
One thing to point out is that location table contains geoPosition field. This field is of data type geography. It combines values of latitude and longitude fileds in location table. The geography field allows us to use Geospatial queries which are available in Microsoft SQL Server. Although sql server supports geospatial data types but it is not yet supported by entity framework in asp.net. Therefore we have added stored procedure to insert values in location table as discussed in the Julie Lerman blog.
Geostore web service
Geostore web service
Geostore is a Windows Azure web service and it is implemented in asp.net. In this service first we have created Geostore object model and it is based on our schema which we discussed earlier. We have used Linq to SQL wizard to generate Geostore object model.
After creating Geostore object model we have implemented a Windows Component Framework (WCF) service to implement Rest based web service. This service exposes one interface called IGeoStoreService as shown below.
This method receives location data in compressed format. It decompress the file and iterates through whole stream to extract json objects. It then converts these objects into Linq to sql objects and inserts it into database.
After creating Geostore object model we have implemented a Windows Component Framework (WCF) service to implement Rest based web service. This service exposes one interface called IGeoStoreService as shown below.
namespace GeoStoreServiceWebRole { // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IGeoStoreService" in both code and config file together. [ServiceContract] public interface IGeoStoreService { [OperationContract] [WebInvoke(UriTemplate = "UploadFile", Method = "POST")] void UploadFile(Stream fileContents); }The IGeoStoreService interface defines one method called UploadFile. This method receives location data in form of stream. The format of location data is available here. The implementation of this method is defined below:
public void UploadFile(Stream fileContents) { GZipStream decompressStream = null; try { //decompress decompressStream = new GZipStream(fileContents, CompressionMode.Decompress); //Read input compressed data and get the json data back. readAndSaveJsonData(decompressStream); } finally { decompressStream.Close(); } }
This method receives location data in compressed format. It decompress the file and iterates through whole stream to extract json objects. It then converts these objects into Linq to sql objects and inserts it into database.
No comments:
Post a Comment