locked
Converting Postcode to Lat Long and Vice Versa RRS feed

  • Question

  • 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
    Friday, October 9, 2009 6:57 AM

Answers

  • 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
    Friday, October 9, 2009 2:44 PM
    Answerer

All replies

  • 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
    Friday, October 9, 2009 2:44 PM
    Answerer
  • Thanks Tanoshimi.


    Cheers
    Rakesh
    Tuesday, October 13, 2009 12:07 PM