public static void addPointRecordSet(String datasetName, double x, double y, HashMap<String, Object> map) {
//创建工作空间对象
Workspace workspace = new Workspace();
//设置工作空间连接信息
workspace.open(workspaceConnectionInfo);
//获取工作空间数据源
Datasource datasource = workspace.getDatasources().get(datasourceName);
Datasets datasets = datasource.getDatasets();
DatasetVector dataset = (DatasetVector) datasets.get(datasetName);
Recordset recordset = dataset.getRecordset(false, CursorType.DYNAMIC);
//转换坐标系
Point2Ds point2Ds = new Point2Ds();
Point2D point2D = new Point2D();
point2D.setX(x);
point2D.setY(y);
point2Ds.add(point2D);
PrjCoordSys prjCoordSys = new PrjCoordSys(PrjCoordSysType.PCS_WGS_1984_WEB_MERCATOR);
CoordSysTranslator.forward(point2Ds,prjCoordSys);
Point2D item = point2Ds.getItem(0);
recordset.edit();
//将数据追加到数据集中
GeoPoint geoPoint = new GeoPoint(item);
recordset.addNew(geoPoint, map);
recordset.update();
//关闭资源
datasource.close();
workspace.close();
workspace.dispose();
}
数据集追加成功,但是地图没有自动更新
使用desktop查看地图数据已更更新
iserverr没有更新