Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         Kimi86 
                                        Yak Posting Veteran 
                                         
                                        
                                        79 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2014-10-08 : 04:09:25
                                            
  | 
                                             
                                            
                                            | I need to convert geometry datatype to latitude /LongitudeI have just imported a shapefile to my table (geometry)This query does not work:-select geom.Lat as [Latitude], geom.Long as [Longitude] from dbo.specialError I get is Could not find property or field 'Lat' for type 'Microsoft.SqlServer.Types.SqlGeometry' in assembly 'Microsoft.SqlServer.Types'.This query returns Latitude and longitude but the format doesnot seem to match google maps:-select U.name, Centroid.STY as Longitude,Centroid.STX as Latidude from ( select geom.STCentroid() as Centroid, NAME from dbo.special )UAlso:-SELECT ST_X (ST_Transform (geom, 4326)), ST_Y (ST_Transform (geom, 4326)) FROM specialgives 'ST_Transform' is not a recognized built-in function name.Please suggest | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     James K 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    3873 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2014-10-08 : 14:57:50
                                          
  | 
                                         
                                        
                                          Lat and Long are GEOGRAPHY functions and STX and STY are GEOMETRY functions. Try this example and compare with your data to see if that helpsDECLARE @g GEOGRAPHY; -- statue of liberty coordinates from google maps.SET @g = GEOGRAPHY::STPointFromText('POINT(' + '40.689494' + ' '                                    + '-74.044545' + ')', 4326)SELECT  @g.Lat ,        @g.Long;  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |