Polyline Shapefile creation (VB.NET) Web Mercator Projection

I know this is eerily similar to the topic – polyline_Shapefile_from_lat_Lon – but I think this is different enough to warrant a second look. Like the user from this past topic, I need to find a way to create a single polyline from two sets of coordinates. The projection is web Mercator.

Public Sub addshape()

    Dim outputShapefile As String = "C:\sitepadbeta\riegelwood\gdal\output_line3.shp"

    Dim shapefile As New Shapefile()
    shapefile.CreateNew(outputShapefile, ShpfileType.SHP_POLYLINE)

    ' Setting shapefile projection
    Dim srs As New MapWinGIS.GeoProjection
    srs.SetGoogleMercator()
    shapefile.GeoProjection = srs

    Dim lat1 As String = "42.384827"
    Dim lat2 As String = "42.384483"
    Dim long1 As String = "-71.088455"
    Dim long2 As String = "-71.087732"


    Dim testLine As New MapWinGIS.Shape()
    Dim shapeindex As Int16
    shapeindex = 0
    shapefile.StartEditingShapes()
    shapefile.StartEditingTable()

    testLine.Create(ShpfileType.SHP_POLYLINE)
    testLine.AddPoint(long1, lat1)
    testLine.AddPoint(long2, lat2)

    Dim linefeature As Integer = shapefile.EditInsertShape(testLine, shapeindex)


    shapefile.StopEditingShapes()
    shapefile.StopEditingTable()


    shapefile.Save()
    shapefile.Close()


End Sub

When executing the above code, a shapefile with the name output_line3.shp is created successfully. All of the supplemental files are created. but when i go to load or bring in the shapefile, nothing is displayed. I have tried to bring in the shapefile and display it in QGIS, and nothing is displayed either. I know VB.NET is not ideal and its not a clean transition, but I could not make heads or tails with the example linked in the topic as it is in C.

Are there any glaring issues or omissions in this code that would lead to the polyline not being creating or projected accordingly? I really do appreciate any and all help.

-Eric

Dear Eric,

you have to transform your Coordinates into the GoogleMercator-System by defining two GeoProjection Objects before adding the points to the Shape!

Regards,
Frank