I want to populate map from json data in Android, but can't find any relevant information/method to do so. Does anyone over there have any idea ?

4209
2
02-05-2015 10:25 PM
shailendrarajawat
New Contributor

the format of json is

{

"currentVersion": 10.01,

"serviceDescription": "",

"mapName": "Layers",

"description": "",

"copyrightText": "",

"layers": [

  {

   "id": 0,

   "name": "",

   "parentLayerId": -1,

   "defaultVisibility": true,

   "subLayerIds": null,

   "minScale": 0000,

   "maxScale": 0

  }

],

"tables": [],

"spatialReference": {},

"singleFusedMapCache": false,

"initialExtent": {

  "xmin": ,

  "ymin": ,

  "xmax": ,

  "ymax": ,

  "spatialReference": {}

},

"fullExtent": {

  "xmin": -1.0547305

.

.

.

.

}

I know we can create layer using  ArcGISDynamicMapServiceLayer(url) constructor, but i have json instead of URL.

iOS sdk provides this facility

AGSDynamicMapServiceLayer *dynamicLayer = [[AGSDynamicMapServiceLayer alloc] initWithJSON:mapJson];

so i believe it should be possible for android as well. But have no idea.. how

Tags (2)
0 Kudos
2 Replies
MengyiGuo
Occasional Contributor

Hi Shailendra,

I'm afraid right now we don't have a similar method in Android to do so. Initialization parses Json from REST end point.

0 Kudos
KeithTurner
New Contributor III

We're showing data from a JSON web service on our map.  We grab the json from our web service.  Take that and reformat it into the json format used by arcgis server (documented here - ArcGIS Server REST API ).  Take the resulting json, feed it into FeatureSet.fromJson(JsonParser) to get a featureset and add that to a graphicslayer.

It's not simple/pretty, but it does the job.

Keith