Create a shapefile from a text file with XY values


PurposeThis developer sample shows how to create a points shapefile from a text file which contains Latitude/Longitude/Value tuples. The text file should contain 1 tuple per line, and each Latitude, Longitude, and Value data item should be separated by whitespace (e.g. tab-delimited). A command-line parameter determines which part of the ArcObjects API is used to add the features in the shapefile.

How to use

If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Run the application providing valid input parameters. For details on the input parameters see the Additional information section.

Additional information

The application requires the following command line parameters:
  • -t [path to input text file] (e.g. -t "c:\path\to\input.txt"), PATH_TO_TEXT_FILE in Makefile
  • -p [path to resulting shapefile] (e.g. -p "c:\path\to"), OUTPUT_PATH in Makefile
  • -s [name of output shapefile] (e.g. -s shapefile.shp), OUTPUT_SHAPEFILE_NAME in Makefile
  • -b to use a feature buffer or leave empty to use CreateFeature/Store, FEATURE_BUFFER in Makefile


CreateShapeFromText.cpp Implementation file
CreateShapeFromText.h Header file
LicenseUtilities.cpp Implementation file
LicenseUtilities.h Header file
Makefile.Solaris Solaris Makefile
Makefile.Linux Linux Makefile
Makefile.Windows Windows Makefile
Download the CPP files

Download the files for all languages




Additional Requirements
  • A text file with each point on a separate line and tab-delimited values for the longitude, latitude, and value of each point.

Development licensing Deployment licensing
Engine Developer Kit Engine