I currently have a featurelayer being queried, and the results placed in a graphicslayer ... I am hoping that the results can be placed in a new featurelayer instead?
Here is current code:
$("#radio-4").click(function() { //shows only January crimes
var sr = new SpatialReference(102100);
janResults = new GraphicsLayer();
janResults.title = "January";
map.add(janResults);
var janQuery = featurelayer.createQuery();
janQuery.where = "Month = 'January'";
janQuery.outFields = ["Offense" , "Location"];
janQuery.returnGeometry = true;
janQuery.outSpatialReference = sr;
featurelayer.queryFeatures(janQuery).then(displayGraphics);
function displayGraphics(results) {
janResults.removeAll();
for (feature of results.features) {
var janGraphic = new Graphic ({
geometry: feature.geometry,
symbol: {
type: "simple-marker",
color: "blue",
size: "20px",
outline: {
color:"black",
width: 2,
},
},
});
janResults.add(janGraphic);
}
}
}); //end of January query
Solved! Go to Solution.
John,
Change the renderer to this:
var sRenderer = {
type: "simple", // autocasts as new SimpleRenderer()
symbol: {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
size: "20px",
color: "blue",
style: "circle",
outline: {
width: 2,
color: "black"
}
}
};
Still no go
still no errors?
nope
John,
David over in this thread just used the graphics directly from the query.
How do you mean?
look at that thread.
I tried, but the link took me to another version of my own thread
Sorry, must have pasted wrong link:
Robert ... after all of that, it was the spatial reference ... I had omitted the line at the top of my function that set the output spatial reference to 102100!