Comments (3)
Though this is not an ArcREST issue, you can try the following workflow (I have not tested this).
Using the WebMap JSON, create a map document and an operational layer. On the operational layer url, include the token (?token=) and I think that will solve your issue.
Hope this helps.
from arcrest.
Just an FYI, I just took the JSON from one of the samples is the REST API:
Here is a working sample that worked for me:
text = """{"operationalLayers":[{"url":"?token=< TOKEN>","id":"STATES_OUTLINE_717","visibility":true,"opacity":0.78,"mode":1,"title":"States Outline","layerDefinition":{"drawingInfo":{"renderer":{"type":"simple","symbol":{"color":[108,151,203,0],"outline":{"color":[108,151,203,255],"width":2,"type":"esriSLS","style":"esriSLSSolid"},"type":"esriSFS","style":"esriSFSSolid"}}},"minScale":500000000,"maxScale":0},"popupInfo":{"title":"Offset from UTC: {ZONE}","fieldInfos":[{"fieldName":"ObjectID","label":"ObjectID","isEditable":false,"tooltip":"","visible":false,"stringFieldOption":"textbox"},{"fieldName":"Shape","label":"Shape","isEditable":false,"tooltip":"","visible":false,"stringFieldOption":"textbox"},{"fieldName":"ZONE","label":"Time Zone","isEditable":false,"tooltip":"","visible":false,"format":{"places":2,"digitSeparator":true},"stringFieldOption":"textbox"},{"fieldName":"SQ_MI","label":"SQ_MI","isEditable":false,"tooltip":"","visible":false,"format":{"places":2,"digitSeparator":true},"stringFieldOption":"textbox"},{"fieldName":"SQKM","label":"SQKM","isEditable":false,"tooltip":"","visible":false,"format":{"places":2,"digitSeparator":true},"stringFieldOption":"textbox"},{"fieldName":"COLORMAP","label":"COLORMAP","isEditable":false,"tooltip":"","visible":false,"format":{"places":2,"digitSeparator":true},"stringFieldOption":"textbox"}],"description":null,"showAttachments":true,"mediaInfos":[]}}],"baseMap":{"baseMapLayers":[{"id":"World_Light_Gray_Base_7739","opacity":1,"visibility":true,"url":"http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"},{"id":"World_Light_Gray_Reference_241","isReference":true,"opacity":1,"visibility":true,"url":"http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer"}],"title":"Light Gray Canvas"},"version":"1.6"}"""
result = mapping.ConvertWebMapToMapDocument(text)
mxd = result.mapDocument
mxd.saveACopy(r"c:\temp\sometokentest.mxd")
from arcrest.
Great advice. In the end, I added OAuthSecurityHandler(client_id=,secret_id=) to the begining of the script and the credential popup stopped appearing. Not 100% this was what fixed it, but I'm not touching it while its working!
from arcrest.
Related Issues (20)
- createReplica does not work for feature services inside folder HOT 1
- arcrest.ags.server._validateurl() Mangles Compound Web Context Names HOT 5
- Migrating from AGOL to Server HOT 3
- Append with a new Schema and Attachments
- Does this work with Arcgis Online Enterprise accounts? HOT 5
- Can disable sync be used to enable sync? HOT 1
- Attribute error 'module' object has no attribute 'create_default_context HOT 2
- Intermittent HTTP 403 issues using DeleteFeaturesFromFeatureLayer HOT 3
- ArcRest was working then quit--no changes to script HOT 18
- createReplica will not return records for a table HOT 18
- Looking for additional information
- Misspelling for geometry filter? HOT 2
- ArcRest "arcrest.agol.services.FeatureService.createReplica" tool failing HOT 1
- .addFeatures doesn't copy over all features
- Sample script for metadata import
- ArcRest "arcrest.agol.services.FeatureService.createReplica" works on one ArcGIS Online organization but not another HOT 10
- BUG
- create_replica_portal_item.py - Download permissions HOT 1
- usercontent error: HOT 14
- Importing webmap HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arcrest.