Global Mapper v25.0

Convert an Area to Lines?

Roger Edrinn
Roger Edrinn Global Mapper UserTrusted User
edited July 2011 in Vector Data
I downloaded a shapefile boundary expecting lines, I got an area shapfile. I was working with the edit tools vertices trying to break the thing into a group of line vertices. No Luck.

Is their a way to break apart an area into line segments?

Thanks

Comments

  • global_mapper
    global_mapper Administrator
    edited December 2007
    Yes, you can select the area(s) with the Digitizer Tool, then right click and select the option to generate line features from the area(s).

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • Roger Edrinn
    Roger Edrinn Global Mapper User Trusted User
    edited December 2007
    That worked easy enough, but I'm not able to break the line apart and delete some lines.

    Vision two boxes, side-by-side, where they join vertically, I want to delete both verticals and join, or not, the horizontal lines. When I attempted to delete the corner vertice, GM says I can't.

    Part of my problem is I'm used to CorelDraw, so bit of a mind block.

    Thanks
  • global_mapper
    global_mapper Administrator
    edited December 2007
    You need to first enable vertex display (Shift+V), then you can select the vertex where you want to split up the line, then right click and select the option to split the line at the vertex. Then repeat that as necessary to break up your line into pieces. You can then select the desired line pieces and delete those, leaving just the ones that you want.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • Roger Edrinn
    Roger Edrinn Global Mapper User Trusted User
    edited December 2007
    I thought I was doing exactly that, just wasn't working. Probably because I needed to delete four different lines and was expecting two.

    I needed a break, nothing like shovelling 15" of snow off the deck to reset the brain. :)

    Thanks
  • GMtester
    GMtester Global Mapper User
    edited June 2011
    Yes, you can select the area(s) with the Digitizer Tool, then right click and select the option to generate line features from the area(s).

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com

    Can this process be scripted?
    ie
    1)open a file containing area shapes
    2)convert all those areas to lines
    3)export the lines as a new vestor shape file

    what would 2 look like? Or perhaps some other method to script this process?
  • global_mapper
    global_mapper Administrator
    edited June 2011
    There is a multi-step method to do this. It would look like the following:

    1) IMPORT command to load areas
    2) EXPORT_VECTOR command to export areas to simple ASCII text file. Add TYPE=SIMPLE_ASCII and EXPORT_ATTRS=NO to get text file with no attributes
    3) UNLOAD_ALL
    4) IMPORT_ASCII command to load file back in. Add TYPE=POINT_AND_LINE to pull data in as lines
    5) EXPORT_VECTOR to export lines back out as Shapefile

    Note this will remove any attributes. I may have some other solutions if you need to keep those.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
    5) EDIT_VECTOR command to
  • GMtester
    GMtester Global Mapper User
    edited June 2011
    DIR_LOOP_START DIRECTORY="path-to-area-files" FILENAME_MASKS="*.shp" RECURSE_DIR=YES
    IMPORT FILENAME="%FNAME_W_DIR%" PROJ_NAME="GEO_WGS84" HIDDEN=NO
    EXPORT_VECTOR FILENAME="%FNAME_W_DIR%_ASCII.TXT" TYPE=SIMPLE_ASCII EXPORT_ATTRS=NO GEN_PRJ_FILE=YES COORD_DELIM=COMMA FEATURE_SEP=BLANK_LINE
    UNLOAD_ALL
    IMPORT_ASCII FILENAME="%FNAME_W_DIR%_ASCII.TXT" TYPE=POINT_AND_LINE PROJ_NAME="GEO_WGS84" COORD_DELIM=COMMA
    EXPORT_VECTOR FILENAME="%FNAME_W_DIR%_LINE.SHP" TYPE=SHAPEFILE SHAPE_TYPE=LINES GEN_PRJ_FILE=YES
    UNLOAD_ALL
    DIR_LOOP_END
  • GMtester
    GMtester Global Mapper User
    edited July 2011
    I may have some other solutions if you need to keep those.

    In general the conversion works well but now I'd like to take you up on a method that retains (at least one) of the attributes.

    I'm stumped as to how you might do it?
  • global_mapper
    global_mapper Administrator
    edited July 2011
    I have updated the EDIT_VECTOR script command to support a new CONVERT_AREAS_TO_LINES=YES parameter that will convert area features to lines. Use the following command to do this:

    EDIT_VECTOR CONVERT_AREAS_TO_LINES=YES

    I have placed a new build at http://www.globalmapper.com/global_mapper12.zip with the change for you to try. Simply download that file and extract the contents into your existing v12.xx installation folder to give it a try. If you are using the 64-bit v12 version there is a new build at http://www.globalmapper.com/global_mapper12_64bit.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com