Select to view content in your preferred language

Loading a tile layer via portal results in "Portal item type incorrect"

887
6
Jump to solution
07-18-2023 05:53 AM
padmalcom
Frequent Contributor

We are loading a map via a portal and a portal item. The map we load is based on a tile layer and it is public. Unfortunately, I get the error "Portal item type incorrect" and I don't know what to do about it.

val portal = Portal(Endpoints.ARCGIS_PORTAL_SERVER, Portal.Connection.Anonymous)
portal.load()
.onSuccess {
Timber.d("Portal loaded with status ${portal.loadStatus.value}")
val portalItem = PortalItem(portal, Endpoints.ARCGIS_BASEMAP_ID)
portalItem.load().onSuccess {
Timber.d("Portal item loaded with status ${portalItem.loadStatus.value}")
mapView.map = ArcGISMap(portalItem).apply {
load().onSuccess {
Timber.d("Map loaded successfully with status ${loadStatus.value}")
}.onFailure {
Timber.d("Failed to load map with status ${loadStatus.value}")
}
}
}.onFailure {
Timber.d("Portal item load failed with status ${portalItem.loadStatus.value}")
}
}
.onFailure {
Timber.d("Portal load failed with status ${portal.loadStatus.value}")
}  

 

0 Kudos
1 Solution

Accepted Solutions
ChanganShi1
Regular Contributor

It is totally dependent upon your purpose. You can initialize a ArcGIS Map using a VectorTiledLayer as base layer, and adding additional operational layers. Or Building a Map by web map, which has been built and configured in the ArcGIS server. 

View solution in original post

0 Kudos
6 Replies
ChanganShi1
Regular Contributor

I believed you supplied an incorrect portal item ID, 

val portalItem = PortalItem(portal, Endpoints.ARCGIS_BASEMAP_ID)

 

look at the Kotlin PortalItem Doc, https://developers.arcgis.com/kotlin/api-reference/arcgis-maps-kotlin/com.arcgismaps.mapping/-portal...  usually It points to a web map ID instead of an endpoint of Base map.

 

Please update the Endpoints.ARCGIS_BASEMAP_ID point to an ITEM Id defined in the Portal.

Thanks, 

0 Kudos
padmalcom
Frequent Contributor

Hi @ChanganShi1, thank you for your reply and sorry for the confusion. Endpoints.ARCGIS_BASEMAP_ID provides the item ID of the VectorTileServer. I took it from the URL as mentioned in the documentation.

I think the question is, if a map can be initialized from a VectorTileServer via the item ID. I could not find anything about it in the docs.

0 Kudos
ChanganShi1
Regular Contributor

Hi, Thank your clarification.  

mapView.map = ArcGISMap(portalItem)

The portalItem.type must be the PortalItemType.WebMap. Other types cannot instantiate a map

It is documented here 

padmalcom
Frequent Contributor

Thank you @ChanganShi1, I did not look at the right place in the documentation. That means to me that I can not initialize a Map using a VectorTileServer, VectorTilePackage or a VectorTiledLayer right? In that case I have to talk to my GIS colleagues if they can provide the map as WebMap.

0 Kudos
ChanganShi1
Regular Contributor

It is totally dependent upon your purpose. You can initialize a ArcGIS Map using a VectorTiledLayer as base layer, and adding additional operational layers. Or Building a Map by web map, which has been built and configured in the ArcGIS server. 

0 Kudos
padmalcom
Frequent Contributor

Thank you @ChanganShi1. For me, this example finally helped to understand how to work with VectorTiledLayer.

https://github.com/Esri/arcgis-maps-sdk-java-samples/blob/main/tiled_layers/tiled-layer/src/main/jav...

0 Kudos