I'm using MS VB 2015, and I have the Esri.ArcGISRuntime loaded as a reference.
How do I open an existing Shapefile? I just want to extract some data, but having real trouble getting started. Can't seem to find any tutorials for the simple stuff.
TIA
This is my code
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Async Sub OpenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OpenToolStripMenuItem.Click
Dim dialog As New OpenFileDialog()
With dialog
.Filter = "Shape|*.shp|All|*.*"
If DialogResult.OK = .ShowDialog Then
Dim myShapefileTable As Esri.ArcGISRuntime.Data.ShapefileTable = Await myShapefileTable.OpenAsync(dialog.FileName)
End If
End With
End Sub
End Class
but I get warning "BC42025 Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated."
Solved! Go to Solution.
Fixed. Bit in red needs to be this.
Dim myShapefileTable As Esri.ArcGISRuntime.Data.ShapefileTable = Await Esri.ArcGISRuntime.Data.ShapefileTable.OpenAsync(dialog.FileName) |
Hi Marc,
Can you give a little more description on what you are wanting to do? Are you wanting to load a shapefile into an ArcMap session? Are you wanting to just have the shapefile loaded into your code so that you can do stuff with it later?
I believe you have to call the FeatureLayer object in order to grab the shapefile. You're right that there are not many examples online. Take a look at this for some tidbits:
Code Example - FeatureLayerViaShapefile
(scroll to the bottom/middle and click on the VB.NET area to toggle it off of C#).
Or maybe you need to use the ShapefileWorkspaceFactory object to get the shapefile.
...new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass()
There is an example here:
(scroll to the bottom or middle to get past the C# code)
I have edited my post to show the code. It uses a fragment of the example you quote. Can't seem to get the OpenAsync method to work.
I just want to extract some shape data and export it as KML. No maps used.
Fixed. Bit in red needs to be this.
Dim myShapefileTable As Esri.ArcGISRuntime.Data.ShapefileTable = Await Esri.ArcGISRuntime.Data.ShapefileTable.OpenAsync(dialog.FileName) |