我正在尝试加载此网络地图(https://oebb.maps.arcgis.com/home/item.html?id=f89eab37e55540f7b2e25a88cd0a07d5),但大多数图层都没有显示。它可以在网络上运行,但在 Android 上失败(使用最新的 sdk,100.2.1)。
class MainActivity : AppCompatActivity() {
lateinit var mMapView: MapView
private lateinit var map: ArcGISMap
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// inflate MapView from layout
mMapView = findViewById(R.id.mapview)
val leftPoint = Point(16.374120968073157, 48.186396114084104, SpatialReferences.getWgs84())
val rightPoint = Point(16.38101960965946, 48.18357774813336, SpatialReferences.getWgs84())
val initialExtent = Envelope(leftPoint, rightPoint)
//construct a map from the portal item
map = ArcGISMap("https://oebb.maps.arcgis.com/home/item.html?id=f89eab37e55540f7b2e25a88cd0a07d5")
// set starting envelope for the ArcGISMap
map.initialViewpoint = Viewpoint(initialExtent)
// Pass a WebMap to the MapView constructor overload to display it.
mapview.map = map
}
override fun onPause() {
super.onPause()
mMapView.pause()
}
override fun onResume() {
super.onResume()
mMapView.resume()
}
override fun onDestroy() {
super.onDestroy()
mMapView.dispose()
}
}
10 个图层中有 9 个有异常 (map.operationalLayer[0].loadError: ArcGISRuntimeException: Invalid JSON.