Select to view content in your preferred language

How can I add operational layers to an offline SceneView in a SwiftUI project

945
4
Jump to solution
07-11-2023 04:43 PM
alionthego
Emerging Contributor

I have a SwiftUI project that has a 3D Sceneview of the earth.  I have used a mobile scene package to achieve this and it works fine.

I now want to add operational layers to this SceneView.  I am using a Lite licence.

I have my Data in the form of a .shp file which I have downloaded and just directly added to my project.  I can also use a kml file.

I have tried to use the following:

let url = Bundle.main.url(forResource: "World_Cities", withExtension: "shp")!

let shapefileFeatureTable = ShapefileFeatureTable(fileURL: url)

try await shapefileFeatureTable.load()

let featureLayer = FeatureLayer(featureTable: shapefileFeatureTable)

viewModel.scene.addOperationalLayer(featureLayer)

However this doesn't work and no data is shown.   As this is a fully offline application I cannot download the content for the layers so wondering what I'm doing wrong here.  Or if my approach is wrong and I need to use a different method to display the cities layer.  I can do it by creating individual GraphicsLayers for each city but that is very tedious.  I want to just add an operationalLayer somehow.

I tried this also without the .load() line and also didn't work.  With the .load() line there will be an error message "unlicensedFeature".  Not sure if that is the issue though as it should be possible to add layers with a Lite Licence.

0 Kudos
1 Solution

Accepted Solutions
Ting
by Esri Contributor
Esri Contributor

I have confirmed with our licensing folks that displaying a shapefile require a standard license. Please check this doc on licensing for more details.

View solution in original post

0 Kudos
4 Replies
Ting
by Esri Contributor
Esri Contributor

I tried this also without the .load() line and also didn't work.  With the .load() line there will be an error message "unlicensedFeature"

Can you try to comment out the lite license, and use the default developer mode?

I tried to write up a demo to load an MSPK and a world cities shapefile and they display just fine, shown in the attached screenshot. If you can see the shapefile feature layer with the license removed, then I'll help you consult our licensing staff to see what is the specific license required for it.

0 Kudos
alionthego
Emerging Contributor

Thanks, it does display with the licence commented out so I guess this is a licensing issue.  I am using a Lite Licence at the moment.

0 Kudos
Ting
by Esri Contributor
Esri Contributor

I have confirmed with our licensing folks that displaying a shapefile require a standard license. Please check this doc on licensing for more details.

0 Kudos
alionthego
Emerging Contributor

Ok.  thanks for that.

0 Kudos