-
-
Save oevans/471db96ba59f19252b4a to your computer and use it in GitHub Desktop.
Create a basemap that also includes a reference layer (e.g., Esri's "Imagery + Labels" basemap). Currently (June 2013), this can only be done programmatically.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def addItem(self): | |
''' Uses the addItem to create new content in an Org. ''' | |
# http://www.arcgis.com/apidocs/rest/index.html?additem.html | |
# replace - http://tiles.arcgis.com/tiles/.../MapServer | |
# with the tile layer you want to use. Feature services will not work. | |
portalId = self.__portalId__() | |
req = urllib2.Request( self.portalUrl + '/sharing/rest/content/users/'+self.username+'/addItem') | |
req.add_data(urllib.urlencode({'token' : self.token, | |
'f' : 'json', | |
'text' : '{\"operationalLayers\": [],\"baseMap\": {\"title\": \"Light Gray Canvas Custom\",\"baseMapLayers\": [{\"visibility\": true,\"opacity\": 1,\"url\": \"http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer\"},{\"visibility\": true,\"opacity\": 1,\"isReference\": true,\"url\": \"http://tiles.arcgis.com/tiles/.../MapServer\"}]},\"version\": \"1.4\"}', | |
'title' : 'CustomBasemap2', | |
'type' : 'Web Map', | |
'tags' : 'basemap'})) | |
print urllib2.urlopen(req) | |
return | |
# sample call to addItem | |
import csv | |
import admin | |
myAgol = admin.admin() | |
myAgol.addItem() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment