Solved! Go to Solution.
import urllib, urllib2, httplib import json import socket # User Variables username = "" password = "" # Monkey Patch httplib read def patch_http_response_read(func): def inner(*args): try: return func(*args) except httplib.IncompleteRead, e: return e.partial return inner httplib.HTTPResponse.read = patch_http_response_read(httplib.HTTPResponse.read) # Get token hostname = "Http://" + socket.getfqdn() token_URL = 'https://www.arcgis.com/sharing/generateToken' token_params = {'username':username,'password': password,'referer': hostname,'f':'json'} token_request = urllib2.Request(token_URL, urllib.urlencode(token_params)) token_response = urllib2.urlopen(token_request) token_string = token_response.read() token_obj = json.loads(token_string) token = token_obj['token'] # Build the json string text = {"operationalLayers": [], "baseMap": {"title": "Basemap", "baseMapLayers": [{"visibility": "true", "opacity": 1, "isReference": "true", "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer", "minScale":1155581, "maxScale":144448}, {"visibility": "true", "opacity": 1, "url": "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer", "minScale":144448, "maxScale":200}, {"visiblity": "true", "opacity": 1, "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", "minScale": 500000000, "maxScale": 1155581}]}, "version": "1.7"} query = {"token" : token, "f" : "json", "text" : text, "title" : "Test Basemap", "type" : "Web Map", "tags" : "basemap, test"} serviceURL = 'http://www.arcgis.com/sharing/rest/content/users/{}/addItem'.format(username) createBasemap = urllib2.Request(serviceURL, urllib.urlencode(query)) createBasemap.add_header('Referer', hostname) createBasemap_response = urllib2.urlopen(createBasemap) print createBasemap_response.read()
"baseMapLayers": [ { "id": "World_Imagery_8854", "opacity": 1, "visibility": true, "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" }, { "id": "MyDynamicLayer_7237", "opacity": 1, "visibility": true, "url": "http://yourserver/arcgis/rest/services/MyDynamicLayer/MapServer", "minScale": 4000, "maxScale": 1 }, { "id": "BaseScales_9486", "isReference": true, "opacity": 1, "visibility": false, "url": "http://yourserver/arcgis/rest/services/BaseScales/MapServer" } ],
Is it possible to use a multilayer basemap of tiled map services, but specify the LOD's? I have two tiled map services that have most of the same LOD's however one goes into more detail. I want to have the one with more detail on top and use that as the LOD reference.
Thanks!