我试图加载此网页地图(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:无效的JSON。
答案 0 :(得分:0)
您的代码似乎不错,问题可能出在加载Web地图的100.2.1 Android SDK内部。此问题应在几周后发布的100.3.0版中修复。我在内部版本上运行您的代码,并且渲染的图层和符号类似于网络版本。