`
- 浏览:
818290 次
- 性别:
- 来自:
北京
-
基于ArcGIS Server对ShapeFile文件的编辑功能实现
-
public
class
PointEdit {
-
private
WebContext webContext;
-
public
void
AddPoint (MapEvent event){
-
try
{
-
-
WebMap webmap=webContext.getWebMap();
-
WebPoint webpoint=(WebPoint) event.getWebGeometry().toMapGeometry(webmap);
-
AGSLocalMapResource mapResource = (AGSLocalMapResource) MapResourceClass.getMapResource(webContext,
1
);
-
IServerContext context = mapResource.getServerContext();
-
MapServer mapServer = mapResource.getLocalMapServer();
-
-
-
-
IMap maps= mapServer.getMap(
""
);
-
ILayer layer=maps.getLayer(
0
);
-
IFeatureLayer fLayer = (IFeatureLayer) layer;
-
IFeatureClass fc = fLayer.getFeatureClass();
-
IDataset ds1=
new
IDatasetProxy(fc);
-
IWorkspace pWorkSpace = ds1.getWorkspace();
-
IWorkspaceEdit pWorkspaceEdit=
new
IWorkspaceEditProxy(pWorkSpace);
-
-
pWorkspaceEdit.startEditing(
true
);
-
pWorkspaceEdit.startEditOperation();
-
-
IFeature pFeature=fc.createFeature();
-
-
Point p=(Point)context.createObject(
"esriGeometry.Point"
);
-
IPoint pt=(IPoint)context.createObject(
"esriGeometry.Point"
);
-
pt.setX(webpoint.getX());
-
pt.setY(webpoint.getY());
-
pt.setM(
0
);
-
pt.setZ(
0
);
-
p=(Point)pt;
-
-
pFeature.setShapeByRef(p);
-
-
pFeature.setValue(fc.findField(
"code"
),
1
);
-
-
pFeature.store();
-
-
pWorkspaceEdit.stopEditOperation();
-
pWorkspaceEdit.stopEditing(
true
);
-
-
-
mapServer.refreshServerObjects();
-
webContext.refresh();
-
-
}
catch
(Exception gise) {
-
System.out.print(
"添加点"
+ gise.toString() +
"\n"
);
-
gise.printStackTrace();
-
}
-
}
-
}
-
这是添加点的代码
-
using System;
-
using System.Data;
-
using System.Configuration;
-
using System.Web;
-
using System.Web.Security;
-
using System.Web.UI;
-
using System.Web.UI.WebControls;
-
using System.Web.UI.WebControls.WebParts;
-
using System.Web.UI.HtmlControls;
-
-
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
-
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
-
using ESRI.ArcGIS.ADF.ArcGISServer;
-
using ESRI.ArcGIS.Server;
-
using ESRI.ArcGIS.Carto;
-
using ESRI.ArcGIS.Geometry;
-
using ESRI.ArcGIS.esriSystem;
-
using ESRI.ArcGIS.Display;
-
using System.Collections;
-
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
-
using ESRI.ArcGIS.Geodatabase;
-
-
-
-
public
class
AddPointFeature : IMapServerToolAction
-
{
-
public
AddPointFeature()
-
{
-
-
-
-
}
-
#region IMapServerToolAction 成员
-
void
IMapServerToolAction.ServerAction(ToolEventArgs args)
-
{
-
-
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
-
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
-
PointEventArgs pea = (PointEventArgs)args;
-
System.Drawing.Point screen_point = pea.ScreenPoint;
-
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(
0
);
-
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
-
IServerContext pSOC;
-
IMapServer pMapServer;
-
IMap pMap;
-
-
pSOC = mapResLocal.ServerContextInfo.ServerContext;
-
pMapServer = pSOC.ServerObject as IMapServer;
-
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
-
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
-
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesp = mapFunc.MapDescription;
-
ESRI.ArcGIS.ADF.Web.Geometry.Point adf_map_point = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_point, mapCtrl.Extent, mapFunc.DisplaySettings.ImageDescriptor.Width, mapFunc.DisplaySettings.ImageDescriptor.Height);
-
PointN ags_map_point = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPoint(adf_map_point);
-
-
-
-
ILayer pLayer = pMap.get_Layer(
0
);
-
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
-
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
-
IDataset pDataset = pFeatCls as IDataset;
-
IWorkspace pWS = pDataset.Workspace;
-
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
-
pWorkspaceEdit.StartEditing(
false
);
-
pWorkspaceEdit.StartEditOperation();
-
IFeatureBuffer pFeatureBuffer;
-
IFeatureCursor pFeatureCuror;
-
IFeature pFeature;
-
IPoint pPoint;
-
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
-
pFeatureCuror = pFeatCls.Insert(
true
);
-
pFeature = pFeatureBuffer as IFeature;
-
pPoint =(IPoint) pSOC.CreateObject(
"esriGeometry.Point"
);
-
pPoint.X = ags_map_point.X;
-
pPoint.Y = ags_map_point.Y;
-
IGeometry pPointGeo = pPoint as IGeometry;
-
pFeature.Shape = pPointGeo;
-
pFeatureCuror.InsertFeature(pFeatureBuffer);
-
-
pWorkspaceEdit.StopEditOperation();
-
pWorkspaceEdit.StopEditing(
true
);
-
mapCtrl.Refresh();
-
}
-
#endregion
-
}
-
-
添加线的代码
-
-
-
using System;
-
using System.Data;
-
using System.Configuration;
-
using System.Web;
-
using System.Web.Security;
-
using System.Web.UI;
-
using System.Web.UI.WebControls;
-
using System.Web.UI.WebControls.WebParts;
-
using System.Web.UI.HtmlControls;
-
-
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
-
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
-
using ESRI.ArcGIS.ADF.ArcGISServer;
-
using ESRI.ArcGIS.Server;
-
using ESRI.ArcGIS.Carto;
-
using ESRI.ArcGIS.Geometry;
-
using ESRI.ArcGIS.esriSystem;
-
using ESRI.ArcGIS.Display;
-
using System.Collections;
-
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
-
using ESRI.ArcGIS.Geodatabase;
-
-
-
-
public
class
AddPolylineFeature : IMapServerToolAction
-
{
-
public
AddPolylineFeature()
-
{
-
-
-
-
}
-
#region IMapServerToolAction 成员
-
public
void
ServerAction(ToolEventArgs args)
-
{
-
-
-
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
-
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
-
PolylineEventArgs peal = (PolylineEventArgs)args;
-
System.Drawing.Point[] screen_points = peal.Vectors;
-
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(
0
);
-
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
-
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesc;
-
mapDesc = mapFunc.MapDescription;
-
IServerContext pSOC;
-
IMapServer pMapServer;
-
IMap pMap;
-
pSOC = mapResLocal.ServerContextInfo.ServerContext;
-
pMapServer = pSOC.ServerObject as IMapServer;
-
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
-
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
-
-
IPointCollection pPointColl;
-
pPointColl = (IPointCollection)pSOC.CreateObject(
"esriGeometry.Polyline"
);
-
for
(
int
i =
0
; i < screen_points.Length; i++)
-
{
-
IPoint pPoint;
-
ESRI.ArcGIS.ADF.Web.Geometry.Point mappnt = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_points, mapCtrl.Extent, (
int
)mapCtrl.Width.Value, (
int
)mapCtrl.Height.Value);
-
pPoint = (IPoint)pSOC.CreateObject(
"esriGeometry.Point"
);
-
pPoint.X = mappnt.X;
-
pPoint.Y = mappnt.Y;
-
object missingVal = System.Reflection.Missing.Value;
-
pPointColl.AddPoint(pPoint, ref missingVal, ref missingVal);
-
}
-
IGeometry pPolylineGeo = pPointColl as IGeometry;
-
-
-
-
ILayer pLayer = pMap.get_Layer(
1
);
-
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
-
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
-
IDataset pDataset = pFeatCls as IDataset;
-
IWorkspace pWS = pDataset.Workspace;
-
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
-
pWorkspaceEdit.StartEditing(
false
);
-
pWorkspaceEdit.StartEditOperation();
-
IFeatureBuffer pFeatureBuffer;
-
IFeatureCursor pFeatureCuror;
-
IFeature pFeature;
-
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
-
pFeatureCuror = pFeatCls.Insert(
true
);
-
pFeature = pFeatureBuffer as IFeature;
-
pFeature.Shape = pPolylineGeo;
-
pFeatureCuror.InsertFeature(pFeatureBuffer);
-
pWorkspaceEdit.StopEditOperation();
-
pWorkspaceEdit.StopEditing(
true
);
-
mapCtrl.Refresh();
-
}
-
#endregion
-
}
-
编辑面的代码
-
-
-
using System;
-
using System.Data;
-
using System.Configuration;
-
using System.Web;
-
using System.Web.Security;
-
using System.Web.UI;
-
using System.Web.UI.WebControls;
-
using System.Web.UI.WebControls.WebParts;
-
using System.Web.UI.HtmlControls;
-
-
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
-
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
-
using ESRI.ArcGIS.ADF.ArcGISServer;
-
using ESRI.ArcGIS.Server;
-
using ESRI.ArcGIS.Carto;
-
using ESRI.ArcGIS.Geometry;
-
using ESRI.ArcGIS.esriSystem;
-
using ESRI.ArcGIS.Display;
-
using System.Collections;
-
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
-
using ESRI.ArcGIS.Geodatabase;
-
-
-
-
public
class
AddPolygonFeature : IMapServerToolAction
-
{
-
public
AddPolygonFeature()
-
{
-
-
-
-
}
-
#region IMapServerToolAction 成员
-
public
void
ServerAction(ToolEventArgs args)
-
{
-
-
-
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
-
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
-
PolygonEventArgs peag = (PolygonEventArgs)args;
-
System.Drawing.Point[] screen_points = peag.Vectors;
-
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(
0
);
-
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
-
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesc;
-
mapDesc = mapFunc.MapDescription;
-
IServerContext pSOC;
-
IMapServer pMapServer;
-
IMap pMap;
-
pSOC = mapResLocal.ServerContextInfo.ServerContext;
-
pMapServer = pSOC.ServerObject as IMapServer;
-
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
-
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
-
-
-
IPointCollection pPointColl;
-
pPointColl = (IPointCollection)pSOC.CreateObject(
"esriGeometry.Polygon"
);
-
for
(
int
i =
0
; i < screen_points.Length; i++)
-
{
-
IPoint pPoint;
-
ESRI.ArcGIS.ADF.Web.Geometry.Point mappnt = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_points, mapCtrl.Extent, (
int
)mapCtrl.Width.Value, (
int
)mapCtrl.Height.Value);
-
pPoint = (IPoint)pSOC.CreateObject(
"esriGeometry.Point"
);
-
pPoint.X = mappnt.X;
-
pPoint.Y = mappnt.Y;
-
object missingVal = System.Reflection.Missing.Value;
-
pPointColl.AddPoint(pPoint, ref missingVal, ref missingVal);
-
}
-
IGeometry pPolylineGeo = pPointColl as IGeometry;
-
-
-
-
ILayer pLayer = pMap.get_Layer(
2
);
-
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
-
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
-
IDataset pDataset = pFeatCls as IDataset;
-
IWorkspace pWS = pDataset.Workspace;
-
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
-
pWorkspaceEdit.StartEditing(
false
);
-
pWorkspaceEdit.StartEditOperation();
-
IFeatureBuffer pFeatureBuffer;
-
IFeatureCursor pFeatureCuror;
-
IFeature pFeature;
-
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
-
pFeatureCuror = pFeatCls.Insert(
true
);
-
pFeature = pFeatureBuffer as IFeature;
-
pFeature.Shape = pPolylineGeo;
-
pFeatureCuror.InsertFeature(pFeatureBuffer);
-
pWorkspaceEdit.StopEditOperation();
-
pWorkspaceEdit.StopEditing(
true
);
-
mapCtrl.Refresh();
-
}
-
#endregion
-
}
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
总之,ArcGIS Server 10.3是一个功能强大的GIS服务器平台,通过ECP文件实现合法授权,为用户提供地图服务、地理处理服务和数据管理等功能,并在10.3版本中优化了性能、大数据处理和云部署。结合其他ArcGIS产品,它...
4. 支持多种数据格式:ArcGIS Server 10.4支持多种GIS数据格式,如Shapefile、GeoTIFF、CAD等,方便数据导入和导出。 5. Web GIS平台:与ArcGIS Online和Portal for ArcGIS无缝集成,构建全面的Web GIS解决方案。 ...
《基于ArcGIS的Python编程秘笈(第2版)》是一本深入探讨如何利用Python进行地理信息系统(GIS)开发的专业书籍。随着Python在GIS领域的广泛应用,掌握Python在ArcGIS中的运用已经成为许多GIS专业人员和爱好者的必备...
本项目基于ArcGIS Engine 10.1,实现了对SDE(Spatial Database Engine)数据库的连接以及一些核心功能,旨在提供类似ArcCatalog的操作体验。ArcCatalog是Esri公司出品的用于管理地理空间数据的桌面应用,而通过...
这可以通过编辑现有的 MXD 文件或者创建一个新的 MXD 文件来实现。具体步骤如下: 1. 打开 ArcMap 并加载所需的地理数据(例如 Shapefile)。 2. 对地图进行必要的编辑和样式设置,如调整图层顺序、设置符号等。 3....
ArcGIS Server的路径分析功能基于网络分析服务,能够提供实时的、基于Web的路径查找服务。在服务器端,你需要将`DHRoute.mxd`中的网络数据集发布为一个服务,然后在ArcGIS Server Manager中配置并启用这个服务。一旦...
**ArcGIS操作基于GIS文件格式** ArcGIS,全称Arc Geographic Information System,是Esri公司开发的一款强大的地理信息系统(GIS)软件,广泛应用于地理数据的处理、分析和展示。在ArcGIS中,地理信息通常以多种GIS...
3. **数据管理**:提供对多种数据格式的支持,包括Shapefile、Geodatabase、CAD、栅格数据等,并具备数据整合、编辑、版本控制等功能。 4. **安全性与权限管理**:具备强大的身份验证和授权机制,确保只有授权的...
2. 集成方式:通过WMS、WFS-T等接口,开源WebGIS可以消费ArcGIS Server提供的地图服务和地理信息服务,实现数据的读取、编辑和管理。 3. 自主配图切片:开源GIS可以创建自己的地图切片服务,与ArcGIS Server的动态...
1. **API概述**:Flex API是一个基于ActionScript 3.0的库,它包含了用于创建地图服务、图层、控件、工具以及与ArcGIS Server通信的类。它使得开发者能够轻松地在Adobe Flex环境中集成GIS功能。 2. **安装与配置**...
4. **数据创建与编辑**:支持数据输入、地理编码、读写Shapefile文件等。 5. **应用程序开发**:可以开发独立的GIS应用程序。 6. **控件开发**:支持开发自定义的GIS控件。 #### 三、开发方法探讨 ##### 3.1 开发...
5. 编辑功能:支持对地理数据进行添加、修改和删除操作。 6. 分析工具:包括缓冲区分析、网络分析、地形分析等高级GIS功能。 7. 三维地图:支持创建和显示三维地图,进行三维分析。 8. 打印和导出:可以将地图输出为...
由于 "arcgis105_16101.zip" 的具体内容未知,上述内容是基于ArcGIS 10.5的一般特性进行的阐述。实际解压后的文件可能会涉及到特定的更新、修补程序或特定用途的数据集,这些都需要根据文件内容来具体分析。
此外,通过ArcGIS的三维功能,可以构建立体地图,增强对地表特征的理解。 ArcGIS10还支持编程,通过使用ArcObjects SDK或集成开发环境(IDE),如Visual Studio,可以编写基于Java、JavaScript的自定义脚本或应用...
- **同步与管理**:与ArcGIS Server或Portal for ArcGIS无缝集成,实现数据的同步和管理。 - **定制应用**:支持基于模板快速创建定制化的移动应用,满足特定业务场景的需求。 - **高级分析工具**:集成了一系列高级...
用户可以通过ArcGIS Online或ArcGIS for Server来访问和操作这些基于SQLite的数据服务。 6. **性能优化**:尽管SQLite是轻量级的,但通过合理设计数据库结构(如索引创建、数据分区等)和优化查询语句,仍能提升其...
用户可以通过添加图层来扩展地图,例如添加Shapefile文件、Layer文件或栅格数据。ArcMap还提供了数据视图和版面视图,以支持不同的地图工作流程。 ArcGIS软件不仅仅是一个简单的制图工具,它还是一个强大的地理空间...
2. **ArcGIS Geoprocessing Service**:`arcpy` 可用于开发Web服务,将GIS处理功能发布到ArcGIS Server上,供其他应用或用户远程调用。 3. **Python Add-ins**:结合`arcpy` 和ArcGIS的Python Add-ins框架,可以开发...