首页 > 解决方案 > 将坐标转换为点、角度、openlayers

问题描述

我的数据;坐标X: 4833590.9447487565 坐标Y: 3395367.0520476755 这样。当我单击地图上的一个点时,getCoord() 函数运行并为我提供上述数据。但我需要以 geomwkt 形式保存它。因为我被提示在以下结构中调用它。

以下函数 getCoord()

  getCoord(event: any){

   var coordinate = this.map.getEventCoordinate(event);
   this.xCoordinate=transform(coordinate, 'EPSG:3857', 'EPSG:4326')[0];
   this.yCoordinate=transform(coordinate, 'EPSG:3857', 'EPSG:4326')[1];
   console.log(this.xCoordinate);
   console.log(this.yCoordinate);

}

public async Task<List<KadastroParselModel>> ListParselAsync(string geomWkt)
    {

        List<KadastroParselModel> result = new List<KadastroParselModel>();
        try
        {
            IGeometry tempGeom = geomWkt.ToGeometry();
            if(!tempGeom.IsValid){
                tempGeom= tempGeom.Centroid;
            }
            using (IntegrationTestContext context = new IntegrationTestContext())
            {
                try
                {
                    //var xx=await context.ST_InterSects(geomWkt);
                    
                    result = (await context.ST_InterSects(geomWkt)).ToKadastroParselModel();
                    // var rresult = await context.KadastroParsel.
                }
                catch (Exception e)
                {
                    throw new Exception("Veritabanına ulaşım sırasında hata oluştu.. :" + e.Message);
                }
            }
        }
        catch (Exception e)
        {
            return result;
        }


        return result;
    }

标签: angulartype-conversioncoordinatesopenlayerspoint

解决方案


推荐阅读