public lineLocating() { #region //这里用的是通用方法 ExcuteSqlScript es = new ExcuteSqlScript(); //es.insertSqltableIntoMapinfo(tableName); es.createLocatingTable(tableName); #endregion eventsLookup = dc.EventLocating.ToLookup(e => e.events); eventsKey = eventsLookup.Select(e => e.Key); foreach (var p in eventsKey) { foreach (var q in eventsLookup[p]) { // Console.WriteLine(".....{0}...{1}....{2}", q.events, 3 * Math.Pow(10, -8), q.SP_GEOMETRY.STArea()); //这里剔除天线高度为0的小区,避免定位干扰? if (q.SP_GEOMETRY.STArea() > 3 * Math.Pow(10, -8)) { //Console.WriteLine("面接多少.....{0}....", q.SP_GEOMETRY.STArea()); mrPointsgeom = mrPointsgeom.STUnion(q.SP_GEOMETRY); events = q.events; } } redindex++; if (redindex > 255) { redindex = 0; } pencolor = redindex * 65535 + greenindex * 256 + blueindex; pen = "Pen (1, 2," + pencolor.ToString() + ")"; mrPointsgeom = mrPointsgeom.STConvexHull().STCentroid().STPointN(1); if (!mrPointsgeom.STIsValid()) { continue; } tsgeog = SqlGeography.STGeomFromWKB(mrPointsgeom.STAsBinary(), 4326); if (tsgeog.IsNull) { continue; } tsgeog = SqlGeography.Point((double)tsgeog.Lat, (double)tsgeog.Long, 4326); tsgeog = tsgeog.STBuffer(1); mrLinesgeom = SqlGeometry.STGeomFromWKB(tsgeog.STAsBinary(), 4326); Console.WriteLine(mrLinesgeom.STArea()); insertLocating2Sql(events, pen, mrLinesgeom); } }
public lineLocating() { #region //这里用的是通用方法 ExcuteSqlScript es = new ExcuteSqlScript(); //es.insertSqltableIntoMapinfo(tableName); es.createLocatingTable(tableName); #endregion eventsLookup = dc.EventLocating.ToLookup(e => e.events); eventsKey = eventsLookup.Select(e => e.Key); foreach (var p in eventsKey) { foreach (var q in eventsLookup[p]) { // Console.WriteLine(".....{0}...{1}....{2}", q.events, 3 * Math.Pow(10, -8), q.SP_GEOMETRY.STArea()); //这里剔除天线高度为0的小区,避免定位干扰? if (q.SP_GEOMETRY.STArea() >3 * Math.Pow(10, -8)) { //Console.WriteLine("面接多少.....{0}....", q.SP_GEOMETRY.STArea()); mrPointsgeom = mrPointsgeom.STUnion(q.SP_GEOMETRY); events = q.events; } } redindex++; if (redindex > 255) redindex = 0; pencolor = redindex * 65535 + greenindex * 256 + blueindex; pen = "Pen (1, 2," + pencolor.ToString() + ")"; mrPointsgeom = mrPointsgeom.STConvexHull().STCentroid().STPointN(1); if (!mrPointsgeom.STIsValid()) continue; tsgeog = SqlGeography.STGeomFromWKB(mrPointsgeom.STAsBinary(), 4326); if (tsgeog.IsNull) continue; tsgeog = SqlGeography.Point((double)tsgeog.Lat, (double)tsgeog.Long, 4326); tsgeog = tsgeog.STBuffer(1); mrLinesgeom = SqlGeometry.STGeomFromWKB(tsgeog.STAsBinary(), 4326); Console.WriteLine(mrLinesgeom.STArea()); insertLocating2Sql(events, pen, mrLinesgeom); } }