30 likes | 127 Views
Add Map Layer. Jan R ůžička Jan.ruzicka @vsb.cz. Add Layer / 1. OpenFileDialog1.Filter = "ESRI Shapefile|*.shp“ O penFileDialog1.Title = "Add Layer“ OpenFileDialog1.ShowDialog() Dim path As String = OpenFileDialog1.FileName() Dim ll As Integer = path.LastIndexOf("")
E N D
Add Map Layer Jan Růžička Jan.ruzicka@vsb.cz
Add Layer / 1 OpenFileDialog1.Filter = "ESRI Shapefile|*.shp“ OpenFileDialog1.Title = "Add Layer“ OpenFileDialog1.ShowDialog() Dim path As String = OpenFileDialog1.FileName() Dim ll As Integer = path.LastIndexOf("\") Dim directory As String Dim layername As String directory = path.Substring(0, ll + 1) layername = path.Substring(ll + 1, path.Length - ll - 5)
Add Layer / 2 Dim ds As New MapObjects2.DataConnection Dim g As MapObjects2.GeoDataset Dim l As New MapObjects2.MapLayer ds.Database = directory g = ds.FindGeoDataset(layername) l.GeoDataset = g AxMap1.Layers.Add(l)