Select to view content in your preferred language

adding layers from spatial databases in vb.net

776
1
Jump to solution
07-11-2017 09:09 AM
SamanthaHughes1
Deactivated User

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
SamanthaHughes1
Deactivated User

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
SamanthaHughes1
Deactivated User

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