AnsweredAssumed Answered

Invalid json when loading layer

Question asked by tboebb on Jun 7, 2018

Here is how I try to load a FeatureLayer:

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())

    //bottom right
    val rightPoint = Point(16.38101960965946, 48.18357774813336, SpatialReferences.getWgs84())
    val initialExtent = Envelope(leftPoint, rightPoint)

    map = ArcGISMap(Basemap.createLightGrayCanvas())

    map.initialViewpoint = Viewpoint(initialExtent)

    val serviceFeatureTable = ServiceFeatureTable("https://services5.arcgis.com/jHdCsOKkBSDKvuhr/arcgis/rest/services/new_indoorschema_v8_inclHBF_WFL1/FeatureServer/3")

    // create feature layer from service feature tables
    val featureLayer = FeatureLayer(serviceFeatureTable)

    featureLayer.addDoneLoadingListener {
        Log.d(TAG, "layer loading done. error:" + featureLayer.loadError)

    }
    map.operationalLayers.add(featureLayer)

    // Pass a WebMap to the MapView constructor overload to display it.
    mapview.map = map

}

logcat I see:

layer loading done. error:com.esri.arcgisruntime.ArcGISRuntimeException: Invalid JSON

 

This layer works fine on the web. It fails on android. Why is that?

 

I've also tried to load it as a webmap, which fails with the exact same error message (9 out of 10 layers fail to load here: https://oebb.maps.arcgis.com/home/item.html?id=92626308405942d6a9251bb6e507cda6 )

Outcomes