SQL Server Developer Center >
SQL Server Forums
>
SQL Server Spatial
>
Converting Postcode to Lat Long and Vice Versa
Converting Postcode to Lat Long and Vice Versa
- 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
- 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- Proposed As Answer byChunSong Feng -MSFTMSFT, ModeratorMonday, October 12, 2009 8:54 AM
- Marked As Answer byRakesh 5645 Tuesday, October 13, 2009 12:07 PM
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- Proposed As Answer byChunSong Feng -MSFTMSFT, ModeratorMonday, October 12, 2009 8:54 AM
- Marked As Answer byRakesh 5645 Tuesday, October 13, 2009 12:07 PM
- Thanks Tanoshimi.
Cheers
Rakesh


