我需要在c#中的Arcmap中获取图层纬度和经度的范围或边界框。
我最初使用了以下代码,但它并不总是在lat long中给出范围:
public IEnvelope GetExtent(IFeatureLayer PolygonLayer) {
return PolygonLayer.AreaOfInterest.Envelope;
}
答案 0 :(得分:2)
我有一个解决方法。必须预测程度。
public ISpatialReference CreateSpatialRefGCS(ESRI.ArcGIS.Geometry.esriSRGeoCSType gcsType)
{
ISpatialReferenceFactory spatialRefFactory = new SpatialReferenceEnvironmentClass();
IGeographicCoordinateSystem geoCS = spatialRefFactory.CreateGeographicCoordinateSystem((int)gcsType);
return (ISpatialReference)geoCS;
}
public IEnvelope GetExtent(IFeatureLayer PolygonLayer) {
IEnvelope envelope = PolygonLayer.AreaOfInterest.Envelope;
envelope.Project(CreateSpatialRefGCS(esriSRGeoCSType.esriSRGeoCS_WGS1984));
return PolygonLayer.AreaOfInterest.Envelope;
}