【问题原因】空间查询需要设置查询几何对象为georegion,且设置查询对应的模式
【解决办法】查询案例代码如下:
String url_qd_outnet = "
https://iserver.qdjtcx.cn:8443/iserver";
QueryService service = new QueryService(url_qd_outnet);
ServiceQueryParameter parameter = new ServiceQueryParameter();
parameter.setQueryServiceName("map-5321shujuji/rest");
parameter.setQueryMapName("5321centerMap");
parameter.setQueryLayerName("zhongxinxian@5321centerRoad");
Point2Ds point2Ds = new Point2Ds();
Point2D p1 = new Point2D(119.3 , 34.79);
Point2D p2 = new Point2D(121.32 , 37.15);
Point2D p3 = new Point2D(119.3 , 37.15);
point2Ds.add(p1);
point2Ds.add(p2);
point2Ds.add(p3);
point2Ds.add(p1);
GeoRegion geoRegion = new GeoRegion(point2Ds);
// m_mapControl.getMap().getTrackingLayer().add(geoRegion,"test");
parameter.setQueryGeomety(geoRegion);
parameter.setExpectRecordCount(1000);
parameter.setQueryRecordStart(0);
parameter.setQueryOption(QueryOption.ATTRIBUTEANDGEOMETRY);
parameter.setSpatialQueryMode(SpatialQueryMode.INTERSECT);
service.query(parameter,QueryMode.SpatialQuery);