当前位置: 首页>>代码示例>>C#>>正文


C# SqlGeometry.STAsBinary方法代码示例

本文整理汇总了C#中SqlGeometry.STAsBinary方法的典型用法代码示例。如果您正苦于以下问题:C# SqlGeometry.STAsBinary方法的具体用法?C# SqlGeometry.STAsBinary怎么用?C# SqlGeometry.STAsBinary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SqlGeometry的用法示例。


在下文中一共展示了SqlGeometry.STAsBinary方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QueryIntersectionsAsync

        public async Task<ResponseContainer<IntersectResponse>> QueryIntersectionsAsync(SqlGeometry geometry, string category)
        {
            category = category.ToLower();
            // include stream miles because it's aquatic
            if (category == "aquatic/riparian treatment area")
            {
                _criteria["15"] = new[] { "fcode_text" }; // nhd
            }

            // send geometry to soe for calculations
           
            var url = string.Format(
                "http://{0}/Reference/MapServer/exts/wri_soe/ExtractIntersections",
                Settings.Default.gisServerBaseUrl);

            var uri = new Uri(url);
            var base64Geometry = Convert.ToBase64String(geometry.STAsBinary().Value);
            var formContent = new[]
            {
                new KeyValuePair<string, string>("geometry", base64Geometry),
                new KeyValuePair<string, string>("criteria",
                    JsonConvert.SerializeObject(_criteria)),
                new KeyValuePair<string, string>("f", "json")
            }.AsFormContent();

            var request = await _httpClient.PostAsync(uri, formContent);

            return await request.Content.ReadAsAsync<ResponseContainer<IntersectResponse>>(
                new[]
                {
                    new TextPlainResponseFormatter()
                });
        }
开发者ID:agrc,项目名称:wri-webapi,代码行数:33,代码来源:SoeService.cs

示例2: GeoProcessingNode

 public static byte[] GeoProcessingNode(Node node)
 {
     SqlGeometry geo = new SqlGeometry();
     SqlGeometryBuilder GeometryBuilder = new SqlGeometryBuilder();
     GeometryBuilder.SetSrid(4326);
     GeometryBuilder.BeginGeometry(OpenGisGeometryType.Point);
     GeometryBuilder.BeginFigure(node.Latitude, node.Longtitude);
     GeometryBuilder.EndFigure();
     GeometryBuilder.EndGeometry();
     geo = GeometryBuilder.ConstructedGeometry;
     return geo.STAsBinary().Buffer;
 }
开发者ID:karavanjo,项目名称:osmarser,代码行数:12,代码来源:GeoProcessing.cs

示例3: lineLocating

        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);
            }
        }
开发者ID:rupeshkumar399,项目名称:seemapcell,代码行数:49,代码来源:lineLocating.cs

示例4: QueryAreasAndLengthsAsync

        public async Task<ResponseContainer<SizeResponse>> QueryAreasAndLengthsAsync(SqlGeometry geometry)
        {
            var url = string.Format(
                "http://{0}/Reference/MapServer/exts/wri_soe/AreasAndLengths",
                Settings.Default.gisServerBaseUrl);

            var uri = new Uri(url);
            var base64Geometry = Convert.ToBase64String(geometry.STAsBinary().Value);
            var formContent = new[]
            {
                new KeyValuePair<string, string>("geometry", base64Geometry),
                new KeyValuePair<string, string>("f", "json")
            }.AsFormContent();

            var request = await _httpClient.PostAsync(uri, formContent);

            return await request.Content.ReadAsAsync<ResponseContainer<SizeResponse>>(
                new[]
                {
                    new TextPlainResponseFormatter()
                }); 
        }
开发者ID:agrc,项目名称:wri-webapi,代码行数:22,代码来源:SoeService.cs

示例5: insertLocating2Sql

 private void insertLocating2Sql(string events, string pen, SqlGeometry sgeo)
 {
     sgeom = SqlGeometry.STGeomFromWKB(sgeo.STAsBinary(), 4326);
     sql = @" INSERT INTO [" + tableName + @"]([events],[MI_STYLE],[SP_GEOMETRY]) VALUES  ('"
         + events + "','" + pen + "','" + sgeom + "')";
     dc.ExecuteCommand(sql);
 }
开发者ID:rupeshkumar399,项目名称:seemapcell,代码行数:7,代码来源:lineLocating.cs

示例6: getCellGeo

        public SqlGeography getCellGeo()
        {
            site = dc_oss.SITE.Where(e => e.cell == this.sCell).FirstOrDefault();
            if (site == null) return SqlGeography.Point(0, 0, 4236);
            sitesgeog = SqlGeography.Point((double)site.latitude, (double)site.longitude, 4326);
            double.TryParse(site.ant_gain, out sAntGain);
            double.TryParse(site.height, out sHeight);
            sPathLoss = okumh.PathLoss2Distance((double)site.band, (double)sHeight, (double)mobileHight, (double)(sPowerN + sAntGain - sPowerControl - sRxlev));

            Console.WriteLine(sPathLoss * 1000);

            okumbuffersgeog = sitesgeog.STBuffer(sPathLoss * 1000);

            celltracing = dc_tmap.CellTracing.Where(e => e.cell == sCell).FirstOrDefault();

            //if (abc == null) return ngeo;

            celltracingsgeom = celltracing.SP_GEOMETRY;

            celltracingsgeog = SqlGeography.STGeomFromWKB(celltracingsgeom.STAsBinary(), 4326);

            Console.WriteLine(okumbuffersgeog.STArea());
            Console.WriteLine(celltracingsgeog.STArea());

            if (celltracingsgeog.STArea() > 0)
                return okumbuffersgeog.STIntersection(celltracingsgeog);   // 用圆和扇形相交
            else
                return okumbuffersgeog;    //返回圆
        }
开发者ID:rupeshkumar399,项目名称:seemapcell,代码行数:29,代码来源:LocatingCellBuffer.cs


注:本文中的SqlGeometry.STAsBinary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。