Click here to Skip to main content
15,347,733 members
Articles / Web Development / ASP.NET
Posted 27 May 2011


13 bookmarked

Online Geocoder with interactive Map

Rate me:
Please Sign up or sign in to vote.
4.72/5 (10 votes)
29 Jun 2015CPOL3 min read
Web app to find geographical coordinates and apply them to the Bing Map


Geographic coordinates provide the unified way to identify any place on Earth. City streets could change their names and numbers, but the universal coordinate system, free of daily vanities and challenges of time, presents perpetual time-invariant values on a planetary level. Geographic coordinates system in general includes longitude, latitude and elevation (height), but the most used are the first and the second ones, namely longitude/latitude. They could be presented either in degrees:minutes:seconds (so-called DMS) format or decimal degrees (DD) format (used in the application).

Geographic coordinates could be obtained via global positioning system (GPS) devices, but this technique requires the physical presence at the point of interest. As an alternative, the geocoding software applications (or simply geocoder, or geo-locator) could be used to convert the postal addresses to the corresponding longitude/latitude pairs. Such geocoder has been built in conjunction with interactive online Map powered by Microsoft Bing™ technology, allowing different views, panorama and zooming; it is available online totally free at [1], serving both practical and didactic purposes (no registration is needed).


The usage is rather straightforward and intuitive: in order to obtain the longitude/latitude information and the map of the geographic point of interest, either in the US, or worldwide follow the steps described below:

  1. Open web browser and navigate it to the Geocoder
  2. Enter the postal address into the search box and click on the "Find" screen button. Note: places in the US could be identified just by their ZIP (postal) code
  3. Upon the completion of screen reload, which could take up to several seconds, you should be able to see the longitude/latitude of the point of interest and corresponding Bing map. You could select the preferred map view modes (road, aerial or bird’s eyes), adjust zoom level (from 1 to 19) and perform the panoramic function

Multilingual support

Online geocoder has multi-lingual capabilities, accepting search queries in many foreign languages: Spanish, German, Italian, French, Russian, Greek, etc. Below are sample test results, corresponding to the world landmarks, entered in a search query in the language of origin:

  • Metropolitan Museum, New York |  Lat: 40.779437/Lon: -73.963244
  • Grand Central Terminal, NY | Lat: 40.752726/Lon: -73.977229
  • Colosseo, Roma | Lat: 41.89021/Lon: 12.492231
  • Ακρόπολη Αθηνών | Lat: 37.971532 /Lon: 23.725749
  • Brandenburger Tor, Unter Der Linden | Lat: 52.516275 /Lon: 13.377704
  • Champs-Elysées, Paris | Lat: 48.869576/Lon: 2.30825
  • Eiffel Tour, Champs De Mars | Lat: 48.85837/Lon: 2.294481
  • Museo del Prado, Madrid | Lat: 40.413782/Lon: -3.692127
  • Cappella Sistina, Rome |  Lat: 41.902947/Longitude: 12.454484
  • Музей Эрмитаж, Санкт Петербург | Lat: 59.939832/Lon: 30.31456


The following screenshots demonstrate the usage of Multilingual Geocoder with interactive Bing Map (see Fig 1-4):

Image 1

Fig.1 Columbus Circle NY, Geo Coordinates (the distances from NY City are calculated from this point)


Image 2

Fig.2 Columbus Circle NY on the Bing Map, sample screenshot (Aerial view mode)


Image 3

Fig.3 Coordinates of the Brandenburg Gate, Berlin, Germany


Image 4

Fig.4 Brandenburg Gate on Bing Map (Bird's eye view mode)

Points of Interest

Calculation of the great-circle (orthodromic) distance between two geo-points on the Earth surface is the general GIS task. It can be acomplished by using Spherical Earth projection algorithm listed below [2]:

Module           :  GIS.cs
Description      :  Calculate distance between two geo-points on surface
Author           :  Alexander Bell
Copyright        :  2011-2015 Infosoft International Inc
DISCLAIMER       :  This Module is provided on AS IS basis without any warranty
TERMS OF USE     :  This module is copyrighted. Please keep the Copyright notice intact.
using System;

namespace BusNY
    internal enum UnitSystem { SI = 0, US = 1 }
    internal static class GIS
        #region internal: properties (read-only)
        internal static double EarthRadiusKm { get {return _radiusEarthKM;} }
        internal static double EarthRadiusMiles { get { return _radiusEarthMiles; } }
        internal static double m2km { get { return _m2km; } }
        internal static double Deg2rad { get { return _toRad; } }

        #region private: const
        private const double _radiusEarthMiles = 3959;
        private const double _radiusEarthKM = 6371;
        private const double _m2km = 1.60934;
        private const double _toRad = Math.PI / 180;

        #region public Method: Spherical Earth projection
        public static double DistanceSEP(double Lat1,
                                        double Lon1,
                                        double Lat2,
                                        double Lon2,
                                        UnitSystem UnitSys ){
                double _radLat1 = Lat1 * _toRad;
                double _radLat2 = Lat2 * _toRad;
                double _dLat = (_radLat2 - _radLat1);
                double _dLon = (Lon2 - Lon1) * _toRad;

                double _a = (_dLon) * Math.Cos((_radLat1 + _radLat2) / 2);

                // central angle, aka arc segment angular distance
                double _centralAngle = Math.Sqrt(_a * _a + _dLat * _dLat);

                // great-circle (orthodromic) distance on Earth between 2 points
                if (UnitSys == UnitSystem.SI) { return _radiusEarthKM * _centralAngle; }
                else { return _radiusEarthMiles * _centralAngle; }
            catch { throw; }


  1. Online Geocoder with Bing Map and Multilingual support
  2. The Orthodromic Distance Between Two Geo-points


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


About the Author

Software Developer (Senior)
United States United States
Dr. Alexander Bell is a seasoned full-stack Software Engineer (Win/Web/Mobile). He holds PhD in Electrical and Computer Engineering, authored 37 inventions and published 300+ technical articles. Currently focused on multiple Android/Mobile development projects and Big Data' Machine Learning, AI, IoT. Alex participated in App Innovation Contests (AIC 2102/2013) with multiple winning submissions. Sample portfolio apps and publications:

  1. Aggregate Product function extends SQL
  2. Use SQL to generate large data sequence
  3. HTML5/CSS3 graphic enhancement: buttons, inputs
  4. Advanced CSS3 Styling of HTML5 SELECT Element
  5. YouTube™ API for ASP.NET
  6. HTML5 Tables Formatting: Alternate Rows, Color Gradients, Shadows

Comments and Discussions

QuestionWanted a webservice to reference. Pin
Member 1149819230-Jun-15 7:53
professionalMember 1149819230-Jun-15 7:53 
GeneralMy vote of 1 Pin
Sebastiaan Lubbers29-Jun-15 22:01
professionalSebastiaan Lubbers29-Jun-15 22:01 
GeneralBing Maps are FUBAR because the marker(s) disappear everytim... Pin
Clinton Gallagher6-Jun-11 14:37
professionalClinton Gallagher6-Jun-11 14:37 
Bing Maps are FUBAR because the marker(s) disappear everytime a user touches the page
Generalunique!! Pin
GPUToaster™30-May-11 1:54
MemberGPUToaster™30-May-11 1:54 
GeneralRe: Thank you! Pin
DrABELL30-May-11 2:33
MemberDrABELL30-May-11 2:33 
Generalcool,my 5 Pin
Monjurul Habib29-May-11 6:47
professionalMonjurul Habib29-May-11 6:47 
GeneralRe: Thanks a bunch! Pin
DrABELL29-May-11 7:04
MemberDrABELL29-May-11 7:04 
GeneralNice one Alex. 5! Pin
thatraja27-May-11 16:52
professionalthatraja27-May-11 16:52 
GeneralRe: Many thanks! Pin
DrABELL28-May-11 1:28
MemberDrABELL28-May-11 1:28 
GeneralRe: ccccccccc Pin
thienthanit31-May-11 15:53
Memberthienthanit31-May-11 15:53 

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.