Click here to Skip to main content
14,239,593 members

PinPoint your exact location and show the world where you are

Rate this:
4.66 (31 votes)
Please Sign up or sign in to vote.
4.66 (31 votes)
16 Jul 2005CPOL
Geo-Locating C# Smart Client Application using the 2.0 Framework

Sample Image - PinPointImg.jpg


I have three problems I’ve been trying to solve for a while. First, the “Smart Client” buzz is beginning to dominate the technology charts and I want to have a better understanding of this new paradigm. Second, I need to start learning all the new features of the .NET 2.0 framework. Third, my cell phone is dieing and I could really use one that works.

Enter the CodeProject Smart Client Competition

I'm using this competition as a way to solve all three problems. The first order of business is understanding the nature of a Smart Client application. A solid definition is the foundation for a Smart Cliet’s architecture and design choices.

MSDN defines a smart client as follows:

“Smart clients are easily deployed and managed client applications that provide an adaptive, responsive and rich interactive experience by leveraging local resources and intelligently connecting to distributed data sources.”

This is the definition I’ll be following throughout this article to, and the definition on which this application is built. You can read here for a comprehensive explanation.

The Task

Before we get going, feel free to check out to get an idea of the end result for this application. Now, on to the task.

Google recently opened their mapping API to developers. I thought it would be interesting to combine a Smart Client application with Google’s mapping. The idea for the application is to allow a user to enter appointments (similar to Outlook), but incorporate an address or intersection for the location of the appointment. Then, that appointment could be mapped using Google’s mapping service. The problem is that Google’s mapping API requires latitude and longitude values to generate a map, and they don’t have a geo-coding service to turn an address into latitude and longitude.

The Solution

Part of our Smart Client definition the ability to connect to distributed data sources. I’m relying on the web service to turn an address into the needed latitude and longitude values. Then I’m using a custom built web service to save scheduled appointments and lat/long values to a server. That server also hosts a web site to allow anyone to view all scheduled appointmentts and see a map of where the appointment is physically located. In other words, you create appointments and anyone can see a map or satellite images of where you are at any given time!

Step 1: Geo-Coding

Geocoding is the process of taking a address (

<street w:st="on">123 Main Street, <city w:st="on">Denver, <state w:st="on">CO
) and turning it into a pair of latitude/longitude values. Luckily, provides a geo-coding service free of charge in the form of a web service. Because their WSDL isn’t 100% compatible with .NET, I created a custom web service proxy to call the remote web service to resolve addresses and intersections. This is the first of two remote data sources for the application.

Step 2: Scheduling

Our Smart Client definition requires a rich UI. This application lets you create an Outlook-like appointment tied to an address. When you create a new appointment you enter the dates, times, and the location of the appointment. Before you can save the appointment you have to verify the address. The process uses Step 1 to get the latitude and longitude of your appointment. Following our Smart Client definition, the app uses a rich UI to manage scheduling appointments. This step is in the form of a WinForms app with a very rich, "Outlook-style" UI.

Step 3: Persisting Data – Online and Offline

Out Smart Client definition says that we need to leverage both local and remote resources. To stay consistent to our definition, the application uses the Microsoft Onlinen Application Block to determine if the app is online or offline.

When the app is online, all appointments are loaded from and saved to a server via a custom web service. The web service accepts and returns a strongly typed dataset with the appointment schedule and lat/long data, and stores the data in a SQL database.

When the app is offline, all appointments are loaded from and stored am XML document in each user’s application directory (multiple users can use the app on the same machine). Then, when the application is online again, all appointments that were saved locally are sent to the remote server.

Step 4: Mapping –The Fun Part

In Step 3 the data is sent to a SQL database via a web service. Now, via an ASP.NET web site, the data is made available to the world. When you sign up to use Google’s mapping API you get a key and a sample javascript. I’m using the latitude and longitude values for the appointments saved in the SQL database to generate the required mapping script on the fly. In the script I tell the mapping API to center on the given location, add a pin icon on the location, and a popup overlay displaying the address. I’m also using the extended mapping options so a user can toggle between map and satellite view. That means you can see the actual building you’re in for every appointment! (Take a look at where I'm at right now!)

The End?

There you have it! It’s a rich UI, it intelligently connects to 2 remote data sources, it uses local and remote resources… It’s a Smart Client!

Where do we go from here? There are plenty of additions that could be made like importing appointments from Outlook, adding distance or travel directions to the map etc.. For now you have a .NET 2.0 Smart Client to play with, and the ability to add mapping to your own website if you want.

As for me – if this app is worthy of one of the 3 prize phones I’ll be sure to write a small Smart Phone app to transmit the phone’s location to my server to add a real time aspect to the mapping!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer PageLabs
United States United States
I'm the founder of PageLabs, a web-based performance and SEO optimization site.

Give your site a boost in performance, even take a free speed test!

Comments and Discussions

GeneralDraw a rectangle on google map !!! Pin
ducdinh_it18-Sep-06 16:36
memberducdinh_it18-Sep-06 16:36 
GeneralRe: Draw a rectangle on google map !!! Pin
TylerBrinks18-Sep-06 17:41
memberTylerBrinks18-Sep-06 17:41 
Questionabout the Application offline blocks !! Pin
guaike27-Jun-06 20:52
memberguaike27-Jun-06 20:52 
AnswerRe: about the Application offline blocks !! Pin
TylerBrinks29-Jun-06 3:18
memberTylerBrinks29-Jun-06 3:18 
GeneralRe: about the Application offline blocks !! Pin
guaike29-Jun-06 15:31
memberguaike29-Jun-06 15:31 
GeneralRe: about the Application offline blocks !! Pin
TylerBrinks29-Jun-06 16:16
memberTylerBrinks29-Jun-06 16:16 
GeneralRe: about the Application offline blocks !! Pin
guaike29-Jun-06 16:52
memberguaike29-Jun-06 16:52 
GeneralI geocode from cross-domain javascript Pin
Dr. Clue7-May-06 12:36
memberDr. Clue7-May-06 12:36 
In my current project, I wrote a cross-domain
javascript ( akin to googlemaps ) that
interacts with a WSDL ad hoc proxy engine
I wrote from scratch.

So I simply include the script in my web pages
and call all the WSDL services my proxy can figure

My proxy ain't perfect yet, but it supports
a pretty wide range of services.

Personally about the only thing I really like
about WSDL as used in most applications is the
documentation the WSDL files afford regarding the

If I remember , once the service goes public, I'll
stop back by with the url.
GeneralRe: I geocode from cross-domain javascript Pin
TylerBrinks10-May-06 3:39
memberTylerBrinks10-May-06 3:39 
QuestionLicensing... Pin
Rom200030-Jan-06 2:18
memberRom200030-Jan-06 2:18 
AnswerRe: Licensing... Pin
TylerBrinks10-May-06 3:39
memberTylerBrinks10-May-06 3:39 
GeneralProject doesn't work Pin
alexsantos23-Sep-05 9:59
memberalexsantos23-Sep-05 9:59 
GeneralRe: Project doesn't work Pin
TylerBrinks25-Sep-05 8:28
memberTylerBrinks25-Sep-05 8:28 
GeneralRe: Project doesn't work Pin
alexsantos25-Sep-05 10:01
memberalexsantos25-Sep-05 10:01 
GeneralRe: Project doesn't work Pin
TylerBrinks25-Sep-05 15:50
memberTylerBrinks25-Sep-05 15:50 
GeneralRe: Project doesn't work Pin
JamesHurst9-Mar-06 7:57
memberJamesHurst9-Mar-06 7:57 
GeneralRe: Project doesn't work Pin
Dynamo_K18-Oct-05 5:58
sussDynamo_K18-Oct-05 5:58 
GeneralZip File Download Pin
Member 280604715-Sep-05 22:32
memberMember 280604715-Sep-05 22:32 
GeneralDoesn't work with firefox Pin
JockerSoft18-Aug-05 4:12
memberJockerSoft18-Aug-05 4:12 
GeneralRe: Doesn't work with firefox Pin
TylerBrinks18-Aug-05 7:05
memberTylerBrinks18-Aug-05 7:05 
GeneralRe: Doesn't work with firefox Pin
JockerSoft18-Aug-05 7:32
memberJockerSoft18-Aug-05 7:32 
GeneralError communicating with geocoder Pin
tpdickerson21-Jul-05 6:49
membertpdickerson21-Jul-05 6:49 
GeneralRe: Error communicating with geocoder Pin
TylerBrinks21-Jul-05 7:24
memberTylerBrinks21-Jul-05 7:24 
GeneralRe: Error communicating with geocoder Pin
Anonymous21-Jul-05 7:44
memberAnonymous21-Jul-05 7:44 
GeneralRe: Error communicating with geocoder Pin
tpdickerson21-Jul-05 9:24
membertpdickerson21-Jul-05 9:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 16 Jul 2005


110 bookmarked