How do I get the polyline vertices of a .shp
Hi,
I got a shp file containing many polylines. I need the vertices of each polyline to create arrays.
I added a base layer :
The HTML Clipboard
Dim BaseLayer As Object Set BaseLayer = Shapes.AddBaseLayer(Map:= MapFrame, ImportFileName:="...profiles.shp")
I found this example in the documentation. How do I select the Polyline Vertices of the BaseLayer to make an array?
The HTML Clipboard
Dim Vertices() As Double Vertices() = PolyLine.Vertices Dim Element As Integer For Element = 0 To 13 Step 1 Debug.Print Vertices(Element) Next
-
Hello Björn,
Is your purpose for getting the vertices into an array just to print the array, like the bottom example shows? If so, I instead recommend turning off the map axes and exporting to a BLN file. This can be accomplished via automation (see example below). The BLN can then be opened in a text editor. Each shape in the file will be separated by a header row.
Sub Main Dim SurferApp, MapFrame As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True Dim Plot As Object Set Plot = SurferApp.Documents.Add(srfDocPlot) Set MapFrame = Plot.Shapes.AddBaseMap(ImportFileName:="C:\path\profiles.shp") MapFrame.Axes.Item(1).Visible=False MapFrame.Axes.Item(2).Visible=False MapFrame.Axes.Item(3).Visible=False MapFrame.Axes.Item(4).Visible=False Plot.Export2(FileName:="C:\path\profiles.bln", FilterID:="bln") End Sub
Thanks!
Leslie McWhirter
Technical Support
Golden Software
Please sign in to leave a comment.
Comments
1 comment