图层查询代码修改
parent
e88047ec8d
commit
e63936feee
|
|
@ -131,36 +131,36 @@ namespace OpenAuth.App.BasicQueryService
|
|||
return column_list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 矢量切片公共方法
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <param name="_configuration"></param>
|
||||
/// <returns></returns>
|
||||
public byte[] VectorTile(VectorTileSearchModel req)
|
||||
{
|
||||
req.Init();
|
||||
///// <summary>
|
||||
///// 矢量切片公共方法
|
||||
///// </summary>
|
||||
///// <param name="req"></param>
|
||||
///// <param name="_configuration"></param>
|
||||
///// <returns></returns>
|
||||
//public byte[] VectorTile(VectorTileSearchModel req)
|
||||
//{
|
||||
// req.Init();
|
||||
|
||||
List<double> lons = getLon(req.x, req.z);
|
||||
List<double> lats = getLat(req.y, req.z);
|
||||
double lonmin = lons[0];
|
||||
double lonmax = lons[1];
|
||||
double latmin = lats[1];
|
||||
double latmax = lats[0];
|
||||
// List<double> lons = getLon(req.x, req.z);
|
||||
// List<double> lats = getLat(req.y, req.z);
|
||||
// double lonmin = lons[0];
|
||||
// double lonmax = lons[1];
|
||||
// double latmin = lats[1];
|
||||
// double latmax = lats[0];
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.AppendFormat(
|
||||
$" SELECT ST_AsMVT(tile, '{req.source_layer}', 4096, 'geom') tile FROM (SELECT {req.field}ST_AsMVTGeom(geom, ST_Transform(ST_MakeEnvelope({lonmin},{latmin},{lonmax},{latmax}, 4326),4326),4096, 256, true) AS geom FROM public.{req.table} where {req.filter} ) AS tile");
|
||||
// StringBuilder sql = new StringBuilder();
|
||||
// sql.AppendFormat(
|
||||
// $" SELECT ST_AsMVT(tile, '{req.source_layer}', 4096, 'geom') tile FROM (SELECT {req.field}ST_AsMVTGeom(geom, ST_Transform(ST_MakeEnvelope({lonmin},{latmin},{lonmax},{latmax}, 4326),4326),4096, 256, true) AS geom FROM public.{req.table} where {req.filter} ) AS tile");
|
||||
|
||||
|
||||
var dataTable = client.Ado.GetDataTable(sql.ToString());
|
||||
byte[] result = (Byte[])dataTable.Rows[0]["tile"];
|
||||
client.Ado.Close();
|
||||
client.Dispose();
|
||||
// var dataTable = client.Ado.GetDataTable(sql.ToString());
|
||||
// byte[] result = (Byte[])dataTable.Rows[0]["tile"];
|
||||
// client.Ado.Close();
|
||||
// client.Dispose();
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
// return result;
|
||||
//}
|
||||
public async Task<byte[]> VectorTileAsync(VectorTileSearchModel req)
|
||||
{
|
||||
req.Init();
|
||||
|
|
@ -390,5 +390,34 @@ namespace OpenAuth.App.BasicQueryService
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 矢量切片公共方法
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <param name="_configuration"></param>
|
||||
/// <returns></returns>
|
||||
public byte[] VectorTile(VectorTileSearchModel req)
|
||||
{
|
||||
req.Init();
|
||||
|
||||
List<double> lons = getLon(req.x, req.z);
|
||||
List<double> lats = getLat(req.y, req.z);
|
||||
double lonmin = lons[0];
|
||||
double lonmax = lons[1];
|
||||
double latmin = lats[1];
|
||||
double latmax = lats[0];
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.AppendFormat(
|
||||
$" SELECT ST_AsMVT(tile, '{req.source_layer}', 4096, 'geom') tile FROM (SELECT {req.field}ST_AsMVTGeom(geom, ST_Transform(ST_MakeEnvelope({lonmin},{latmin},{lonmax},{latmax}, 4326),4326),4096, 256, true) AS geom FROM public.{req.table} where {req.filter} ) AS tile");
|
||||
|
||||
|
||||
var dataTable = client.Ado.GetDataTable(sql.ToString());
|
||||
byte[] result = (Byte[])dataTable.Rows[0]["tile"];
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -959,7 +959,7 @@ public class ShpGeoLayerApp : SqlSugarBaseApp<ShpGeoLayer, SugarDbContext>
|
|||
};
|
||||
}
|
||||
|
||||
public byte[] QueryVectorTileByTable(QueryVectorTileByTableReq req)
|
||||
public byte[] QueryVectorTileByTable1(QueryVectorTileByTableReq req)
|
||||
{
|
||||
VectorTileSearchModel searchModel = new VectorTileSearchModel
|
||||
{
|
||||
|
|
@ -994,6 +994,30 @@ public class ShpGeoLayerApp : SqlSugarBaseApp<ShpGeoLayer, SugarDbContext>
|
|||
return result;
|
||||
}
|
||||
|
||||
#region 获取矢量切片
|
||||
|
||||
/// <summary>
|
||||
/// 根据表名获取矢量切片
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
public byte[] QueryVectorTileByTable(QueryVectorTileByTableReq req)
|
||||
{
|
||||
VectorTileSearchModel searchModel = new VectorTileSearchModel
|
||||
{
|
||||
x = req.x,
|
||||
y = req.y,
|
||||
z = req.z,
|
||||
field = req.field,
|
||||
table = req.table,
|
||||
filter = req.filter,
|
||||
};
|
||||
var result = new CommonDataManager(base.UnitWork.CreateContext().Db).VectorTile(searchModel);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public dynamic GetDataTableRecord(string dataTable, string id)
|
||||
{
|
||||
using var db = Repository.AsSugarClient();
|
||||
|
|
|
|||
Loading…
Reference in New Issue