我有一个带有EPSG:32749的shapefile,它将被插入到Oracle数据库中并显示在geoserver中。在此之前,我想使用点空间库将我的shapefile重新投影到ESPG:4326,下面是我的代码
var EXTRACTED_NAME = Server.MapPath("~/upload/shp/example/");
string shapeFilePath = @"\example.shp";
shapeFilePath = EXTRACTED_NAME + shapeFilePath;
Shapefile indexMapFile = Shapefile.OpenFile(shapeFilePath);
indexMapFile.Reproject(KnownCoordinateSystems.Geographic.World.WGS1984);但是当我在geoserver中预览时,我的shapefile显示为这样,而原始shapefile像这样


我的问题是,为什么重新投影到EPSG 4326的shapefile与原始的不同?
谢谢
发布于 2019-03-07 03:01:08
这有点晚了,但您应该能够从几何体访问内环。您可能需要将IGeometry转换为IPolygon,以便专门处理内部环,而不仅仅是作为getGeometryN。下面的代码还没有经过测试,但至少应该能让你找到正确的方向。
Shapefile file = Shapefile.OpenFile(@"D:\Data\Counties\Counties.shp");
foreach(Feature f in file.Features){
if(f.Geometry is IPolygon){
IPolygon p = (IPolygon)f.Geometry;
Debug.WriteLine("Feature " + f.Fid + "\n");
foreach(ILineString innerRing in p.InteriorRings){
// Do stuff with your innerRing
Debug.WriteLine("Ring length : " + innerRing.Length);
}
}
if (f.Geometry is IMultiPolygon)
{
IMultiPolygon multi = (IMultiPolygon)f.Geometry;
for (int i = 0; i < multi.NumGeometries; i++)
{
IGeometry g = multi.GetGeometryN(i);
if (g is IPolygon)
{
IPolygon p = (IPolygon)g;
foreach (ILineString innerRing in p.InteriorRings)
{
// Do stuff with your innerRing
}
}
}
}
}https://stackoverflow.com/questions/53945057
复制相似问题