Add REST map service to basemap

المشرف العام

Administrator
طاقم الإدارة
I have created a JSON file which includes 30 map service layers and their attributes. This includes the map service url. My function creates a table of contents from the JSON object so that when I click on a ToC value it returns the map service owner, name and service url. Using the url how can I add the service layer to my basemap??

So far the code to return the layer info is as follows:

$(document).ready(function () { for (index in jsonString.Land) { $('#land ul').append('' + jsonString.Land[index].name + '
'); } for (index in jsonString.Air) { $('#air ul').append('' + jsonString.Air[index].name + '
'); } for (index in jsonString.Water) { $('#water ul').append('' + jsonString.Water[index].name + '
'); } for (index in jsonString.Heritage) { $('#heritage ul').append('' + jsonString.Heritage[index].name + '
'); } for (index in jsonString.Waste) { $('#waste ul').append('' + jsonString.Waste[index].name + '
'); } $('a').on('click', function () { $('#show').html($(this).attr('data-owner') + '
' + $(this).attr('data-url')); }); }); I've searched online for an example and having had a look at the Javascript api fro ArcGIS I'm still failing. Any help would be much appreciated.



أكثر...
 
أعلى