adding layers from spatial databases in vb.net

298
1
Jump to solution
07-11-2017 09:09 AM
Highlighted
New Contributor II

Afternoon everyone, I was wondering if anyone has any vb.net examples of adding layers to a ArcGIS Pro Map that they could share. I need to add layers, but its not just as simple as adding from a file. However if anyone has any examples of the following for Pro I would be really grateful as it will help me debug. I haven't programmed using Async before so if anyone could share:

adding a layer from a flat file

adding a layer from a spatial SQL database

adding a layer when the name changes dynamically based on a user selection in a UI that would be great.

I keep getting a method wrong and I am trying to work out which one.

TIA

S*

0 Kudos
1 Solution

Accepted Solutions
Highlighted
New Contributor II

Solved it. it was all about the QueuedTask.Run and when to use it.


Dim map As Map = MapView.Active.Map
QueuedTask.Run(
Sub()
Dim shelterslyr As Layer = LayerFactory.Instance.CreateLayer(New Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"), map)
End Sub)

A working vb example for a change

View solution in original post

1 Reply
Highlighted
New Contributor II

Solved it. it was all about the QueuedTask.Run and when to use it.


Dim map As Map = MapView.Active.Map
QueuedTask.Run(
Sub()
Dim shelterslyr As Layer = LayerFactory.Instance.CreateLayer(New Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0"), map)
End Sub)

A working vb example for a change

View solution in original post