POST
|
Hi, So I have a solution in this posting towards the top. http://forums.arcgis.com/threads/87617-Bypass-user-login-dialog-and-automatically-signing-a-user-account?p=354261#post354261 You need to get the OAuth token first, and then register it with the kernel like this (full solution at URL above): var token = { "server": "http://www.arcgis.com/sharing/rest", "userId": userId, "token": tokenStr, "ssl": false, "expires": expireStr }; kernel.id.registerToken(token); I believe that the register process stores the token as a cookie on the client, similar to how it works when you manually log into ArcGIS.com. After that, you can call the create webmap function. You don't need to pass anything to that function, since you already registered your token. Ian
... View more
12-30-2013
06:13 AM
|
0
|
0
|
1048
|
POST
|
Hi, I am storing a bunch of Twitter posts in a feature class in my geodatabse. The 10.2 geodatabase is stored in PostgreSQL 9.2 (64bit) running on Windows 7. The database encoding is UTF8 and the underlying geometry uses ST_GEOMETRY. I am getting weird behavior with some of my feature classes, which were all created in ArcCatalog. When I try to copy it in ArcCatalog, I get "Network I/O" errors. When I try to do a searchcursor in Python, I get the following error after it iterates through N number of records. SES_ucnv_toWChars().ucnv_toUChars() uErrorCode(15) = U_BUFFER_OVERFLOW_ERROR SES_ucnv_toWChars(): wDstStrCapacity 56 too small, need 59 However, I can see the features in both ArcCatalog and ArcMap without errors. I am inserting records into this feature class using a PostgreSQL function and defining the geometry as ST_Point. Has anybody seen this before? Thank you, Ian
... View more
12-18-2013
12:46 PM
|
0
|
1
|
397
|
POST
|
Can you post your code minus your actual credential info?
... View more
09-28-2013
08:46 PM
|
0
|
0
|
667
|
POST
|
So it looks like this may be a limitation of JS. I would implement it through the URL method. http://forums.arcgis.com/threads/78003-Adding-KML-file-in-map-control-by-JavaScript-API?highlight=kml+file Good Luck!
... View more
09-18-2013
03:17 PM
|
0
|
0
|
1274
|
POST
|
I am not sure about this one. It looks like you are getting a CORS error, basically your web server is not registered/allowed to access services.arcgisonline.com (its a security thing on their end), where I guess they are storing a copy of your KML file. I have run into this error before with esri.request when trying to pull services from this server and basically I used a proxy to get around it (Esri recommends this). However, since your KML is hosted on ArcGIS.com, I don't believe there is a proxy property for a Map object. However there are a couple of workarounds that you may try: #1 - Set up a proxy on your local web server following these: instructions: https://developers.arcgis.com/en/javascript/jshelp/ags_proxy.html Then in your code towards the top, try using this: esri.config.defaults.io.proxyUrl = "http://<INSERT SERVER ADDRESS HERE>/proxy/proxy.ashx"; They may force the communication for the KML file through the proxy. I have no idea if this will work, but may be worth a try. #2 - Load your KML on a web server or I see a lot of people using Dropbox now. Then add your KML to your web map as a URL link and not a local file. #3 - Load your KML into your web map in your JS app. Check out this sample: https://developers.arcgis.com/en/javascript/jssamples/layers_kml.html I hope one of these work for you. You may also want to post that error on the forums as a separate thread.
... View more
09-18-2013
03:07 PM
|
0
|
0
|
1274
|
POST
|
Actually, I see the issue. You need to move this code inside your tokenObtained(response) function. You need to get back the token before you create the web map. In the code you supplied, it sends the request and then gets the webmap before the token is returned. I tested your code and it works if you do that. --------------------------------------- function tokenObtained(response) { blah, blah, blah var token = { "server": "http://www.arcgis.com/sharing/rest", "userId": userId, "token": tokenStr, "ssl": false, "expires": expireStr }; kernel.id.registerToken(token); ..CODE TO LOAD WEBMAP }
... View more
09-18-2013
01:28 PM
|
0
|
0
|
1274
|
POST
|
I'll play around with esri.request code you sent. I am implementing my authentication in .NET, so I wasn't going to use the esri.request method, but it should work and now I am curious about why it is not working. What kind of file are you trying to reference from your web map?
... View more
09-18-2013
12:33 PM
|
0
|
0
|
1274
|
POST
|
Also, how did you set up the application on ArcGIS.com. Did you create it as a "web application" or did you choose mobile, desktop, or application? I set mine up as a Web Application with the "Ready to use" option and the API set to "Javascript".
... View more
09-18-2013
12:27 PM
|
0
|
0
|
4350
|
POST
|
ok, let's eliminate your esri.request code block for right now and just try copying and pasting the token into the following part of the code as a string. do the same for your userId as well. The expires property is a integer and not a string. var token = { "server": "http://www.arcgis.com/sharing/rest", "userId": "USERID", "token": "TOKEN", "ssl": false, "expires": 7200 };
... View more
09-18-2013
12:23 PM
|
0
|
0
|
4350
|
POST
|
What happens if you execute that OAuth2 token URL directly in a browser window? Do you get back the JSON correctly with the token?
... View more
09-18-2013
12:03 PM
|
0
|
0
|
4350
|
POST
|
Hi Scott, I posted the sample HTML/JS on the thread I sent you above. You will need to add in your webmap id, ArcGIS.com userID, and the token that you generate. Make sure that you create a Web Mapping Application on your ArcGIS.com Organization account first. Then you need to get the APPID and APPSECRET that is assigned to that application. From there, you will need to put those two things in the URL below. Then just copy out the returned token string (just the token property) and put it into the code I posted on my thread. Ultimately, you will want to write this REST request into some sort of web-based authentication, but this should get you started. Ian https://www.arcgis.com/sharing/oauth2/token?client_id=APPID&client_secret=APPSECRET&grant_type=client_credentials
... View more
09-18-2013
11:22 AM
|
0
|
0
|
4350
|
POST
|
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10"/> <title>Create web map from JSON</title> <link rel="stylesheet" href="http://js.arcgis.com/3.6/js/dojo/dijit/themes/claro/claro.css"/> <link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css" /> <link rel="stylesheet" href="css/layout.css"/> <script src="http://js.arcgis.com/3.6/"></script> <script> require([ "dojo/parser", "dojo/ready", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/dom", "esri/map", "esri/geometry/Extent", "esri/urlUtils", "esri/arcgis/utils", "esri/dijit/Legend", "esri/dijit/Scalebar", "esri/IdentityManagerBase", "esri/kernel", "dojo/domReady!" ], function ( parser, ready, BorderContainer, ContentPane, dom, Map, Extent, urlUtils, arcgisUtils, Legend, Scalebar, IMB, kernel ) { ready(function () { parser.parse(); var webmapId = "<INSERT WEBMAP ID HERE>"; var userId = "<INSERT USER ID HERE>"; var tokenStr = "<INSERT TOKEN HERE>"; var token = { "server": "http://www.arcgis.com/sharing/rest", "userId": userId, "token": tokenStr, "ssl": false, "expires": 7200 }; kernel.id.registerToken(token); arcgisUtils.createMap(webmapId, "map").then(function (response) { var map = response.map; //By default the extent will be that of the web map. Here we change it //to a custom extent. //add the scalebar var scalebar = new Scalebar({ map: map, scalebarUnit: "english" }); //add the legend. Note that we use the utility method getLegendLayers to get //the layers to display in the legend from the createMap response. var legendLayers = arcgisUtils.getLegendLayers(response); var legendDijit = new Legend({ map: map, layerInfos: legendLayers }, "legend"); legendDijit.startup(); }); }); }); </script> </head> <body class="claro"> <div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%; height:100%;"> <div id="header" class="shadow roundedCorners" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'"> <div id="title"></div> <div id="subtitle"></div> </div> <div id="map" class="roundedCorners shadow" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"></div> <div id="rightPane" class="roundedCorners shadow" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'" > <div id="legend"></div> </div> </div> </body> </html>
... View more
09-18-2013
11:15 AM
|
1
|
0
|
1393
|
POST
|
Scott, check out this post. I think its what you are looking for. http://forums.arcgis.com/threads/90031-Bypass-Identity-Manager-with-ArcGIS.com-OAuth-token-object?highlight=bypass+identity
... View more
09-17-2013
10:50 AM
|
0
|
0
|
4350
|
POST
|
Hi Zach, that did solve the issue with the buttons and other form dijits. Thank you! The TabContainer still does not work with that method, but from what I have read in other forums, this may be a bug in the latest version of Dojo. I will use another layout instead of the TabContainer.
... View more
08-28-2013
12:19 PM
|
0
|
0
|
562
|
Title | Kudos | Posted |
---|---|---|
1 | 08-06-2013 06:20 PM | |
1 | 08-20-2013 08:14 AM | |
1 | 09-18-2013 11:15 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|