阅读:2135回复:1
[求助]gis网络分析求最短路径时添加stop点要素问题
<P>刚刚了解gis的网络分析,使用的是arcengine的network analyst包(版本9.2),在arcgis的安装目录下java\samples\engine\NetworkAnalyst.RouteLayer\src\routing有一个network analyst的例子代码,是通过NAClassLoader来将bayarealocations FeatureClass读入NAClass中来做为其中的stop,所以我想在NAClass中直接添加feature来添加stop,下面是部分代码:</P>
<P>NAClass n=new NAClass(stopsNAClass);//stopsNAClass是一个INAClass,包含所有stops<BR> cursor=new FeatureCursor(n.search(new QueryFilter(), false));<BR> IFeature ifeature=cursor.nextFeature();<BR> System.out.println(ifeature.getShape());<BR> NALocationFeature i=(NALocationFeature)n.createFeature();</P> <P>//直接获得NAClass中的要素的shape,进行修改获得一个point<BR> Point p=(Point)ifeature.getShapeCopy();<BR> System.out.println(p.isZAware());//打印false<BR> System.out.println(p.isZSimple());//打印false<BR> p.setX(-122.46);<BR> p.setY(37.77);</P> <P>//将point关联到feature并保存入NAClass中<BR> i.setShapeByRef(p);<BR> i.store();<BR> cursor.insertFeature(i);</P> <P>但是每次cursor.insertFeature(i)时就会出异常:</P> <P>AutomationException: 0x80004005 - The geometry is not Z-aware in '"esri.Point"'</P> <P>请各位赐教,在下不胜感激,另外可能有别的方法来实现添加stop的也请赐教,先谢了!</P> |
|
1楼#
发布于:2007-12-23 22:56
不懂
|
|