Import text file with WKT

nickgoodliff
Global Mapper UserTrusted User
in SDK
I am importing a text file that contains a polygon shape in WKT format. I can use the GM_LoadGenericAsciiTextLayer function, which displays the prompt dialog window, which I tick the WKT format option and the layer loads fine. However, I am struggling to get it load without the prompt, everything I do returns an error with "Unknown error loading file".
This is my code:

This is my code:
var info = new GlobalMapperDLL.GM_AsciiFormatInfo_t() { mAreaType = AreaFeatureClass_t16.AFC_UNKNOWN,I attach an example WKT text file. These load fine when I use the dialog box (below), but not using the GM_AsciiFormatInfo_t above.
mImportType = GlobalMapperDLL.GM_AsciiImportType_t8.GM_AsciiImport_Vector,
mCoordDelim = GlobalMapperDLL.GM_AsciiCoordDelim_t8.GM_AsciiDelim_AutoDetect,
mColumnHeadersInFirstRow = 0,
mColumnsToSkip = 0,
mCoordLinePrefix = "",
mBreakOnColumnIdx = IntPtr.Zero,
mFillToBounds = 0,
mIgnoreZeroElevations = 0,
mIncludeCoordAttrs = 0,
mIncludeElevCoords = 0,
mLineType = LineFeatureClass_t16.LFC_UNKNOWN,
mNoDataDistanceFactor = 0,
mOffsetX = 0,
mOffsetY = 0,
mOffsetZ = 0,
mPointType = PointFeatureClass_t16.PFC_UNKNOWN,
mScaleX= 1,
mScaleY = 1,
mScaleZ = 1,
mYCoordFirst = 0
}; var LastGMError = GlobalMapperDLL.GM_LoadGenericAsciiTextLayer(filepath, out theLayerHandlePtr, GlobalMapperDLL.GM_LoadFlags_t32.GM_LoadFlags_UseDefaultProj, ref info, ref proj);

Answers
-
Hey, sorry for the late response. The issue here is that the GM_LoadGenericAsciiTextLayer does not currently support WKT files.
You can instead use GM_RunScript and use the IMPORT_ASCII command and that should contain all of the options you need.
Here is a link to the knowledge base for scripts: http://bluemarblegeo.com/knowledgebase/global-mapper/ScriptReference.html#cmd_import_ascii
At the bottom of the command you will see an example. Hopefully that helps.
Categories
- 12.9K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 643 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 419 Projection Questions
- 829 Raster Data
- 1.4K Vector Data
- 6.6K Support
- 180 Announcement and News
- 926 Bug Report
- 561 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 574 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 241 How I use Global Mapper
- 108 Global Mapper Forum Website