0

I am new to all of coding and I have a rest point with all of my park polygons, what I want to do is be able to select a park name from a drop down menu and query out and display the single park that is chosen. I believe I have everything set up to query my geometry, now I don't know how to get it to draw the queried feature. right now I have 2 different drop downs. According to my professor i have the selection stored in "selectedParkFeature" variable, and all I have to do now is to draw it on the map. I have researched and I am stuck. I am doing all of this on ArcGIS API for JavaScript 3.17.

 query("#selectParkName").on('change', function (evt) { 
 var tempParkName = evt.target.value;
 getParkFeature(tempParkName);
});
//function to select the park
function getParkFeature(in_park_name) {
 var query = new Query();
 query.where = "NAME='" + in_park_name + "'";
 query.outFields = ["*"]; 
 park.queryFeatures(query, function (featureSet) {
 console.log(featureSet);
 selectedParkFeature = featureSet.features[0]; 
 });
}
asked Jul 11, 2016 at 23:10

1 Answer 1

1

Modify your function:

//function to select the park
function getParkFeature(in_park_name) {
 var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
 new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASHDOT,
 new Color([255,0,0]), 2),new Color([255,255,0,0.25])
 );
 var query = new Query();
 query.where = "NAME='" + in_park_name + "'";
 query.outFields = ["*"]; 
 park.queryFeatures(query, function (featureSet) {
 console.log(featureSet);
 selectedParkFeature = featureSet.features[0];
 map.graphics.add(new Graphic(selectedParkFeature.geometry, sfs)); 
 });
}
answered Jul 12, 2016 at 7:53
1
  • i changed it as is shown in your post, but it still will not draw. am I missing anything? Commented Jul 13, 2016 at 23:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.