https://www.shaofei.name- GIS空间站

我要投稿 投稿指南 RSS订阅 网站资讯通告:
搜索: 您现在的位置: GIS空间站 >> 技术专栏 >> ArcGIS >> ArcIMS >> 正文

通过ArcIMS更新Shapefile的方法

作者:markgma    文章来源:本站原创    点击数:    更新时间:2006-11-25
摘要:
本人用业余时间研究并找到了如何通过ArcIMS更新Shapefile空间数据的方法。以下是本人写的全文,现在与大家共享。 对不起,我没写成中文。

有兴趣想知道Shp, Shx, Sbx数据存贮格式的,敬请来信。

How to Update ArcIMS’s Shapefile Through Internet

Mark G. Ma
04/13/2004

Generally, the shapefile used by ArcIMS is locked by ArcIMS’s services – Monitor, I.E., you have to stop this service in order to update the shapefile(s). According to ESRI’s suggestion, you have to stop all three ArcIMS Services (Tasker, Monitor and Application) in this order – Tasker => Monitor => Application. After having stopped all services, overwrite/update the specific shapefile, and then restart those services in the verse order. The weaknesses of this approach are: 1. Restarting the services will affect all other Map Services; E.g. when a end user is accessing a GIS web which uses “Forest” map service, he will get error during your restarting the ArcIMS’s services.  2. The ArcIMS will be corrupted easily if there are many MXD Map services created in the Administrator.

After my having done some C code testing and investigating, I found there is one feasible way to update Shapefile without restarting the ArcIMS’s services even though the Shapefile is still locked by Monitor. On the other hand, with VML/GML, the user can draw any kind of shape for adding or editing or delete feature through the ArcIMS application on the internet/intranet without uploading huge shapefiles to server and overwriting the old shapefiles (.shp, .dbf and .shx).  

How does my way work?
A component will be developed from VC++ /C#, running in an ASP/ASP.NET page, is deployed to open the locked shapefile (the tricky to opening the locked file is the openflag used by Open API function). If the user edited a shape, then the component updates the feature attributes or spatial data; if the user added a new feature, then the component inserts this new feature attributes and spatial data into shapefile; if the user deleted a feature, then the component removes the feature record from the shapefile. After the shapefiles (.shp, .dbf and .shx) have been refreshed, the component will recreate the Map Services programmatically.

Processing Steps:
1.        Convert the points from pixels to x/y coordinates when user draws a shape (It is controlled by VML/GML code) on the browser;
2.        Submit the shape updating request, a XML formatted text holding the x/y coordinates and attribute(s), to an ASP/ASPX page which has a pre-developed component;
3.        That component uses ADODB to update the locked .dbf file;
4.        The component use C/C++/C# code to update the locked .shx and .shp files;
5.        If you use MXD as map service, remove all relative Map service(s) and recreate the Map service(s) in order to refresh the .sbn and .sbx file; If you use AXL, then just set "shared" to true for SHAPEWORKSPACE, the server will update the sbn+sbx file automatically;
6.        Refresh browser;


Notes, ONLY ONE user can update shapefile each time.

Here is the XML formatted request string that is used to transfer updating request.
Request format:

<REQUEST>
<SERVICES username=xxxx password=xxx>
<SERVICE name=xxx axl=xxx virtualserver=xxx imagetype=xxx />
</SERVICES >
<SHAPE filename=xxx action=xxx>
<FIELDS>
<FIELD name=xxx value=xxx isid=xxx />
</FIELDS>
<POINTS>x,y;x1,y1;...xn,yn|xx1,yy1,…xxn,yyn</POINTS>
</SHAPE>
</REQUEST>

Tag description:
1.        <SERVICES>
username – ArcIMS’s Administrator login username;
password - ArcIMS’s Administrator login password;


2.        <SERVICE>
name – Map Service name;
axl – Map Service full file name (.axl or .mxd);
virtualserver – ArcIMS virtual server name, one of the ImageServer1, QueryServer1, ExtractServer1, FeatureServer1, GeocodeServer1 and ImageServerArcMap1;
imgtype – Output image type, one of  GIF, JPG, PNG8 and PNG24;

3.        <SHAPE>
filename – Shapefile full file name;
action – Shapefile access type, one of  “Add”, “Edit” and “Delete” feature;

4.        <FIELD>
name – Shape attribute name;
value – Shape attribute value;
isid – Indicates if this field is primary ID. Value is either “true” or “false”. Default is “false”;

NOTE,  the objectID has been included so that the COM can know which record will be updated when the “action” is “Edit” or “Delete”.

5.        <POINTS>
A list of the x/y coordinates. For multiple parts of polyline or polygon, the delimiter of each part is “|”;

Tags:ArcIMS,ArcGIS  
责任编辑:gissky
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地必威现金回扣 - 中国地必威现金回扣