|
POST
|
Simple scenario: I have a dynamic map service (operationalLayer) that I'd like to display on an ArcGIS basemap with the initial extent defined. The operationalLayer is secured and is on my server. When I add the layers using the code below, the operationalLayer does not become visible until a map event - like a pan or zoom. I've tried numerous permutations or this code bit still can not get the operationalLayer to be visible by default. How can I get the operationalLayer to display?
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2"></script>
<script type="text/javascript">
dojo.require("esri.map");
function init() {
var initExtent = new esri.geometry.Extent({"xmin":-12939189,"ymin":4198361,"xmax":-12713834,"ymax":4302895,"spatialReference":{"wkid":3421}});
var map = new esri.Map("map");
//var map = new esri.Map("map",{extent:initExtent}); // DOES NOT WORK, extent is correct for base map
// but the operationalLayer is not in the correct geography
//map.setExtent(initExtent); // This works BUT the
// operationalLayer doesn't display until a map event
// (e.g., pan or zoom)
var basemap = new ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer");
map.addLayer(basemap);
//map.setExtent(initExtent); // This works BUT the
// operationalLayer doesn't display until a map event
// (e.g., pan or zoom)
var operationalLayer = new ArcGISDynamicMapServiceLayer("http://MyServer/ArcGIS/rest/services/MyMapService/MapServer?token=someBigHugeGinormousRandomString");
map.addLayer(operationalLayer);
map.setExtent(initExtent); // This works BUT the
// operationalLayer doesn't display until a map event
// (e.g., pan or zoom)
}
dojo.addOnLoad(init);
</script>
What's really troublesome is that the code below (same scenario but without the secured map service) works. <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2"></script>
<script type="text/javascript">
dojo.require("esri.map");
function init() {
//configure map zoom rectangle fill by setting style by calling esri.symbol.SimpleFillSymbol.toJson()
var initExtent = new esri.geometry.Extent({"xmin":-13814922,"ymin":0,"xmax":6222585,"ymax":5351408,"spatialReference":{"wkid":102100}});
var map = new esri.Map("map",{extent:initExtent});
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer");
map.addLayer(basemap);
var operationalLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer");
map.addLayer(operationalLayer);
}
dojo.addOnLoad(init);
</script>
... View more
12-10-2012
10:21 AM
|
0
|
1
|
4376
|
|
POST
|
I'm writing a mobile web application. The requirements are: A login screen (view) where username and password are entered. Therefore the IdentityManager singleton is not a valid option. Username and password are used to create a credential for *everything* in the application. Not just ArcGIS services, but also other services that use the same user store. These services use the token generated by the AGS token server. Dojo, jQuery and ArcGIS JavaScript API need to be hosted remotely. i.e., making use of content delivery network (CDN). The token server is, of course, secured: i.e., https://www.MyServer.com/ArcGIS/tokens/ The mobile application is not secured by SSL, i.e., http://www.MyServer.com/MyApplication/login.html and http://www.MyServer.com/MyApplication/MapApp.html (no https). Exposing the token to the Internet is not an issue. In other words, http://www.MyServer.com/MyApplication/MapApp.html?token=HugeBigHonkingLongTokenStringblahblahblah is perfectly acceptable. The map application uses both local token-secured local GIS services and public Esri services. The SOM is on the same hardware as the web server (IIS). ArcGIS Server release is 10.0. No upgrade to 10.1 in the immediate future. I'm really struggling with getting the token string. Under this scenarion, I'm using jQuery to get the token. I'm not familiar enough with Dojo to POST (yet). $.post( url, { request: request, clientid: clientid, expiration: expiration, username: userName, password : password }, function(data) { tokenSuccess(data);} ); //(clientid is "requestip"_. I am having issues with CORS: XMLHttpRequest cannot load https://www.MyServer.com/ArcGIS/tokens/. Origin http://www.MyServer.com is not allowed by Access-Control-Allow-Origin. In my web.config I have Access-Control-Allow-Origin wide open ("*") for now, I'll eventually ratchet it down to just the CDN providers. If there is an easier was to get the token string based on this scenario, I'm all ears. Am I going to have to set up a proxy? Or can I just use CORS? Is IdentityManageBase an option? TIA
... View more
11-06-2012
08:32 AM
|
0
|
0
|
990
|
|
POST
|
The offending code (startGrfx is of type com.esri.ags.Graphic): var ba0:ByteArray = new ByteArray(); ba0.writeObject(startGrfx); ba0.position = 0; var endGrfx:Graphic = ba0.readObject(); The resulting graphics transform is shown in the attached jpg (symbology is not preserved as well).[ATTACH=CONFIG]17382[/ATTACH] Some exceptions traced to the console that I haven't carved into yet: TypeError: Error #1034: Type Coercion failed: cannot convert Object@e42c2b1 to com.esri.ags.symbols.Symbol. TypeError: Error #1034: Type Coercion failed: cannot convert Object@e42e731 to mx.managers.IFocusManager. TypeError: Error #1034: Type Coercion failed: cannot convert Object@e4f0569 to flash.display.DisplayObjectContainer. TypeError: Error #1034: Type Coercion failed: cannot convert Object@e4f0569 to mx.styles.IAdvancedStyleClient. TypeError: Error #1034: Type Coercion failed: cannot convert Object@e4f0761 to flash.geom.Transform. TypeError: Error #2007: Parameter child must be non-null. TypeError: Error #1034: Type Coercion failed: cannot convert Object@e5b81a9 to flash.media.SoundTransform. TypeError: Error #1034: Type Coercion failed: cannot convert Object@e4f0761 to flash.geom.Transform. TIA
... View more
08-30-2012
09:56 AM
|
0
|
0
|
803
|
|
POST
|
Are you able to generate a token from the HTML form at: https://gis.blahblahblah.com/ArcGIS/tokens/ Sorry, same error.
... View more
08-20-2012
12:55 PM
|
0
|
0
|
343
|
|
POST
|
Try setting the tokenServiceURL to: https://gis.blahblahblah.com/ArcGIS/tokens/generateToken No, sorry. The returned content: 405 - HTTP verb used to access this page is not allowed. The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
... View more
08-20-2012
11:50 AM
|
0
|
0
|
1359
|
|
POST
|
What was the request for this response? If the response code is 200, then this response should not be generating a "Error #2032: Stream Error". Oops, my mistake. The Unauthorized access error was from trying to load the map. The POST result trying to get the Credential is: 405 (Method Not Allowed)
... View more
08-17-2012
03:48 PM
|
0
|
0
|
1359
|
|
POST
|
Can you use HttpFox to see what the requests and responses are? It's an AIR application, but I ran Fiddler (should have thought of that in the first place!). The returned message in plain text is: {"error":{"code":499,"message":"Unauthorized access","details":[]}} This is weird, because those are the same credentials I use getting the token using an HTTPService (mx.rpc.http.HTTPService.HTTPService). Could it be my firewall? I will test again from outside the firewall later...
... View more
08-17-2012
12:18 PM
|
0
|
0
|
1359
|
|
POST
|
Try setting the tokenServiceURL to the same as what you see on your server at /arcgis/rest/info That does not work. It returns the mx.RPC.Fault message of: faultCode:null faultString:'Error #2032: Stream Error. URL: https://gis.blahblahblah.com/ArcGIS/tokens' faultDetail:'null' I'm on AGS 10.03 if that's any help.
... View more
08-17-2012
10:49 AM
|
0
|
0
|
1359
|
|
POST
|
The code below is in a Flex mobile app. It debugs fine in desktop emulation, on an iPhone4 and on a Droid (Android 2.2) -- i.e., it get the token without fail. The Flex API is 3.0 and the AGS build (i.e., token server) is 10.03 On a Droid RAZR MAXX (supported by Flex) with Android 4.04, the returned Fault event does not have a message that contains anything meaningful - like a 403 error. The status code is 0 - just a generic IOErrorEvent (See screen grab) TIA [ATTACH=CONFIG]17051[/ATTACH] private function RequestToken(username:String, password:String, tokenServiceURL:String):void { var http:HTTPService = new HTTPService(); http.addEventListener( ResultEvent.RESULT, tokenResultHandler ); http.addEventListener( FaultEvent.FAULT, faultHandler ); var param:Object = { "request" : "gettoken", "username": username, "password": password, "clientid" : "requestip", "expiration" : 3600 }; http.url = tokenServiceURL; http.method = "POST"; http.resultFormat = "text"; http.request = param; http.send(); } private function tokenResultHandler(event:ResultEvent):void { var restToken:String = StringUtil.trim(event.result.toString()); navigator.pushView(AnotherView, restToken, null, null); } private function faultHandler(event:FaultEvent):void { trace("FAIL!!!!!!"); trace(" Your RAZR MAXX does not compute."); }
... View more
08-17-2012
10:24 AM
|
0
|
0
|
926
|
|
POST
|
The code below fails with the error message. How do I get the credential based on my token service URL?: TIA faultCode:null faultString:'Error #2032: Stream Error. URL:https://gis.blahblahblah.com/arcgis/tokens?tokens' faultDetail:'null' var serverInfo:ServerInfo = new ServerInfo(); serverInfo.tokenServiceURL="https://gis.blahblahblah.com/arcgis/tokens?tokens"; IdentityManager.instance.generateCredential(serverInfo, myStupidUserName, myStupidPassword, new AsyncResponder(credentialResponse, credentialFault));
... View more
08-14-2012
03:32 PM
|
0
|
11
|
2266
|
|
POST
|
I am using a token handed to me by the AGS token service to connect to secured AGS services. The token will time out in one hour. When the token times out, I want the user to be redirected to a login page. Without this redirect, the user would otherwise just get a blank map because the AGS map services don't return a valid map. There does not a property of the map service that tells me that the token has timed out. The token, being a string, is meaningless, other that it is used as a property of the map service (e.g., appended to the map service URL). So the question, how can I tell if the token is timed out? I have enough events that I can routinely troll for a timed-out token - that is if the computational expense is not too great. --TIA
... View more
08-10-2012
08:15 AM
|
0
|
1
|
642
|
|
POST
|
Is it possible to change the caption of an AddIn button in code? The button and it's containing toolbar are declared in the XML:
<AddIn language="CLR" library="DeleteThisArcMapAddinProject.dll" namespace="DeleteThisArcMapAddinProject">
<ArcMap>
<Commands>
<Button id="DeleteThisArcMapAddinProject_Button1" class="Button1" message="Yada yada." caption="My Button" tip="tooltip." category="Add-In Controls" />
</Commands>
<Extensions>
</Extensions>
<Toolbars>
<Toolbar id="DeleteThisArcMapAddinProject_My_Toolbar" caption="My Toolbar" showInitially="true">
<Items>
<Button refID="DeleteThisArcMapAddinProject_Button1" />
</Items>
</Toolbar>
</Toolbars>
</ArcMap>
</AddIn>
As a dumb example, I want to change the cation of the button in response to the OnClick event of the button. BITD I could do it in COM ArcObjects by creating an instance of an ICommandItem. Here's a failed try:
Protected Overrides Sub OnClick()
Dim uid As UID = New UIDClass()
uid.Value = "DeleteThisArcMapAddinProject_Button1"
Dim mx As MxDocument = DirectCast(My.ArcMap.Application.Document, MxDocument)
Dim cmdBars As ICommandBars = mx.CommandBars
Dim button As ICommandItem = cmdBars.Find(uid, False, False)
System.Windows.Forms.MessageBox.Show(button.Caption)
button.Caption = "My New Caption"
My.ArcMap.Application.CurrentTool = Nothing
End Sub
What's funny (sic) about this is that the button.Caption value is "My New Caption" for subsequent OnClick events, even though the caption in the UI stays "My Button". Can I change the caption in code? Or does the new declarative framework not allow me to do this? TIA
... View more
10-04-2011
10:30 AM
|
0
|
3
|
3723
|
|
POST
|
C#, 9.3.1, ArcMap extension. I am interesting in gathering information from mouse events in the PageLayout_NewLine and PageLayout_NewPolygon tools on the Draw toolbar. I can get the active tool - no problem. I want to track what the tool is doing - OnMouseMove, OnMouseDown, etc. There are polyline and polygon graphic elements being constructed and I need to track in my ArcMap extension what the user is doing to draw their graphics while the graphic elements are being constructed. TIA
... View more
07-18-2011
07:46 AM
|
0
|
0
|
1010
|
|
POST
|
The title says it all. All I'm asking for is an entry into this problem. I want to add some custom commands I have written to a context menu that already exists (the one that defaults when you right-click the active data view actually). I imagine I can get the context menu using a GUID or name, and I'm pretty sure that there are methods that allow me add a command using its GUID or name to the context menu. But I can't seem to get past the concept to start seeing the design and code :mad: TIA
... View more
05-05-2011
01:49 PM
|
0
|
1
|
1754
|
|
POST
|
I'm starting with an Oracle Spatial table with a very limited envelope that I want to register as an SDE feature class and load data into in ArcCatalog and/or ArcObjects. I use the command: sdelayer â??o register â??l TRANSFORMER,GEOMETRY -E -5120899,-9998099,498850536,493973336 â??e p -t ST_GEOMETRY â??C OBJECTID â??u bzt â??p bzt However when I describe the table it shows the envelop to be the extent of the existing features - so I can't load data into it using ArcObjects. The describe shows: Layer Envelope .......: minx: 1326469.26245, miny: 12237462.09247 maxx: 1326472.42232, maxy: 12237533.33104 Obviously not the results I need. How can I force the new envelop to be what I need? Can I do it in SDE or ArcCatalog, or do I need to edit some of the tables in Oracle? TIA
... View more
09-10-2010
12:59 PM
|
0
|
1
|
495
|
| Title | Kudos | Posted |
|---|---|---|
| 5 | 11-10-2021 12:27 PM | |
| 1 | 10-02-2019 10:47 AM | |
| 1 | 09-24-2021 08:40 AM | |
| 1 | 09-28-2018 10:16 PM | |
| 1 | 10-09-2015 08:26 PM |
| Online Status |
Offline
|
| Date Last Visited |
05-05-2023
03:51 AM
|