I have a table with timestamp and coordinated of the GPS position. For each row I would like to get street address of the position.
Is it possible to achieve that from SQL? I found some articles describing this: [SQL Server 2008 - Convert Lat/Long to Geography Point)
But it is returning some very long string, that is not readable.
I don't need additional column, If I can just get value of Streed address it would be superb.
FOr easier understanding I am adding format of the data:
drop table #Test
create table #Test
insert into #Test (datetime, latitude, longitude)
(1673867887, 46.015652, 14.41596)
I am expecting to get Back: "Podpeška cesta 77B, 1351 Brezovica pri Ljubljani
You would have to pass those coordinates to an external geo-mapping service, like Google Maps API. Address lookup is not built-in to SQL Server. If you had a table of addresses that included latitude and longitude, then you could do a lookup using them via static methods on a Geography data type:
FYI, calling external/third-party APIs from within SQL Server is probably not the best way to do it, as it would involve CLR functions that have to be written specifically for SQL Server to use. It would be better to export the latitude/longitude to a file and have another program do the lookup, then add the address to the coordinates. You can then optionally import the address data into your database.
Thank you for the answer.
I got the street address through the connection to Google Maps API with the help of node-red.