entity framework - DbGeography polygon get points -
i have polygon persisted on sql server 2012 database sys.geography type. how can obtain points polygon?
i'm thinking use astext() method , parse string, maybe there better choice?
found way, here extension method:
public static ienumerable<myentitywithlatandlng> getpointsfrompolygon(this system.data.entity.spatial.dbgeography geo) { (int = 1; < geo.pointcount; i++) { var p = geo.pointat(i); yield return new myentitywithlatandlng(){ latitude = p.latitude.value, longitude = p.longitude.value }; } }
Comments
Post a Comment