IdleResources
parent
12755f17fe
commit
c6add3aa20
|
|
@ -89,6 +89,22 @@ namespace OpenAuth.App
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public dynamic GetCenterPoints(string tablename, string filter)
|
||||||
|
{
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
if (string.IsNullOrEmpty(filter))
|
||||||
|
{
|
||||||
|
filter = "1=1";
|
||||||
|
}
|
||||||
|
|
||||||
|
sql.AppendFormat(
|
||||||
|
$"SELECT \"Id\",ST_AsText(ST_Transform(ST_Centroid(\"Geom\"), 4326)) AS centroid_point FROM {tablename} where {filter}");
|
||||||
|
var result = client.Ado.SqlQuery<dynamic>(sql.ToString());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<string> GetRegionNum(decimal lat, decimal lng)
|
public async Task<string> GetRegionNum(decimal lat, decimal lng)
|
||||||
{
|
{
|
||||||
var sql = $" SELECT bsm FROM shp_drone_community where ST_Within(st_geomfromtext('POINT({lng} {lat})',4326), geom) = 't'";
|
var sql = $" SELECT bsm FROM shp_drone_community where ST_Within(st_geomfromtext('POINT({lng} {lat})',4326), geom) = 't'";
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,29 @@ namespace OpenAuth.WebApi.Controllers
|
||||||
return File(result, "application/octet-stream");
|
return File(result, "application/octet-stream");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图斑中心点
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tablename"></param>
|
||||||
|
/// <param name="filter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public Response<dynamic> GetCenterPoints(string tablename, string filter)
|
||||||
|
{
|
||||||
|
Response<dynamic> response = new Response<dynamic>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response.Result = app.GetCenterPoints(tablename, filter);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Code = 500;
|
||||||
|
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据坐标获取村编码
|
/// 根据坐标获取村编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue