Select to view content in your preferred language

ArcGIS Indoors - Can FloorManager use a traditional Map Service or Feature Layer?

505
9
Jump to solution
08-02-2024 12:49 PM
DavidSchuster
Regular Contributor

Hello!

Is there a way to use the ArcGIS Indoors FloorManager class with traditional Map Services (i.e. not AGO/Portal web maps) in a WPF application that uses the .NET Maps SDK version 200.5?

We are in the process of getting ArcGIS Indoors up and running in our organization and in-house applications.  We have successfully converted our floor plans and features into the Indoors data model.  I was able to build a simple prototype floor picker control that uses the FloorManager class to change the visibility of the floor levels, but I could only get this to work using ArcGIS Online / Portal web map.  However, I'm not having much luck getting this working with traditional Map Services (non-Portal items).  The FloorManager object on the Map object is always null and I'm not sure how to initialize it.  Would it help to add the floor-aware layers as operational layers to the map using FeatureLayers or FeatureCollectionLayers?

Thank you!

David

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Dominique_Broux
Occasional Contributor

Hi David,

I noticed that your facility and level layers share the same layerId, indicating they are identical.
The facility and level layers must be different layers in the map (inside group layer should not be a problem)

So, either there is a mistake in one of your layerId, or you try referencing a map image layer that could contain both the facility and the level layers.
For now, Maps SDK doesn't support indoor model inside a map image layer (would need to add the sublayerId field in the facility and level definition). Facility and level layers have to be feature layers.

View solution in original post

9 Replies
dotMorten_esri
Esri Notable Contributor

Are you assigning a floor definition to the Map.FloorDefinition and/or FeatureLayer.FloorDefinition properties?

A webmap is still just "traditional map services", describing which layers to use and configuration of them, including the floor definition. You should still be able to set all of this up programmatically instead, which I should make the FloorManager initialize when the Map loads.

0 Kudos
DavidSchuster
Regular Contributor

Thanks Morten, I totally missed the FloorDefinition properties.  I try that out!

0 Kudos
DavidSchuster
Regular Contributor

Hi Morten,

I think I'm close to getting it working by manually initializing the FacilityLayerDefinition and LevelLayerDefinition before calling LoadAsync() on the MyMap.FloorManager object.  We aren't using sites so I didn't initialize the SiteLayerDefinition - I left it null.

However, I'm getting an “Level layer not found” exception when I call FloorManager.LoadAsync().  I also get this error if I try instead try to initialize the map using a portal item (which automatically initializes the FacilityLayerDefinition and LevelLayerDefinition objects on the Map).

Any ideas what might be causing this error?  Is it because the Levels and Facilities layers are under a Group Layer in our map service, instead of being directly in the root level? 

DavidSchuster_0-1723055334294.png

DavidSchuster_1-1723055360977.png

Thanks,

David

0 Kudos
DavidSchuster
Regular Contributor

@dotMorten_esri  Hi Morten, we tried republishing the web map to get rid of the group layer, but that didn't fix the issue.  We're still getting an InvalidOperationException with a message of "Invalid call: Level layer not found" when I try to call MyMapView.Map.FloorManager.LoadAsync();

This error occurs whether I'm creating the map from a WebMap Portal item (hosted in our Portal environment) or add a map service to the map's operational layers and manually initialize the FloorDefinitions (LevelLayerDefinition and FacilityLayerDefinition) before calling FloorManager.LoadAsync().

Any ideas?

0 Kudos
XuemingWu
Esri Contributor

Hi David,

Usually the error with "Level layer not found" is thrown when the layer defined in the LevelLayerDefinition does not present in the map or the LevelLayerDefinition is missing in the Map.FloorDefinition. The latter is unlikely to happen especially when creating GeoModelFloorDefinition, facility and level definition in your code. Could you check whether there is any Layer.id in Map.operationalLayers matching the LevelLayerDefinition.layerId? Could you also check whether the layer is a type of FeatureLayer or a FeatureLayer in a GroupLayer if such a layer exists in the map?

As shown in the JSON of a web map example, the id of an operational layer matches the layerId specified in the LevelLayerDefinition.

Json of LevelLayerDefinition within the Map.FloorDefinition:

"mapFloorInfo": {
"levelLayer": {
"layerId": "1484f389a02f49789e43d9cf8210912f",
"levelIdField": "LEVEL_ID",
"facilityIdField": "FACILITY_ID",
"longNameField": "NAME",
"shortNameField": "NAME_SHORT",
"levelNumberField": "LEVEL_NUMBER",
"verticalOrderField": "VERTICAL_ORDER"
},

One of the layers in the Map.operationalLayers:

"id": "1484f389a02f49789e43d9cf8210912f",
"showLegend": true,
"title": "Levels",

Dominique_Broux
Occasional Contributor

Hi David,

I noticed that your facility and level layers share the same layerId, indicating they are identical.
The facility and level layers must be different layers in the map (inside group layer should not be a problem)

So, either there is a mistake in one of your layerId, or you try referencing a map image layer that could contain both the facility and the level layers.
For now, Maps SDK doesn't support indoor model inside a map image layer (would need to add the sublayerId field in the facility and level definition). Facility and level layers have to be feature layers.

DavidSchuster
Regular Contributor

Thanks Dominique!

That was the problem - I was using a single map image service layer and not individual feature layers when adding the data to the map.  Once I changed my configuration to include the facilities and levels as individual Feature Layers in the map, I was able to initialize the floor manager successfully.

However, I'm having trouble with the next step.  I have feature layers that contain details for each facility/level (for example, the locations of fire extinguishers, security cameras, etc) which I also included as individual Feature Layers into the operational layers of the map, but when I try to change the level visibility through the floor manager it seems to have no effect.  All of the features show up all the time, regardless of how I set the level visibility through the floor manager.  How do I make these other feature layers known to the floor manager so that it can correctly control them? 

DavidSchuster
Regular Contributor

I think I answered my own last question.  In addition to initializing the Map's FloorDefinition (with a new GeoModelFloorDefinition object), I also had to initialize each feature layer's FloorDefinition (with a new LayerFloorDefinition object) in order to make them floor aware.

Should this be necessary, or is there a better way?

DominiqueBroux
Esri Frequent Contributor

Yes, it's the right way.
To support floor filtering, a layer needs a FloorDefinition which specifies the field of the layer to use for the filtering (i.e. the field containing the level ID)

0 Kudos