|
POST
|
Hey Joe, thanks for your feedback. Touch issues can be tricky. Making a note of this thread so I can come back to it after some research.
... View more
06-18-2014
12:38 PM
|
0
|
0
|
2351
|
|
POST
|
Your if/else is inside your loop that uses evt.addresses as the parameter. Since evt.addresses doesn't have any candidates when there are no results, the loop never fires. evt.addresses.length will always be greater than 1 inside your loop. var h = 0; for( i = 0, i < h, i++){ //code will never get here }
... View more
06-18-2014
12:33 PM
|
0
|
0
|
1944
|
|
POST
|
Can you post more of your specific code? I was able to successfully check for no results using the provided sample and an if statement. See attached screenshot.
... View more
06-18-2014
12:26 PM
|
0
|
0
|
1944
|
|
POST
|
Hello. Have you tried something like:
if(evt.addresses){
//results exist
}else{
//do nothing
}
... View more
06-18-2014
12:09 PM
|
0
|
0
|
1944
|
|
POST
|
Hello! There are a number of syntax errors in the code you posted. This makes it much harder to debug from my end. Seeing several things that could be the issue but need more information. What error messages are you seeing in the console or debugger? Were you able to verify that the point is a valid Point object? Is the map in scope inside your showLocation() function? Thanks!
... View more
06-17-2014
01:52 PM
|
0
|
0
|
1364
|
|
POST
|
var point = new esri.geometry.Point(newpoint, outSR);
return point; This code exists outside your GeometryService projection callback so newpoint will always equal null. This is both a scope and timing issue. In the context of your current application, you would need to figure out a way to return the result of your projection to mapLoaded() based on the deferred response. Note: I wouldn't do that. It's far easier to restructure your application to be more 'script-like' in its execution. I would create a function specifically for projecting your point from your mapLoaded() function. Example below:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>View Site</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
<style>
html, body, #map {
height:100%;
width:100%;
margin:0;
padding:0;
}
</style>
<script src="http://js.arcgis.com/3.9/"></script>
<script>
var map;
require([
"esri/map", "esri/graphic", "esri/symbols/SimpleMarkerSymbol",
"esri/tasks/GeometryService", "esri/tasks/ProjectParameters",
"esri/SpatialReference", "esri/geometry/Extent", "esri/geometry/Point"
], function(
Map, Graphic, SimpleMarkerSymbol,
GeometryService, ProjectParameters, SpatialReference, Extent, Point
) {
map = new Map("map",{
basemap: "topo",
extent: new Extent(-13306545,6831419,-13027688,7064868, new SpatialReference({ wkid: 3857})),
minZoom: 2
});
map.on("load", mapLoaded);
function mapLoaded(){
map.graphics.clear();
showPoint();
};
function createSymbol(){
var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setColor("blue");
markerSymbol.setOutline(null);
return markerSymbol;
};
//convert point's coordinates from UTM NAD83 zone11 to Universal Tranverse Meracator:
function showPoint() {
var easting = 422310.0;
var northing = 5853918.0;
var newlong = null;
var newlat = null;
var newpoint = null;
var inSR = new SpatialReference({ wkid: 26911 });
var outSR = new SpatialReference({ wkid: 3857 });
var geometryService = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
var inputpoint = new Point(easting, northing, inSR);
var PrjParams = new ProjectParameters();
PrjParams.geometries = [ inputpoint ];
PrjParams.outSR = outSR;
geometryService.project(PrjParams, function(outputpoint) {
var point = new Point(outputpoint[0], outSR);
var graphic = new Graphic(point, createSymbol());
map.graphics.add(graphic);
});
};
});
</script>
</head>
<body class="claro">
<div id="map"></div>
<div id="picker1"></div>
</body>
</html>
... View more
06-17-2014
01:39 PM
|
0
|
0
|
1491
|
|
POST
|
Hi Chris, Could you provide a sample <cr> you are using as a test case? This thread is very old and I am unsure Bill ever solved his issue. In the future, feel free to create a new thread with your issue.
... View more
06-17-2014
12:57 PM
|
0
|
0
|
811
|
|
POST
|
I would recommend using Deferreds and Promises over a native timer.
... View more
06-17-2014
12:01 PM
|
0
|
0
|
1149
|
|
POST
|
I'm afraid i don't see what's wrong with the definition expression. var siteValue = dom.byId('drpSite').value; In your code, siteValue is null. When siteValue is null, using this expression will cause an error. This is not the correct way to get the value from a dom node using DOJO. If you are stuck using this approach, use dom.byId('drpSite').innerHTML
sites.setDefinitionExpression("NICKNAME='" + siteValue + "'");
dt.setDefinitionExpression("NICKNAME='" + siteValue + "' and ToBreak=" + sliderValue.value);
... View more
06-17-2014
11:53 AM
|
0
|
0
|
1745
|
|
POST
|
It appears to be a scope issue with siteValue and malformed definition expressions. siteValue appears to be null in certain cases. I noticed you are treating it like a global... this might not be the best approach for your application. Also, after fixing your definition expressions, the 'graphic' paramter in executeLocalSearch() still appears to be null, generating the second set of errors.
... View more
06-17-2014
11:20 AM
|
0
|
0
|
1745
|
|
POST
|
Mark, that JSFiddle you posted is incomplete. It doesn't load correctly and it seems to be referencing a few external JS files that were not included. If you could create a simple sample using just a map, the measurement widget and your operational layer to show off the current issue, it would help a great deal. I have not been able to recreate the issue with my own custom operational layers so I am leaning toward the issue being unrelated to the actual measurement widget and something in your code affecting your measurements. Thanks!
... View more
06-04-2014
12:26 PM
|
0
|
0
|
3584
|
|
POST
|
function showResults(featureSet)
{
map.graphics.clear();
var graphicsArray = [];
var resultFeatures = featureSet.features;
var railLocationTemplate = new InfoTemplate("Shop Location", "<b>Shop Name: </b>${NAME}<br/>");
for (var i=0, il=resultFeatures.length; i<il; i++) {
var graphic = resultFeatures;
graphic.setInfoTemplate(railLocationTemplate);
graphicsArray.push(graphic);
}
var extent = calcGraphicsExtent(graphicsArray);
map.setExtent(extent, true).then(function(){
for(var i=0; i<graphicsArray.length; i++) {
map.graphics.add(graphicsArray);
}
});
}
function calcGraphicsExtent(graphicsArray)
{
var g = graphicsArray[0].geometry,
fullExt = g.getExtent(),
ext, i, il = graphicsArray.length;
if (fullExt === null) {
fullExt = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
for (i=1; i<il; i++) {
ext = (g = graphicsArray.geometry).getExtent();
if (ext === null) {
ext = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
fullExt = fullExt.union(ext);
}
return fullExt;
}
Something like this will probably work.
... View more
06-04-2014
12:17 PM
|
0
|
0
|
2925
|
|
POST
|
Thanks....was looking at this example and it does not mention the autocomplete https://developers.arcgis.com/javascript/jssamples/locator_simple.html And different code....confusing sometimes No worries. Remember, the documentation always has more information than a sample can convey. In regards to:
var geocoder = new Geocoder({
map: map
}, "search");
geocoder.startup();
var geocoder = new Geocoder({
autoComplete: true,
map: map,
}, dom.byId("search"));
geocoder.startup();
Both of these do the same thing in practice.. it comes down to preference and understanding why one way works versus the other. Without getting into too much detail, the Geocoder widget handles both of these methods for setting the srcNodeRef. Coding styles differ like local accents in language... a southern accent compared to a New York accent for example. You can say the same thing in many different ways 🙂 As long as you understand "why" and "how", you will be able to understand the difference in any code.
... View more
06-03-2014
12:14 PM
|
0
|
0
|
956
|
|
POST
|
It has been fixed internally for next release. In the meantime, I was working on a 3.9 application level fix that I should probably share here. Using the following sample: http://developers.arcgis.com/javascript/sandbox/sandbox.html?sample=ed_selectionmode https://developers.arcgis.com/javascript/jssamples/ed_selectionmode.html Enter the following code before calling editorWidget.startup(); editorWidget._drawToolbar._mouse = true; This may or may not work in all browser/device combinations but it seemed to do the trick for simple test cases. Let me know if this helps at all.
... View more
06-03-2014
10:31 AM
|
0
|
3
|
1797
|
|
POST
|
ESRI developed a module to make showing/hiding DOM components easier than doing it the traditional way. You'll want to use "esri/domUtils" (https://developers.arcgis.com/javascript/jsapi/esri.domutils-amd.html). I use toggle(), but you could always use show() or hide(). var myButton = new Button({ label: "Click me!", onClick: function(){ // Do something: domUtils.toggle(dom.byId("divToShowOrHide")); } }, "buttonNode");
... View more
06-03-2014
08:51 AM
|
0
|
0
|
1250
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-26-2014 09:56 AM | |
| 1 | 09-18-2014 11:50 AM | |
| 1 | 09-19-2014 11:28 AM | |
| 1 | 07-09-2014 01:43 PM | |
| 1 | 07-09-2014 02:05 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-14-2024
05:31 PM
|