阅读:1279回复:1
求助:怎样读取xml文件中的坐标信息
我现在有一个XML文件,存有经纬度坐标信息及相关属性信息,需要根据该信息建立点的featureclass,怎样读取这些信息呢?(AO或ENGINE)
|
|
1楼#
发布于:2006-05-18 20:12
<P><STRONG></STRONG> </P>
<P><STRONG>Description:</STRONG> <BR><BR><TEXT>This sample will demonstrate how to import an xml 'workspace' file into a pgdb. The following sample will create a new pgdb and import the resulting xml file. </TEXT></P> <P><STRONG>How to use:</STRONG> </P> <DIV> <OL> <LI>Create a form with a command button. <LI>Paste the code into VB. </LI></OL></DIV> <DIV><PRE> <DEVELOPENV> Private Sub ImportWS(db As String, XmlFile As String) Dim pWSF As IWorkspaceFactory Set pWSF = New AccessWorkspaceFactory '*** Create new GDB *** Dim pWSN As IWorkspaceName Set pWSN = pWSF.Create(App.Path, db, Nothing, 0) Dim pName As IName Set pName = pWSN '*** Open PGDB *** Dim pWS As IWorkspace Set pWS = pName.Open '*** Create Importer *** Dim pImporter As IGdbXmlImport Set pImporter = New GdbImporter Dim pEnumName As IEnumNameMapping '*** Read schema section from the xml file **** pImporter.GenerateNameMapping XmlFile, pWS, pEnumName '*** Create the schema and load the data *** pImporter.ImportWorkspace XmlFile, pEnumName, pWS, False End Sub '*** Create a commandbutton and paste following code. *** Private Sub Command1_Click() Me.MousePointer = vbHourglass '*** Location of PGDB. Modify the pathnames appropriately. *** Dim db As String db = "\foo" '*** Location of xml file. Modify the pathnames appropriately. *** Dim XmlFile As String XmlFile = App.Path + "\GN.xml" ImportWS db, XmlFile MsgBox "Imported Geodatabase Workspace from XML.", vbInformation End Sub </DEVELOPENV></PRE></DIV> |
|
|