|
POST
|
Unfortunately I do not have VS, I'm not likely to get a copy and I've never used it. Maybe I don't need your modified ashx code. In the file I see these lines: public string GetToken(string uri)
{
foreach (ServerUrl su in serverUrls)
{
if (su.MatchAll && uri.StartsWith(su.Url, StringComparison.InvariantCultureIgnoreCase) && su.DynamicToken)
{
// Code to dynamically get the token
string tokenService = string.Format("https://{0}/ArcGIS/tokens?request=getToken&username={1}&password={2}&expiration=30", su.Host, su.UserName, su.Password);
string token; I interpret this to mean that 0, 1, 2 are parameters that are read from the proxy.config file. I want to be able to let the user enter their user name and password in a form, defining the variables dynamically, in this example usr and pwd. esri.request({
url: "https://myserver.mo.gov/ArcGIS/tokens",
content: {
request: "getToken",
username: usr,
password: pwd
},
handleAs: "text",
load: tokenObtained,
error: tokenRequestFailed
}); Do I not really need your modified proxy.ashx since that seems to be looking to proxy.config for these same parameters? I didn't feel like the original proxy.ashx from the Resource Center was quite what I needed either.
... View more
11-02-2012
01:24 PM
|
0
|
0
|
1265
|
|
POST
|
I don't know if posting to a thread that's over a year old will help, but I hate to start another one. There are a ton of threads already on security, generating tokens and what you may or may not have to do to your proxy.config and proxy.ashx. The first application I needed a proxy configuration for was because I was creating a buffer. I needed the request to be POST and so the examples from the Resource Center worked just fine once I added my server names to the proxy.config file. I'm using the ASP.NET version. Now I need to dynamically generate a token based on a user name/password. I'm using a sample I found under Concepts. ArcGIS Server Services > working with secure resources. Under the section for working with tokens, there is a link to Security Sample. Since the server I'm testing with is still at 9.3, it sounds like I need to be using esri.request. (Apparently Identity Manager would help me, but that is only support at 10.0). From the page I found this one, it's only viewable, I don't see how to download it. It's not on the samples page and doesn't come up if you do a search on Security. I was able to view the code through Firebug, but I'm lost on how the proxy is set up for it. I have tried both the original proxy.ashx file 'as-is' from the sample provided from "Using the proxy page" and a version that seems to be working for some that was posted on the forums under the thread "Token Security on an ArcGIS Server (Javascript)" as the file proxyDynamic.zip. Neither are working for me. I assume the solution to having your tokens truly dynamic lies in the ability to make a secure request back to your server hosting the services as opposed to trying to somehow store it in another external file, like web.config, that must be periodically edits with a new token. I tried the original proxy.ashx and variation for dynamic tokens posted on the forums. Both generate an error "malformed URI sequence". There are over 1000 views on the main threads related to this, but very few answers. Please, ESRI, review your pages on the configuration and use of secure services. I can't be the only person who is getting lost on this.
... View more
11-02-2012
09:23 AM
|
0
|
0
|
1265
|
|
POST
|
As I read further, I saw something that said dojo.forEach was something optimized for HTML5. Could that be my problem, that IE 8 doesn't fully support it?
... View more
10-25-2012
10:37 AM
|
0
|
0
|
807
|
|
POST
|
I am working through the Find Nearby Location example, changing it for my services and also allowing the user to enter an address if they don't have geoLocation enabled. This works fine in Firefox. The user enters their address, then chooses which feature they want to find near that address. If I try this in IE, adding a breakpoint in the featureLayer.selctFeatures function, I can add a watch on features and see there are several items in that array. featureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW, function(features){
var itemList = dijit.byId('searchResults');
//Remove any existing items from the result window
while (itemList.domNode.hasChildNodes()) {
itemList.domNode.removeChild(itemList.domNode.lastChild);
}
//If no results are found users should increase search distance
if(features.length === 0){
var noResults = new dojox.mobile.ListItem({
label: "No Results"
});
//breakpoint inserted here
noResults.set("class", "mblVariableHeight");
noResults.domNode.innerHTML = "No results found within search radius. Use the settings option to increase the search distance.";
itemList.addChild(noResults);
return;
} It gets past (features.length === 0) and moves to the dojo.forEach loop which comes immediately after : dojo.forEach(features, function (feature) {
feature.distance = Math.round((esri.geometry.getLength(feature.geometry, currentGraphic.geometry) / 1609.344) * 100) / 100;
}); Here it fails. When I look at the watch on features, once I'm in the line dojo.forEach , instead of having content, suddenly it is an empty array. At first I thought it was having trouble with the calculation of the distance, but it doesn't seem to even be entering this loop since it doesn't think there's any features to loop through. This doesn't happen in Firefox, only in IE (testing on IE 8).
... View more
10-25-2012
07:47 AM
|
0
|
7
|
1206
|
|
POST
|
The locator services are not interchangeable. Each service has different inputs and outputs and you need to look at each service to see what input each locator is expecting. the TA_Address_NA Geocoder Server doesn't accept a singleLine input like you've specified. It expects separate input for address, city, state, zip. If you want to use a single line input, I suggest you use the World Locator geocoder server, http://tasks.arcgis.com/ArcGIS/rest/services/WorldLocator/GeocodeServer
... View more
10-23-2012
01:44 PM
|
0
|
0
|
1273
|
|
POST
|
If I'm trying to modify the code for my own and it's already generating errors, then how am I supposed to keep track of which errors were there in the first place and which ones are my coding errors?
... View more
10-23-2012
11:35 AM
|
0
|
0
|
983
|
|
POST
|
No, I don't think I'm necessarily trying to use some new functionality, but everything I read encourages users to use the "latest and greatest". I am concerned that the original sample code used as-is generates the same errors. Doing an Internet search, I don't see hardly any references to the 3.2 compact build. Just the ESRI references and this thread. Using Aptana Studio 2 and Firefox/Firebug, I'm getting these errors in the console using the original code from the Find Nearby Locations example "NetworkError: 404 Not Found - http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dojox/mobile/themes/buttons.css" and then because it can't find this css: "NetworkError: 404 Not Found - http://127.0.0.1:8000/mobile_findNearby_ESRIsample/mblCheckOnButton" mblCheckOnButton "NetworkError: 404 Not Found - http://127.0.0.1:8000/mobile_findNearby_ESRIsample/mblCheckOffButton" Following by: NetworkError: 404 Not Found - http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dojox/mobile/themes/buttons-compat.css" Is there some setting I need to make in Aptana or my browser? Generally the ESRI sample work (until I start to modify them!)
... View more
10-23-2012
10:28 AM
|
0
|
0
|
983
|
|
POST
|
I added the dojo.require for dojox.mobile.Button, which I didn't have before. I'm getting a file not found for http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dojox/mobile/themes/buttons.css. I get this same error when using the original code from the resource center. I can't help but think there is something wrong with this css and not something in my code.
... View more
10-22-2012
08:25 AM
|
0
|
0
|
983
|
|
POST
|
I am working through the Find Nearby example that uses the Yahoo search and geolocation, but with my own map service. I have an example someone shared with me, written at version 2.4. I thought I could just update the version numbers in the my code, but any version over 2.7 generates an error that seems to be coming from dojox.mobile.parser. It seem like I ought to be able to change my older code to have references to the higher API version. This works:
<!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" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>
Find Nearby WIC Locations
</title>
<link type="text/css" rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.7/js/dojo/dojox/mobile/themes/iPhone/iPhone.css" />
<link type="text/css" rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.7/js/dojo/dojox/mobile/themes/buttons.css" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
<style type="text/css">
html, body
{
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
}
</style>
<script type="text/javascript">
var djConfig = {
parseOnLoad: true
};
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.7compact"></script>
Changing the references to 3.2 and added the newer esri.css references gives an error: _a is undefined at parse(Object, Object, Array) (http://serverapi.arcgisonline.com/jsapi/arcgis/3.2compact/js/dojo/dojox/mobile/parser.js:2)
<!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" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>
Find Nearby WIC Locations
</title>
<link type="text/css" rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dojox/mobile/themes/iPhone/iPhone.css" />
<link type="text/css" rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dojox/mobile/themes/buttons.css" />
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/css/esri.css" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
<style type="text/css">
html, body
{
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
}
</style>
<script type="text/javascript">
var djConfig = {
parseOnLoad: true
};
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2compact"></script>
... View more
10-19-2012
10:42 AM
|
0
|
7
|
1227
|
|
POST
|
To answer my own question!: I was mixing up a query based on geometry with a query based on a logical expression and had a bit of both in my code. In my code I needed to take out the query.where lines switch(queryVal){ case 'offSat': featureLayer = offSatFeatureLayer; break; case 'vendor': featureLayer = venFeatureLayer; break; } Then I changed my geometry service buffer to use the extent of the returned geometry (the buffer) instead of the buffer polygon. When examinig the geometries object that was returned, it said it was "rings" and not "polygon". Maybe these are the same thing, but I did notice the acceptable geometry for query was Point, Polygon, Line, Multipoint and Extent. Rings was listed, but maybe I could have created a polygon from the rings? Since I'm just trying to locate the nearest features to a piont and I didn't need absolute accuracy, using the extents was enough. var bufferGeometry = geometries[0]; var geometryExtent = bufferGeometry.getExtent(); query.geometry = geometryExtent;
... View more
10-18-2012
12:43 PM
|
0
|
0
|
448
|
|
POST
|
I am trying to create a version of "Find Nearby Locations" originally written to search using Yahoo. I need to use my own service instead. I think I have my proxy set up correctly because I can review the console when I'm debugging and in Firebug I can see that I have a POST with a status of OK. I have query function that takes the current geoLocation, runs it through a geometryService to buffer the point and run a featureLayer.selectFeatures. The featureLayer isn't selecting anything. I"m getting an error "illegal XML character" and I don't know if that's from the proxy or the buffer, which is supposed to be defining my input geometry to the selectFeatures. My map spatial reference and the spatial reference of the features I'm trying to select are not the same. Right now my callback function doesn't do anything, I'm still trying to determine if anything is selected before I go any farther. function queryFeatures(queryVal, distance){ console.log("in queryFeatures"); createProgress('searchResults'); //var dist = dijit.byId("distVal").srcNodeRef.children[0].children[1].textContent.split(" "); var params = new esri.tasks.BufferParameters(); params.geometries = [ currentGraphic.geometry ]; //buffer in linear units such as meters, km, miles etc. if(distance){ params.distances = distance; } else{ params.distances = [ currentBufferDist ]; } params.unit = esri.tasks.GeometryService.UNIT_STATUTE_MILE; params.outSpatialReference = map.spatialReference; geomService.buffer(params, function(geometries){ query.geometry = geometries[0]; query.outSpatialReference = map.spatialReference; switch(queryVal){ case 'offSat': query.where = "1=1"; featureLayer = offSatFeatureLayer; break; case 'vendor': query.where = "1=1"; featureLayer = venFeatureLayer; break; } featureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW, function(features){ console.log("inselectFeatures function I just added"); } ,function(error){ alert(error.message); }); }, function(error){ alert(error.message); }); }
... View more
10-17-2012
12:16 PM
|
0
|
1
|
896
|
|
POST
|
That was it! I searched around the forums, but "maps gone off" as a subject didn't catch my eye as the same problem.
... View more
10-10-2012
07:03 AM
|
0
|
0
|
668
|
|
POST
|
[ATTACH=CONFIG]18330[/ATTACH]I am using the ESRI base map World_Light_Gray_Base. Sometime during the past few days, suddenly this layer started to have missing and scrambled tiles to it. My map is centered on Missouri, but on the basemap, the north part of the state is now where Arkansas should be and Oklahoma is where Kansas should be! I can't think of anything I could do to my code to make this happen. I'm not seeing anything in the other forums that indicates there is something wrong with the ESRI basemaps and they preview just fine online and in my other applications. When I try switching to the ESRI_StreetMap_World_2D instead, no basemap at all shows. I am using a spatial reference of 102100, map extent -10723197,4186914,-9829190,4992866, which is the same extent I've been using for a while. I'm using the gray canvas successfully in another map. Has anyone else ever experienced anything like this that could point in some direction on how to fix this?
... View more
10-10-2012
06:08 AM
|
0
|
3
|
1283
|
|
POST
|
Do you have any thoughts on the error I'm getting in location.pathname.replace? It seems like I would be better of with this type of syntax instead of changing it to be more "hard coded".
... View more
10-09-2012
09:20 AM
|
0
|
0
|
1562
|
|
POST
|
I can't believe I got it work! This method executes much faster than the forum example, so I'm glad I switched. Here's the function that creates the cluster layer. I have an init function that calls it, and that is where infoTemplate is defined. function runQuery(){ // layer 1 in the service contains all server locations and will be used to cluster var queryTask = new esri.tasks.QueryTask("http://<myserver>/ArcGIS/rest/services/ITSD/serverLocations/MapServer/1"); var query = new esri.tasks.Query(); query.returnGeometry = true; query.where = '1=1'; query.outFields = ["*"]; dojo.connect(queryTask, "onComplete", function(featureSet){ var inputInfo = {}; inputInfo.data = dojo.map(featureSet.features, function(feature){ var pointX = feature.geometry.x; var pointY = feature.geometry.y; var att = feature.attributes; return { "x": pointX, "y": pointY, "attributes": att }; }); // cluster layer that uses OpenLayers style clustering clusterLayer = new extras.ClusterLayer({ "data": inputInfo.data, "distance": 100, "id": "clusters", "labelColor": "#fff", "labelOffset": 10, "resolution": map.extent.getWidth() / map.width, "singleColor": "#888", "singleTemplate": infoTemplate }); var defaultSym = new esri.symbol.SimpleMarkerSymbol().setSize(4); var renderer = new esri.renderer.ClassBreaksRenderer(defaultSym, "clusterCount"); var blue = new esri.symbol.PictureMarkerSymbol("http://static.arcgis.com/images/Symbols/Shapes/BluePin1LargeB.png", 32, 32).setOffset(0, 15); var green = new esri.symbol.PictureMarkerSymbol("http://static.arcgis.com/images/Symbols/Shapes/GreenPin1LargeB.png", 64, 64).setOffset(0, 15); var red = new esri.symbol.PictureMarkerSymbol("http://static.arcgis.com/images/Symbols/Shapes/RedPin1LargeB.png", 72, 72).setOffset(0, 15); renderer.addBreak(0, 2, blue); renderer.addBreak(2, 200, green); renderer.addBreak(200, 1001, red); clusterLayer.setRenderer(renderer); map.addLayer(clusterLayer); // close the info window when the map is clicked // dojo.connect(map, "onClick", cleanUp); // close the info window when esc is pressed dojo.connect(map, "onKeyDown", function(e){ if (e.keyCode == 27) { cleanUp(); } }); dojo.connect(queryTask, "onError", function(err){ alert(err.details); }); }); queryTask.execute(query); }
... View more
10-09-2012
08:43 AM
|
1
|
1
|
2788
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-02-2017 02:38 PM | |
| 2 | 03-18-2022 10:14 AM | |
| 2 | 02-18-2016 06:28 AM | |
| 1 | 03-18-2024 07:29 AM | |
| 4 | 08-02-2023 06:08 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-25-2025
01:56 PM
|