Global Mapper v24.0

Import text file with WKT

nickgoodliff
nickgoodliff Global Mapper UserTrusted User
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:

var info = new GlobalMapperDLL.GM_AsciiFormatInfo_t() { mAreaType = AreaFeatureClass_t16.AFC_UNKNOWN,
                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);
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.

Best Answer

Sign In or Register to comment.