I'm wondering if anyone has generated a simpleLine Symbol in WAB. I'm wanting to pass a start and end location offset and return a line symbol from the entered values. does anyone know of an example out there to look at?
TIA
Solved! Go to Solution.
The jack rabbit comment cracked me up. First laugh I have had in a couple weeks. thanks for the help.. I did have a few questions.
1. When you set the var gra = new graphic, I understand the rs object but what are the null's?
2.What does the this.shelter.hide do?
3. What does the extend.expand(1.4) do?
4. What does the catch (e) catch?
Terry,
Glad to give a laugh.
I need to learn to use the ArcGIS API for javascript as a better resource for understanding syntax and requirements. My next step will be to try and incorporate a return error if the user enters an incorrect corridor name, or the route length is greater then the segment length. When I generated the service I added the LOC_ERROR field which returns these errors.. Any pointers where to start with that? Thanks again for your help.
I:'m thinking that I will add an if statement that if the LOC_error field is "NO ERROR" then return segment. else is LOC_ERROR is "Route Not Found" then return message""Please enter route with correct format." then repeat this for cases of starting point is before the start of the route, ending point is past the end of the route. Does that sound right?
Terry,
Are you sure that you would want to limit it to only "NO ERROR"? What about "PARTIAL MATCH FOR THE TO-MEASURE"? Currently this draw the route anyway but ignores the incorrect to measure provided.
sorry again clear as mud.. I just did not type the rest out. I meant that "repeat this for cases of starting point is before the start of the route, ending point is past the end of the route." If the starting point was before the start of the route the error would be "Partial MATCH for the from-measure" and the response would be something like "please enter valid starting location",and like you said if the ending location is past the end length of the segment the error would be "PARTIAL MATCH FOR THE TO-MEASURE" with a return message of "please check length of route as entered ending location is past the length of route"
sounds good. An if statement should be able to handle this.
When I get a chance to start working on this will my “if” statements be in the located in the following section of code?
renderResult: function (result) { console.info(result); var allFeatures = []; var lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 255, 0, 0.9]), 8); if (result.dataType === "GPFeatureRecordSetLayer") { var features = result.value && result.value.features; if (features && features.length > 0) { array.forEach(features, lang.hitch(this, function (feat) { allFeatures = allFeatures.concat(feat); feat.setSymbol(lineSymbol); this.map.graphics.add(feat); })); } } // this.shelter.hide(); if (allFeatures.length > 0) { try { var extent = graphicsUtils.graphicsExtent(allFeatures); if (extent) { this.map.setExtent(extent.expand(1.4)); } } catch (e) { console.error(e); } } }
yep