|
POST
|
Has anyone had troubles solving a route on a routeTask between 2 points in IE where it worked fine in Firefox? I decided I needed a proxy set up because of the # of characters in my request meant I had exceeded the # or characters allowed. Then I thought my proxy set up itself was the problem and I didn't have it set up quite right. Now I am seeing my traffic going through the proxy, I'm still having no luck solving my route. I have defined my route parameters with two stops. They are in the same map projection. They are not the same point (It occurred to me to check!) My routeParams are defined as: routeParams = new esri.tasks.RouteParameters(); routeParams.stops = new esri.tasks.FeatureSet(); routeParams.returnRoutes = true; routeParams.returnDirections = true; routeParams.directionsLengthUnits = esri.Units.MILES; routeParams.outSpatialReference = map.spatialReference; My routeTask is defined as routeTask = new esri.tasks.RouteTask("http://servicesbeta.esri.com/ArcGIS/rest/services/Network/USA/NAServer/Route"); My start location is a geocoded point, which I'm changing to webMercator. My end location is a feature returned earlier from a featureLayer.selectFeatures. routeParams.stops.features = []; //Add the starting location to the map var fromSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([105, 153, 0])); var startLoc = new esri.Graphic(esri.geometry.geographicToWebMercator(new esri.geometry.Point(currentLocation, new esri.SpatialReference({ wkid : 4326 }))), fromSymbol, { Name : dojo.byId('loc').textContent, source: pointSource, RouteName : feature.attributes.FACILITY }); resultLocationsLayer.add(startLoc); routeParams.stops.features.push(startLoc); // params.stops.features[0] = startLoc; //Add the ending location to the map var toSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([204, 0, 0])); var endLoc = new esri.Graphic(feature.geometry, toSymbol, { Name : feature.attributes.FACILITY, source: "selected by buffer", RouteName : feature.attributes.FACILITY }); resultLocationsLayer.add(endLoc); routeParams.stops.features.push(endLoc); I can put a breakpoint in and see I have two stops defined as features. I thought maybe my function was trying to execute before the route was solved. So I changed to to listen for the event onSolveComplete. routeTask.solve(routeParams); // routeTask.solve(params, function(solveResult) { dojo.connect (routeTask, "onSolveComplete", showRoute); dojo.connect (routeTask, "onError", routeError); This works just fine in Firefox. I get a map with two points and a highlighted line showing the route. In IE, it doesn't seem to properly solve my routeTask and just generates the error I set up for the onError event. My complete code attached. I would think I have points in 2 different coordinate systems are something, except for the fact it works just fine in Firefox.
... View more
11-20-2012
12:16 PM
|
0
|
7
|
1876
|
|
POST
|
What happens if you put quotes around z in the onClick?
... View more
11-20-2012
09:45 AM
|
0
|
0
|
621
|
|
POST
|
I would think you would take an performance hit for that and somewhere else I read that you shouldn't set that to true except when you are using the proxy for security reasons. I'm not. I need it because I'm using a geometryService and a routeTask and both routinely exceed the max # of characters. I already tried adding that line BTW and it didn't make any difference.
... View more
11-20-2012
09:41 AM
|
0
|
0
|
1879
|
|
POST
|
I have followed the instructions on how to set up proxy pages and I'm running out of ideas of why my application is completely ignoring my proxy set up. I downloaded the configuration files using the ASP.NET option. I created a folder on my server under inetpub/wwwroot and called it proxy and put proxy.config and proxy.ashx in it. I edited proxy.config file to contain the paths to my local services as well as the ESRI online services (I am generating a buffer as well as trying to build routes with a route task). I went into IIS Manager and create an application from this directory. I modified my code to have the path in my code: esri.config.defaults.io.proxyUrl = "proxy/proxy.ashx"; I keep my projects in another directory, not wwwroot, but have set a virtual directory to the location of where the files reside. My file opens just fine. When I look at Firebug, on the Net tab to watch the traffic, I never see any POST entries, only GET, so none of my requests are going through the proxy. There are no errors, it's just not using it. When I an defining my proxyUrl, should I be using this type of relative path name? I tried a complete URL to the location of the proxy.ashx, but that didn't help. It seems like if it couldn't find the proxy file, I would at least get an error telling me it couldn't find it???
... View more
11-19-2012
12:41 PM
|
0
|
8
|
2881
|
|
POST
|
I have been using geoLocation as well with mixed result. You are right that a lot of points are getting processed. You have likely hit the threshold of the # of points that can be handled through a standard request. You should look under the Concepts tab > ArcGIS Server Services > Using the proxy page. The #1 reason listed for using a proxy page is "the application creates requests that exceed 2048 characters". I'm also noticing that different browsers have different limitations. So something that debugs fine in Firefox might fail in IE.
... View more
11-19-2012
12:29 PM
|
0
|
0
|
648
|
|
POST
|
The World Locator service http://tasks.arcgis.com/ArcGIS/rest/services/WorldLocator/GeocodeServer returns the north/south/east/west latitude and longitude.
... View more
11-16-2012
12:43 PM
|
0
|
0
|
1361
|
|
POST
|
I am programmtically adding a mobile button and ListItem to a mobile view, following the example in the find Nearby sample. This works fine in Firefox. When I try it in IE 8, it doesn't. I am using the components dojox.mobile.Button and dojox.mobile.ListItem. I'm wondering if I don't have everything I need in my dojo.require statements or if not calling the mobile parser correctly? It also seemed like I have to add a dojo.require statement for the mobile button, but that maybe it was or wasn't needed depending on what version of the compact build I was using? dojo.require("dojox.mobile.Button"); My compact build version is 3.2 <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2compact"></script> Are there just too many things about the dojox.mobile components that are going to make it impossible to get my code working in IE8? Here's the section of code that seems to be failing. When debuggin in IE8 and adding break points, I can see listItems getting created and added to the itemList as it steps through the selected features. But at the end, when my search results view is displayed, it is empty! I thought maybe the problem was isolated to just the mobile button, but when I commented out the lines dealing with it, it didn't help.
dojo.connect(featureLayer, "onSelectionComplete", function(features){
itemList = dijit.byId('searchResults'); //changed this to be global 11/9/12
//Remove any existing items from the result window
while (itemList.domNode.hasChildNodes()) {//may want to move this sooner, user can see the old list for a moment
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"
});
noResults.set("class", "mblVariableHeight");
noResults.domNode.innerHTML = "No results found. Try a larger search distance using the settings option.";
itemList.addChild(noResults);
// return;
}
//modifies the returned distance to something more user friendly
dojo.forEach(features, function (feature) {
feature.distance = Math.round((esri.geometry.getLength(feature.geometry, currentGraphic.geometry) / 1609.344) * 100) / 100;
});
//sorts the returned features so closest features are at the top
var sortedFeatures = features.sort(function(a, b){
return a.distance - b.distance;
});
dojo.forEach(sortedFeatures, function (result) {
var resultItem = new dojox.mobile.ListItem({ label: result.attributes.FACILITY });
resultItem.set("class", "mblVariableHeight");
var content = [];
content.push(result.attributes.FACILITY + "<br />" + result.attributes.ADDRESS + "<br />" );
content.push(result.distance + " miles<br/>");
var formatContent = content.join("");
resultItem.domNode.innerHTML = formatContent;
var button = new dojox.mobile.Button({
label: 'Map It',
moveTo: 'mapView'
}).placeAt(resultItem.domNode);
var locationDetails = function (result) {
return function (results) { //(sortedFeatures); ??
mapResults(results, result); //mapResults(sortedFeatures,result);??
};
};
// dojo.connect(button, "onClick", locationDetails(result));
//clearProgress();
itemList.addChild(resultItem);
});
clearProgress();
//
});
... View more
11-15-2012
07:21 AM
|
0
|
0
|
646
|
|
POST
|
Working through a variation of the find nearby mobile example, I am running a selectFeatures and creating a list of the closest sites to an address. The values are first sorted by distance, and the list contains the name of the facility, it's address and the distance from the starting address. Last, there is a button that will show a map with the sites, draw the routes and give the user a chance to get directions. It's the definition of the locationDetails that's giving me fits. It's works fine in Firefox, but in IE8, it never seems to execute the function that supposed to generate the routes etc. The lines I've changed to red are the problem area. I'm relatively new to Javascript and I'm having a hard time grasping the concepts of nested or inner functions. Something I read made me think that IE 8 handled these differently and that maybe I needed to modify my code? My problem is I don't know what to modify it to. All I can see is that it never executes the function mapResults.
dojo.connect(featureLayer, "onSelectionComplete", function(features){
itemList = dijit.byId('searchResults'); //changed this to be global 11/9/12
//Remove any existing items from the result window
while (itemList.domNode.hasChildNodes()) {//may want to move this sooner, user can see the old list for a moment
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"
});
noResults.set("class", "mblVariableHeight");
noResults.domNode.innerHTML = "No results found. Try a larger search distance using the settings option.";
itemList.addChild(noResults);
// return;
}
//modifies the returned distance to something more user friendly
dojo.forEach(features, function (feature) {
feature.distance = Math.round((esri.geometry.getLength(feature.geometry, currentGraphic.geometry) / 1609.344) * 100) / 100;
});
//sorts the returned features so closest features are at the top
var sortedFeatures = features.sort(function(a, b){
return a.distance - b.distance;
});
dojo.forEach(sortedFeatures, function (result) {
var resultItem = new dojox.mobile.ListItem({ label: result.attributes.FACILITY });
resultItem.set("class", "mblVariableHeight");
var content = [];
content.push(result.attributes.FACILITY + "<br />" + result.attributes.ADDRESS + "<br />" );
content.push(result.distance + " miles<br/>");
var formatContent = content.join("");
resultItem.domNode.innerHTML = formatContent;
var button = new dojox.mobile.Button({
label: 'Map It',
moveTo: 'mapView'
}).placeAt(resultItem.domNode);
var locationDetails = function (result) {
return function (results) { //(sortedFeatures); ??
mapResults(results, result); //mapResults(sortedFeatures,result);??
};
};
dojo.connect(button, "onClick", locationDetails(result));
//clearProgress();
itemList.addChild(resultItem);
});
clearProgress();
//
});
Function that is supposed to add functionality to the button
//for routing
function mapResults(results, feature) {
console.log("mapResults function");
//move to the map view to display the route
var widget = dijit.byId('resultsView');
widget.performTransition('mapView', 1, "slide", function () {
map.resize();
resultLocationsLayer.clear();
routeGraphicLayer.clear();
segmentGraphicsLayer.clear();
//Define the route input parameters
params.directionsLengthUnits = esri.Units.MILES;
params.outSpatialReference = map.spatialReference;
params.stops.features = [];
//Add the starting location to the map
var fromSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([105, 153, 0]));
var startLoc;
if (pointSource == "geoLocation") {
startLoc = new esri.Graphic(esri.geometry.geographicToWebMercator(new esri.geometry.Point(currentLocation, new esri.SpatialReference({
wkid: 4326
}))), fromSymbol, {
Name: dojo.byId('loc').textContent,
RouteName: feature.attributes.FACILITY
});
console.log("using geoLocation for start point");
} else {
startLoc = new esri.Graphic((new esri.geometry.Point(currentLocation, new esri.SpatialReference({
wkid: 4326
}))), fromSymbol, {
Name: dojo.byId('loc').textContent,
RouteName: feature.attributes.FACILITY
});
console.log("using address for start point");
}
resultLocationsLayer.add(startLoc);
params.stops.features[0] = startLoc;
//Add the ending location to the map
var toSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([204, 0, 0]));
var endLoc = new esri.Graphic(feature.geometry, toSymbol, {
Name: feature.attributes.FACILITY,
RouteName: feature.attributes.FACILITY
});
resultLocationsLayer.add(endLoc);
params.stops.features[1] = endLoc;
//Get the Route and display it and the directions on the MapView
routeTask.solve(params, function (solveResult) {
var directions = solveResult.routeResults[0].directions;
directionFeatures = directions.features;
var content = [];
content.push("<ol>");
routeGraphicLayer.add(new esri.Graphic(directions.mergedGeometry));
dojo.forEach(directions.features, function (feature, index) {
if (index === 0 || index === directions.features.length - 1) {
content.push("<li>" + feature.attributes.text + "</li>");
} else {
content.push("<li onclick='zoomToSegment(" + index + "); return false;' class=\"segment\"><a href=\"#\">" + feature.attributes.text + "</a></li>");
}
});
content.push("</ol>");
dojo.byId("directions").innerHTML = content.join("");
map.setExtent(directions.extent, true);
}, function (error) {
alert('Sorry, could not create route.');
dojo.byId("directions").innerHTML = "<b>Error:</b> ";
});
});
}
... View more
11-15-2012
06:00 AM
|
0
|
0
|
704
|
|
POST
|
I have had luck using map.extent.expand(0.5) or some other number less than one.
... View more
11-15-2012
04:39 AM
|
0
|
0
|
435
|
|
POST
|
I finally got my debugging to work in IE 8. The geocode functions create a graphic and sets my "currentGraphic" variable so I have a starting point for my selection. If I put a breakpoint or look at the console log in my 'onClick function of the listItem, it doesn't seem to ever by executing. I think I do want dijit.byId, not dojo.byId. dojo.connect(dijit.byId('WICoffSatItem'), 'onClick', function() {
console.log("selected WIC office and satellites");
if (!currentGraphic){
alert("Geolocation not supported on this device. Please enter an address to begin your search");
}else{
queryFeatures('offSat');
console.log("querying offSat");
}
}); My list items have a "moveTo" defined in them, so the transition is happening, but not the onClick event. <li dojoType="dojox.mobile.ListItem" id="WICoffSatItem" moveTo="resultsView" title="Find Nearby WIC offices and satellites."
iconPos="0,0,32,32" rightText="" >
<img src="images/Office.png" alt="office image" style="clip: rect(0px, 32px, 32px, 0px); top: 7px; left: 8px;">
WIC offices and satellite
</li>
<li dojoType="dojox.mobile.ListItem" id="WICvendorItem" moveTo="resultsView" title="Find Nearby Stores that accept WIC."
iconPos="0,42,32,32" rightText="" >
<img src="images/grocery_cart.png" alt="cart image" style="clip: rect(0px, 32px, 32px, 0px); top: 7px; left: 8px;">
Stores that accept WIC coupons
</li>
... View more
11-13-2012
07:48 AM
|
0
|
0
|
933
|
|
POST
|
Reading the API reference for extent, I saw a method expand that said it would expand the map extent by the factor given. Since I didn't see a corresponding method for "contract" I took a chance and put in a number less than 1. In the documentation for IdentifyParameters it states: The values for mapExtent, height, width, and dpi are used to determine the current map scale. Once the scale is known, the map service can exclude layers based on their scale dependency settings. The map service is not performing a spatial intersection based on the provided extent. These properties are also used to calculate the search distance on the map based on the tolerance in screen pixels. I hoped that meant that changing my map extent would also influence this tolerance. In the top of my IdentifyTask function, the line formerly identifyParams.mapExtent = map.extent; became identifyParams.mapExtent = map.extent.expand(0.1); I don't know if this will satisfy all situations, but all my test addresses, which were originally returning multiple features with the identify now just return one! I think it's fixed!
... View more
11-13-2012
06:40 AM
|
0
|
0
|
1636
|
|
POST
|
Just a quick update on this to push this up in the thread list again. I don't know if it is more proper to say this is tied to the map extent or the LODs, but the current scale is definitely a factor. I have tried to modify my code to zoom in first and then do the identify, but that hasn't completely taken care of the problem. Maybe a listener on the extent change that only fires the identify after it zooms in? Maybe also setting the LOD to something close long enough to do the identify and then zoom back out again? Since I am using this to identify the new legislative boundaries, it will have a lot of eyes on it. Right now, if you are zoomed out and enter an address in an urban area (where the districts are smaller) it returns more than one district. That might be acceptable if the point was right on the boundary line, but it is not that close. http://ogi.oa.mo.gov/LEGIS/LegislativeDistrict/district.html Sample address to try: 111 e 11th, kansas city, mo
... View more
11-13-2012
05:43 AM
|
0
|
0
|
1636
|
|
POST
|
And that would cause it to fail in IE 8, but work just fine in Firefox? I'm getting a slightly diferent behavior in Chrome. It finds multiple features when it selects, but only one ends up in the itemList.
... View more
11-09-2012
06:00 AM
|
0
|
0
|
933
|
|
POST
|
It's defined right above it, still within the same function. The entire function was rather long and I was trying to post only the lines I thought I was having problems with:
function queryFeatures(queryVal, distance){
console.log("Finding nearest " + queryVal);
// createProgress('searchResults');
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];
var bufferGeometry = geometries[0];
var geometryExtent = bufferGeometry.getExtent();
query.geometry = geometryExtent;
query.outSpatialReference = map.spatialReference;
switch(queryVal){
case 'offSat':
featureLayer = offSatFeatureLayer;
featureLayer.renderer = offSatRenderer;
featureLayer.infoTemplate = offSatInfoTemplate;
break;
case 'vendor':
featureLayer = venFeatureLayer;
featureLayer.renderer = venRenderer;
featureLayer.infoTemplate = venInfoTemplate;
break;
}
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"
});
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;
}
dojo.forEach(features, function (feature) {
feature.distance = Math.round((esri.geometry.getLength(feature.geometry, currentGraphic.geometry) / 1609.344) * 100) / 100;
});
var sortedFeatures = features.sort(function(a, b){
return a.distance - b.distance;
});
//HERE IS THE PART I POSTED ORIGINALLY
dojo.forEach(sortedFeatures, function (result) {
var resultItem = new dojox.mobile.ListItem({
label: result.attributes.FACILITY
});
resultItem.set("class", "mblVariableHeight");
var content = [];
content.push(result.attributes.FACILITY + "<br />" + result.attributes.ADDRESS + "<br />" );
content.push(result.distance + " miles<br/>");
var formatContent = content.join("");
resultItem.domNode.innerHTML = formatContent;
var button = new dojox.mobile.Button({
label: 'Map It',
moveTo: 'mapView'
}).placeAt(resultItem.domNode);
var locationDetails = function (result) {
return function (results) {
mapResults(results, result);
};
};
dojo.connect(button, "onClick", locationDetails(result));
//clearProgress();
itemList.addChild(resultItem);
});
clearProgress();
//
}
,function(error){
alert(error.message);
});
}, function(error){
alert(error.message);
});
}
... View more
11-09-2012
05:30 AM
|
0
|
0
|
933
|
|
POST
|
Continuing to populate my own thread! Oh well, maybe what I'm working through will help someone else. I was correct in that it is failing in the dojo.forEach loop where it is supposed to be creating items to put in as search results. I can see there are values returned from a featureLayer.selectFeatures. This is within my function that processes the returned features: dojo.forEach(sortedFeatures, function (result) {
var resultItem = new dojox.mobile.ListItem({
label: result.attributes.FACILITY
});
resultItem.set("class", "mblVariableHeight");
var content = [];
content.push(result.attributes.FACILITY + "<br />" + result.attributes.ADDRESS + "<br />" );
content.push(result.distance + " miles<br/>");
var formatContent = content.join("");
resultItem.domNode.innerHTML = formatContent;
var button = new dojox.mobile.Button({
label: 'Map It',
moveTo: 'mapView'
}).placeAt(resultItem.domNode);
var locationDetails = function (result) {
return function (results) {
mapResults(results, result);
};
};
dojo.connect(button, "onClick", locationDetails(result));
//clearProgress();
itemList.addChild(resultItem);
}); Putting a watch on resultItem, I see there is an object created for each feature. It looks like the line itemList.addChild is adding features in itemList. But when it finishes, and slides to the Search Results, testing in IE 8 there is nothing listed. http://wwwgis.dhss.mo.gov/Website/mobileWIC/WIC.html
... View more
11-08-2012
09:11 AM
|
0
|
0
|
933
|
| 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
|