本文介绍了相交两层并获得结果特征的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在地图上有 X 个图层,我需要将选定的图层(每次两个)相交并为生成的特征着色.

I have X layers on a map and I need to intersect chosen layers (two per time) and color resulting features.

我正在尝试使此代码正常工作

I'm trying to get this code working

// get first feature (index 0)
ESRI.ArcGIS.ADF.Web.Geometry.Geometry adfFeature =
                m_firstLayer.GeometryFromRow(m_firstLayer.Rows[0])
as ESRI.ArcGIS.ADF.Web.Geometry.Geometry;

// THE FOLLOWING LINE RETURNS NULL
ESRI.ArcGIS.Geometry.IGeometry featureInterface =
    adfFeature as ESRI.ArcGIS.Geometry.IGeometry;

ESRI.ArcGIS.Geometry.ITopologicalOperator topoOp =
    adfFeature as ESRI.ArcGIS.Geometry.ITopologicalOperator;

如何将 IGeometry 接口与 ADF Geometry 对象一起使用?

How to use the IGeometry interface with an ADF Geometry object?

我真的找不到样本在两层之间相交特征,可惜空间连接只是一个arcgis桌面功能,我肯定可以使用它们!

I can't really find samples to intersect features between two layers, and it's a pity that Spatial Joins are just a arcgis desktop function, I surely could use them!

推荐答案

我不认为您直接使用 IGeometry.但是,如果您知道特殊类型(点、折线、多边形),您可以 转换(请参阅Web ADF 到 ArcGIS Server ArcObjects"项目符号)到 ArcObjects.

I do not think you use the IGeometry directly. However if you know the specialized type (Point, Polyline, Polygon) you can convert (see the "Web ADF to ArcGIS Server ArcObjects" bullets) to ArcObjects.

您可以测试您的 ESRI.ArcGIS.ADF.Web.Geometry.Geometry adfFeature 是什么子类型并进行相应的转换.

You could test what subtype your ESRI.ArcGIS.ADF.Web.Geometry.Geometry adfFeature is and do conversion accordingly.

顺便说一下,我建议您永远不要使用as"类型转换,因为它可能会默默地失败(只返回 null).相反,我建议:

By the way I suggest that you never use the "as" cast since it can fail silently (just returning null). Instead I suggest:

ESRI.ArcGIS.Geometry.IGeometry featureInterface =
    (ESRI.ArcGIS.Geometry.IGeometry)adfFeature;

那么问题一出现你就会看到.

Then you will see the problem as soon as it occurs.

这篇关于相交两层并获得结果特征的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 09:35
查看更多