Convert Closed Line Segment into Polygon

Question:

Can I convert a closed line segment into a polygon (needing to figure out it's area and change the shading within the shape).

Answer:

Here's a script that takes all of the lines on the selected layer and creates new polygons on another layer (named with the name of the previous layer + "Poly"). With 1.2, there is no way to retrieve the selected items, so you'll need to isolate the line features that you want to create polygons from onto their own layer before running the script. The easiest way to do this is: 

- Select the features you want to convert
- Choose Layer > Create Layer From Selection
* Optionally change the name of the layer
- Run the enclosed script (double-click on it and AppleScript Editor should open. Use the Run command)
- Use the Selection Layer when prompted for which layer to convert

The script will run and create the new layer with all of the data from the selected layer and polygons instead of lines. It will close the polygons if necessary during creation.

Cheers,
-Gaige

Have more questions? Submit a request

Comments

  • Avatar
    Zack Beatty

    HOT DAMN, this is what I needed! Thanks.

    Which begs the question: with so many other features in the Cartographica GUI, why is such a common task not supported (w/o custom script)?

  • Avatar
    Gaige

    Thanks for the comments, Zack. We use the scripts to plug the gaps between what the software does out-of-the-box and what user's immediate needs are. We also use them as an illustration of how scripting can be adopted by users to execute repetitive tasks.

    In the end, many of these scripts do make their way into future versions of the software–many of our initial analysis tools were implemented using scripting first, and even some of our styles were done that way originally.

  • Avatar
    Zack Beatty

    Thanks for the response, Gaige.

Powered by Zendesk