Global Mapper Pro

Export Vector Dataset to Shape File with changing data type

I script exporting vector datasets to shape file. Before the data records are exported, the data typ of one attribute has to be converted from numeric to string.

How can I implement this?

Regards,

Daniel

Tagged:

Answers

  • JeffH@BMG
    JeffH@BMG Global Mapper Developer Trusted User

    Hi Daniel,

    In the Shapefile Export Options, on the Attribute Setup tab, you should be able to find the attribute in the list. You can change the attribute associated type by clicking on its entry in the Type field. Hope that this helps.

    Cheers,

    ~Jeff

  • Hi Jeff,

    I know the way via Shapefile Export Options and changing the associated attribute type. Exactly these settings/options I'm looking for in global mapper script.

    cheers,

    Daniel

  • JeffH@BMG
    JeffH@BMG Global Mapper Developer Trusted User

    Hi Daniel,


    Sorry, I missed the bit about scripting.

    So I looked at the script engine and as far as I can tell, the shapefile export command doesn't support changing attribute types directly. That would be a nice addition, so I've added a new ticket, GM-13876, to add that functionality.

    A possible workaround is to use the CALC_ATTR_FORMULA script command, using the STR() function in a formula to create a new attribute of the desired type. See https://www.bluemarblegeo.com/knowledgebase/global-mapper-23-1/cmd/CALC_ATTR_FORMULA.htm for CALC_ATTR_FORMULA, and the associated script formula reference https://www.bluemarblegeo.com/knowledgebase/global-mapper-23-1/Scripting_Reference/Formula_Calculator.htm.

    If you need to use the same attribute name for the export, you can use the EDIT_VECTOR script command with the ATTR_TO_RENAME parameter to rename the original attribute in question to something else, and then use CALC_ATTR_FORMULA to create a new attribute with the original name. See https://www.bluemarblegeo.com/knowledgebase/global-mapper-23-1/cmd/EDIT_VECTOR.htm

    Best regards,

    ~Jeff

  • Hi Jeff,

    I'm glad that you opened a ticket for the missing possibility. Until then I will try your workaround.

    best regards,

    Daniel

  • JeffH@BMG
    JeffH@BMG Global Mapper Developer Trusted User

    If you have problems with the workaround, feel free to give a shout, but I'm pretty sure it will work; it's just more complicated, and changes the original data. Best, ~Jeff

Sign In or Register to comment.