insert point into a geography column

Posts   
 
    
morten71
User
Posts: 80
Joined: 13-Jan-2009
# Posted on: 28-Jul-2014 16:17:03   

is it possible to insert a point into a geography column?

Something like:

StoreEntity store = new StoreEntity() { StoreGeo = geography::STPointFromText('POINT(-6.261099 53.339956)', 4326) }

?

morten71
User
Posts: 80
Joined: 13-Jan-2009
# Posted on: 28-Jul-2014 21:31:58   

morten71 wrote:

is it possible to insert a point into a geography column?

Something like:

StoreEntity store = new StoreEntity() { StoreGeo = geography::STPointFromText('POINT(-6.261099 53.339956)', 4326) }

?

using Microsoft.SqlServer.Types;

var point = SqlGeography.Point(Convert.ToDouble(model.Lat), Convert.ToDouble(model.Lng), 4326);

StoreEntity store = new StoreEntity() { LocationGeo = point };

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 29-Jul-2014 00:49:47   

Yes, it's possible, are you facing any specific issues?