sql >> Base de Datos >  >> RDS >> Sqlserver

sql geografía a dbgeography?

Perdón por la respuesta tardía, pero vi esto mientras buscaba otra cosa.

Simplemente haga lo siguiente:

SqlGeography theGeography;
int srid = 4326; // or alternative

DbGeography newGeography = DbGeography.FromText(theGeography.ToString(), srid);

Para revertirlo:

DbGeography theGeography;
SqlGeography newGeography = SqlGeography.Parse(theGeography.AsText()).MakeValid();

¡Espero que eso ayude!