SQL Server Developer Center > SQL Server Forums > SQL Server Spatial > Converting Postcode to Lat Long and Vice Versa
Ask a questionAsk a question
 

AnswerConverting Postcode to Lat Long and Vice Versa

  • Friday, October 09, 2009 6:57 AMRakesh 5645 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello All,

                There are 2 new datatypes Geometry and Geography in SQL Server 2008. Geometry is primarily for 2D applications, distance calulating, drawing polygons etc. I wanted to know how we can use Geography Datatype.

    Apart from using Geography datatype in Virtual earth application are there any functions available using which we can store locations based on latitude/longitude using Geography datatype and change postcodes to lat long and vice versa.



    Thanks in Advance

    Rakesh

Answers

  • Friday, October 09, 2009 2:44 PMtanoshimiAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi there,

    Converting from postal code (or other address details) to latitude/longitude coordinates is a process known as geocoding .

    SQL Server does not provide any inbuilt functionality to perform geocoding, but it is possible to integrate SQL Server with geocoding web services such as the Bing Maps Web Service, or Mappoint Web Service, and then store the result as a point in either the geography or geometry datatype.

    You can view details of the Bing Maps geocode service here: http://msdn.microsoft.com/en-us/library/cc966793.aspx
    There is an example of how to call the Mappoint Web Service from within SQL Server in chapter 7 of "Beginning Spatial with SQL Server", http://www.amazon.com/Beginning-Spatial-Server-Experts-Voice/dp/1430218290
    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290

All Replies

  • Friday, October 09, 2009 2:44 PMtanoshimiAnswererUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi there,

    Converting from postal code (or other address details) to latitude/longitude coordinates is a process known as geocoding .

    SQL Server does not provide any inbuilt functionality to perform geocoding, but it is possible to integrate SQL Server with geocoding web services such as the Bing Maps Web Service, or Mappoint Web Service, and then store the result as a point in either the geography or geometry datatype.

    You can view details of the Bing Maps geocode service here: http://msdn.microsoft.com/en-us/library/cc966793.aspx
    There is an example of how to call the Mappoint Web Service from within SQL Server in chapter 7 of "Beginning Spatial with SQL Server", http://www.amazon.com/Beginning-Spatial-Server-Experts-Voice/dp/1430218290
    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
  • Tuesday, October 13, 2009 12:07 PMRakesh 5645 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Tanoshimi.


    Cheers
    Rakesh