ArcPad Scripting Object Model Reference > ArcPad Scripting Samples > Create New Shapefile |
Description:
How to use:
JScript
Copy Code function CreateNewShapeFile() { var pRS, strCurrDir; // create the recordset object pRS = Application.CreateAppObject ("RecordSet"); // get the map and data path strCurrDir = Preferences.Properties("DataPath"); // create a shapefile and add some fields pRS.Create (strCurrDir + "\\NewShapefile.shp", apShapePoint); pRS.Fields.Append ("ID", apFieldNumeric, 4, 0); pRS.Fields.Append ("NAME", apFieldCharacter, 30, 0); // add the new shapefile to the map Map.AddLayerFromFile (strCurrDir + "\\NewShapefile.shp"); // free objects pRS = null; } CreateNewShapeFile();
VBScript
Copy Code | |
---|---|
Sub CreateNewShapeFile() Dim pRS, strCurrDir '++ create the recordset object Set pRS = Application.CreateAppObject ("RecordSet") '++ get the map and data path strCurrDir = Preferences.Properties("DataPath") '++ create a shapefile and add some fields Call pRS.Create (strCurrDir & "\NewShapefile.shp" , apShapePoint) Call pRS.Fields.Append ("ID", apFieldNumeric, 4, 0) Call pRS.Fields.Append ("NAME", apFieldCharacter, 30, 0) '++ add the new shapefile to the map Call Map.AddLayerFromFile (strCurrDir & "\NewShapefile.shp") '++ free objects Set pRS = Nothing End Sub Call CreateNewShapeFile() |