Code
Sub Addpoint ()
Dim Pmxdoc As Imxdocument
Dim Pmap As IMAP
Dim Pfeaturelayer As Ifeaturelayer
Dim Pfeatureclass As Ifeatureclass
Dim P As Ipoint
Dim Pfeature As Ifeature
Set Pmxdoc = Thisdocument
Set Pmap = Pmxdoc. focusmap
Set Pfeaturelayer = Pmap. layer ( 0 )
Set Pfeatureclass = Pfeaturelayer. featureclass
Set Pfeature = Pfeatureclass. createfeature
' Coordinates of the added Vertex
Set P = New Point
P.x = 76374.006
P. Y = - 3660.849
Set Pfeature. Shape = P
Pfeature. Value ( 2 ) = " 111 "
Pfeature. Value ( 3 ) = " Add Test "
Pfeature. Store
End sub
When developing ArcGIS Server todayCodeDynamically add elements to detect errors. You can use VBA to try the results. As a result, VBA is successfully tried.
Add code in Java.
Code
Int Minx = Integer. parseint (parammap. Get ( " Map0_minx " ). Tostring ());
Int Miny = Integer. parseint (parammap. Get ( " Map0_miny " ). Tostring ());
Webpoint tmpextent = New Webpoint ();
Tmpextent. setx (Minx );
Tmpextent. sety (miny );
Tmpextent = (Webpoint) tmpextent. tomapgeometry (WM );
Agslocalmapresource mapresource = (Agslocalmapresource) Context
. Getresources (). Get ( " Ags0 " );
Ifeaturelayer featurelayer = Getfeaturelayer (mapresource );
Iservercontext servercontext = Mapresource. getservercontext ();
Ipoint webpoint = (Ipoint) servercontext. Createobject (point. getclsid ());
Webpoint. setx (tmpextent. getx ());
Webpoint. sety (tmpextent. Gety ());
If (Featurelayer ! = Null ){
Ifeatureclass featurecls = Featurelayer. getfeatureclass ();
System. Out. println ( " Aliasname: " + Featurecls. getaliasname ());
Idataset DS = New Idatasetproxy (featurecls );
Iworkspace WS = New Iworkspaceproxy (Ds. getworkspace ());
Iworkspaceedit WSE = New Iworkspaceeditproxy (WS );
// Iworkspaceedit WSE = (iworkspaceedit) WS;
// WSe. startediting (false );
WSe. starteditoperation ();
Ifeature feature = Featurecls. createfeature ();
Feature. setshapebyref (igeometry) webpoint );
Feature. setvalue ( 2 , " 123456 " );
Feature. setvalue ( 3 , " Add Test " );
Feature. Store ();
WSe. stopeditoperation ();
// WSe. stopediting (true );
}
Context. Refresh ();
Errors in Java are listed below:
Automatic exception: 0x80004005-unspecified error
At com. ESRI. ArcGIS. InterOP. Dispatch. vtblinvoke (unknown source)
At com. ESRI. ArcGIS. Geodatabase. ifeatureclassproxy. createfeature (unknown source)
Finally, I found no problem. Later I typed ArcGIS Server SP 6. The problem was solved. It turns out to be a patch issue.