1 / 13

MapXtreme2004 培训

MapXtreme2004 培训. James.Liu. 内容. MapXtreme2004 概览 地图及图层管理 数据管理 数据查询 几何对象 专题图. 数据查询. 目标 查询类 数据查询 选择集. 查询实例. 搜索恐怖犯罪分子 查询超市方圆75公理以内的客户群 搜索某地500米以内的 ATM 机. 查询类. 查询 – 图元查询. Feature fNY = catalog.SearchForFeature("States", SearchInfoFactory.SearchWhere("state='NY'"));

kory
Download Presentation

MapXtreme2004 培训

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MapXtreme2004培训 James.Liu

  2. 内容 • MapXtreme2004概览 • 地图及图层管理 • 数据管理 • 数据查询 • 几何对象 • 专题图

  3. 数据查询 • 目标 • 查询类 • 数据查询 • 选择集

  4. 查询实例 • 搜索恐怖犯罪分子 • 查询超市方圆75公理以内的客户群 • 搜索某地500米以内的ATM机

  5. 查询类

  6. 查询 – 图元查询 Feature fNY = catalog.SearchForFeature("States", SearchInfoFactory.SearchWhere("state='NY'")); SearchInfo si = SearchInfoFactory.SearchWithinFeature(fNY, ContainsFilter.ContainsType.Centroid); IDynamicFeatureCollection dfc = catalog.Search("Cities", si) as IDynamicFeatureCollection; Console.Out.WriteLine("There are {0} cities whose centroid is within NewYork." dfc.Count);

  7. 查询 - SQL查询 MIConnection connection = new MIConnection(); MICommand command = connection.CreateCommand(); command.CommandText = "Select Obj From States Where state = ‘NY’; FeatureGeometry nyGeom = command.ExecuteScalar() as FeatureGeometry; command.CommandText = "SELECT * FROM Cities WHERE Obj within @newyork"; command.Parameters.Add("@newyork", nyGeom); MIDataReader reader = command.ExecuteReader(); // 或者获取图元集合 IFeatureCollection fc = command.ExecuteFeatureCollection();

  8. 查询 - 字符串比较 MapInfo.Data.SearchInfo si=MapInfo.Data.SearchInfoFactory.SearchWhere("Country like ‘ch%'"); MapInfo.Data.IResultSetFeatureCollection irfc = Session.Current.Catalog.Search("World", si); System.Data.DataTable miWorld = new System.Data.DataTable("WorldSearch"); for (int i = 0; i < irfc.Columns.Count; i++){ DataColumn dc=miWorld.Columns.Add(irfc.Columns[i].Alias); } foreach (Feature f in irfc){ DataRow dr = miWorld.NewRow(); for (int i = 0; i < irfc.Columns.Count; i++){ dr[i] = f[i].ToString();} miWorld.Rows.Add(dr);} dataGrid1.DataSource = miWorld;

  9. 查询 – 数字比较 MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWhere("TrainingRev >20000"); MapInfo.Data.IResultSetFeatureCollection irfc = Session.Current.Catalog.Search("World", si);

  10. 查询 – 矩形区域查询 MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWithinRect(mapControl1.Map.Bounds,mapControl1.Map.GetDisplayCoordSys(), ContainsType.Centroid); /* 指定需要的字段列表 si.QueryDefinition.Columns = new string[]{"*"};*/ MapInfo.Data.IResultSetFeatureCollection irfc = Session.Current.Catalog.Search("WorldCap", si);

  11. 查询 – 圆域查询 MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWithinDistance(new MapInfo.Geometry.DPoint(-73, 42), Session.Current.CoordSysFactory. CreateLongLat(MapInfo.Geometry.DatumID.NAD83),new MapInfo.Geometry.Distance(1600, MapInfo.Geometry.DistanceUnit.Kilometer),ContainsType.Centroid); si.QueryDefinition.Columns = new string[]{"*"}; MapInfo.Data.IResultSetFeatureCollection irfc = Session.Current.Catalog.Search("WorldCap", si);

  12. 查询 – 字符串和地理查询 MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWhere("TrainingRev >20000"); MapInfo.Data.SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWhere("Country = 'Germany'"); Feature f = Session.Current.Catalog.SearchForFeature("World", si); si = MapInfo.Data.SearchInfoFactory.SearchIntersectsFeature(f, IntersectType.Geometry); si.QueryDefinition.Columns = new string[]{"*"}; MIDataReader miReader = Session.Current.Catalog.SearchReader("World", si); MapInfo.Data.IResultSetFeatureCollection irfc = Session.Current.Catalog.Search("World", si);

  13. 问题?

More Related