首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >从MapX到MapXtreme2004[12]-SearchNearest!

从MapX到MapXtreme2004[12]-SearchNearest!

作者头像
用户1075292
发布2018-01-23 10:24:19
4730
发布2018-01-23 10:24:19
举报
文章被收录于专栏:听雨堂听雨堂

“/xy”应用程序中的服务器错误。

searchInfo.SearchResultProcessor must be null.

说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.ArgumentException: searchInfo.SearchResultProcessor must be null.

源错误:

行 956: 行 957: Feature ftr2=MapInfo.Engine.Session.Current.Catalog.SearchForFeature("公交车站",si); 行 958: 行 959:

源文件: d:\xy\xy.aspx.cs    行: 957 

         当想用searchnearest时,总是报这个错误。而先前用searchwhere是好好的,于是折腾si,不断试验各种构造函数,还自定义了个SearchResultProcessor类,都不行,直到在帮助中看到这个:

Catalog.SearchForFeature Method (String, SearchInfo)

Searches the given table and returns the first Feature from the results.

public Feature SearchForFeature(
 string tableAlias,
 SearchInfo searchInfo
);
Parameters

tableAlias The alias of the table to search. searchInfo Search definition.

Return Value

Returns a Feature.

Remarks

The SearchInfo must not have a SearchResultProcessor specified, because no post-processing of search results can take place.  于是,增加一个       si.SearchResultProcessor=null;         便ok了,郁闷………… 结论:         1、searchnearest的si构造有两个类都可以,MapInfo.Data.SearchInfoFactory.SearchNearestMapInfo.Mapping.SearchInfoFactory.SearchNearest,似乎可以通用         2、The default columns are MI_Geometry, MI_Syle, MI_Key. An Analysis column of MI_Geometry is added.如果不指定的话,查出来的结果就只有3列,所以需要加上si.QueryDefinition.Columns = null;         3、A  ClosestSearchResultProcessor is created with the Search point.会自动生成一个SearchResultProcess对象。         4、This SearchInfo can't be passed to SearchForFeature or SearchReader because they do not work with SearchResultProcessors.最关键的,原来根本不能用在SearchForFeature中。因为这种搜索方式不能有SearchResultProcessors。如果强制删掉SearchResultProcessors,虽然不报错,但也查找不到东西。         5、只好用search     IResultSetFeatureCollection ftrs=MapInfo.Engine.Session.Current.Catalog.Search("公交车站",si);     foreach(Feature f in ftrs){  }

       6、无需(si.SearchResultProcessor as ClosestSearchResultProcessor).Options = ClosestSearchOptions.StopAtFirstMatch;因为这种查询会自动只查一条。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2005-10-31 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • “/xy”应用程序中的服务器错误。
    • searchInfo.SearchResultProcessor must be null.
    • Catalog.SearchForFeature Method (String, SearchInfo)
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档