com.esri.arcgis.geoprocessing.tools.samples
Class CreateFeaturesFromTextFile
java.lang.Object
com.esri.arcgis.geoprocessing.AbstractGPTool
com.esri.arcgis.geoprocessing.tools.samples.CreateFeaturesFromTextFile
- All Implemented Interfaces:
- GPTool
public class CreateFeaturesFromTextFile
- extends AbstractGPTool
Creates features using coordinates in text files.
The Create Features From Text File tool is contained in the Samples tool box.
Software restrictions: none
Usage tips:
- This tool will create a feature class based on coordinates given in a text file. Text files can be the output from the Write Features to Text File; tool or from files you created.
- Text files must be space delimited and will have different formats, depending on the geometry type.
- It is not necessary to provide z- and m-values to point coordinates. Values of 1.#QNAN are given to unprovided z- and m-values.
- If you use a thousands separator, the script will not work correctly. Instead of using 1,023.5, use 1023.5.
- The script is able to handle various decimal separators. For example, data from the United States will often be in the format 1234.5, while data from Europe may be in the format 1234,5. Specify the decimal separator that corresponds to your data. If you have only integers, you may specify any separator you like.
- The spatial reference parameter is optional. If you know the spatial reference of the input text coordinates, you can specify it; however, it is not required. If specified, the output feature class will have the spatial reference you selected.
- Text files that represent points should be in the following format: The first line should contain the word Point to indicate the geometry type and the next lines should have the id and x,y,z,m coordinates of the points delimited by a space. The final line should contain the word END. Generically, it will look like this:Pointid x y z mid x y z m...ENDAn example would be:Point0 1.0 1.0 3.0 1.41 2.0 2.0 1.0 3.22 3.0 1.0 2.0 2.53 2.0 0.0 1.0 1.0END
- Text files that represent multipoints should be in the following format: The first line should contain the word Multipoint to indicate the geometry type and the structure continues with the id number of the first group of points (id x y z m), followed by a zero. The points themselves follow. The final line should contain the word END. Generically, it will look like this:Multipointmultipoint_id 0pnt_id x y z mpnt_id x y z m...multipoint_id 0pnt_id x y z m...ENDAn example would be:Multipoint0 01 23.0 12.0 5.0 1.02 34.0 32.0 4.0 1.03 11.0 54.0 5.0 1.01 01 11.0 9.0 1.0 1.02 5.0 5.5 1.0 1.03 9.8 3.2 1.0 1.0END
- Text files that represent lines should be in the following format: The first line should contain the word Line to indicate the geometry type and the structure continues with the id number of the first line, followed by the part number (in case it is a multipart line). The point coordinates follow. The final line should contain the word END. Generically, it will look like this:polylineline_id part_numberpnt_id x y z mpnt_id x y z m...line_id part_numberpnt_id x y z mpnt_id x y z m...ENDThe example below represents a line feature class with two features. Feature zero contains two parts.Line0 00 1.0 1.0 0.0 0.01 2.0 2.0 0.0 0.02 3.0 3.0 0.0 0.00 10 4.0 4.0 0.0 0.01 5.0 5.0 0.0 0.02 6.0 6.0 0.0 0.01 00 1.0 6.0 0.0 0.01 2.0 5.0 0.0 0.02 3.0 4.0 0.0 0.0END
- Text files that represent polygons should be in the following format: The first line should contain the word Polygon to indicate the geometry type and the structure continues with the id number of the first line, followed by the part number (in case it is a multipart polygon). Point coordinates for the respective part and feature follow. In the case of an interior ring, the word InteriorRing (no space) is written before the group of coordinates. Polygons should be closed, that is, the first and last points should be the same. The final line should contain the word END. Generically, it will look like this:Polygonpolygon_id part_numberpnt_id x y z mpnt_id x y z m...InteriorRingpnt_id x y z mpnt_id x y z m...polygon_id part_numberpnt_id x y z mpnt_id x y z m...ENDIn the example below, there are two polygons. Polygon zero has two parts. The second part has an interior ring. Polygon one is a normal polygon.Polygon0 00 5.0 5.0 1.#QNAN 1.#QNAN1 5.0 6.0 1.#QNAN 1.#QNAN2 6.0 6.0 1.#QNAN 1.#QNAN3 6.0 5.0 1.#QNAN 1.#QNAN4 5.0 5.0 1.#QNAN 1.#QNAN0 10 0.0 0.0 1.#QNAN 1.#QNAN1 0.0 4.0 1.#QNAN 1.#QNAN2 4.0 4.0 1.#QNAN 1.#QNAN3 4.0 0.0 1.#QNAN 1.#QNAN4 0.0 0.0 1.#QNAN 1.#QNANInteriorRing0 1.0 1.0 1.#QNAN 1.#QNAN1 1.0 3.0 1.#QNAN 1.#QNAN2 3.0 3.0 1.#QNAN 1.#QNAN3 3.0 1.0 1.#QNAN 1.#QNAN4 1.0 1.0 1.#QNAN 1.#QNAN1 00 5.0 3.0 1.#QNAN 1.#QNAN1 5.0 4.0 1.#QNAN 1.#QNAN2 6.0 4.0 1.#QNAN 1.#QNAN3 6.0 3.0 1.#QNAN 1.#QNAN4 5.0 3.0 1.#QNAN 1.#QNANEND
- All the examples above will work. Pass them into a text file, save the text file, and use it as input to the tool.
- The following environment settings affect this tool: Coordinate System; Output XY Domain;
CreateFeaturesFromTextFile
public CreateFeaturesFromTextFile()
- Creates the Create Features From Text File tool with defaults.
Initializes the array of tool parameters with the default values specified when the tool was created.
CreateFeaturesFromTextFile
public CreateFeaturesFromTextFile(Object inputTextFile,
String inputDecimalSeparator,
Object outputFeatureClass)
- Creates the Create Features From Text File tool with the required parameters.
Initializes the array of tool parameters with the values as specified for the required parameters and with the default values for the other parameters.
- Parameters:
inputTextFile - nullinputDecimalSeparator - nulloutputFeatureClass - null
getInputTextFile
public Object getInputTextFile()
- Returns the Input Text File parameter of this tool .
This is a required parameter.
- Returns:
- the Input Text File
setInputTextFile
public void setInputTextFile(Object inputTextFile)
- Sets the Input Text File parameter of this tool .
This is a required parameter.
- Parameters:
inputTextFile - null
getInputDecimalSeparator
public String getInputDecimalSeparator()
- Returns the Input Decimal Separator parameter of this tool .
This is a required parameter.
- Returns:
- the Input Decimal Separator
setInputDecimalSeparator
public void setInputDecimalSeparator(String inputDecimalSeparator)
- Sets the Input Decimal Separator parameter of this tool .
This is a required parameter.
- Parameters:
inputDecimalSeparator - null
getOutputFeatureClass
public Object getOutputFeatureClass()
- Returns the Output Feature Class parameter of this tool .
This is a required parameter.
- Returns:
- the Output Feature Class
setOutputFeatureClass
public void setOutputFeatureClass(Object outputFeatureClass)
- Sets the Output Feature Class parameter of this tool .
This is a required parameter.
- Parameters:
outputFeatureClass - null
getOutputFeatureClassSpatialReference
public Object getOutputFeatureClassSpatialReference()
- Returns the Output Feature Class Spatial Reference parameter of this tool .
This is an optional parameter.
- Returns:
- the Output Feature Class Spatial Reference
setOutputFeatureClassSpatialReference
public void setOutputFeatureClassSpatialReference(Object outputFeatureClassSpatialReference)
- Sets the Output Feature Class Spatial Reference parameter of this tool .
This is an optional parameter.
- Parameters:
outputFeatureClassSpatialReference - null
getToolName
public String getToolName()
- Returns the name of this tool.
- Returns:
- the tool name
getToolboxName
public String getToolboxName()
- Returns the name of the tool box containing this tool.
- Returns:
- the tool box name
getToolboxAlias
public String getToolboxAlias()
- Returns the alias of the tool box containing this tool.
- Returns:
- the tool box alias